public void TestDefaultAgentInfoToProto() { // Should be able to convert a default instance to proto. var agentInfo = new AgentInfo(); var pairProto = agentInfo.ToInfoActionPairProto(); pairProto.AgentInfo.Observations.Add(new ObservationProto { CompressedData = ByteString.Empty, CompressionType = CompressionTypeProto.None, FloatData = new ObservationProto.Types.FloatData(), ObservationType = ObservationTypeProto.Default, Name = "Sensor" }); pairProto.AgentInfo.Observations[0].Shape.Add(0); pairProto.GetObservationSummaries(); agentInfo.ToAgentInfoProto(); agentInfo.groupId = 1; Academy.Instance.TrainerCapabilities = new UnityRLCapabilities { BaseRLCapabilities = true, MultiAgentGroups = false }; agentInfo.ToAgentInfoProto(); LogAssert.Expect(LogType.Warning, new Regex(".+")); Academy.Instance.TrainerCapabilities = new UnityRLCapabilities { BaseRLCapabilities = true, MultiAgentGroups = true }; agentInfo.ToAgentInfoProto(); }
/// <summary> /// Write AgentInfo experience to file. /// </summary> /// <param name="info"> <see cref="AgentInfo"/> for the agent being recorded.</param> /// <param name="sensors">List of sensors to record for the agent.</param> internal void Record(AgentInfo info, List <ISensor> sensors) { if (m_Writer == null) { // Already closed return; } // Increment meta-data counters. m_MetaData.numberExperiences++; m_CumulativeReward += info.reward; if (info.done) { EndEpisode(); } // Generate observations and add AgentInfo to file. var agentProto = info.ToInfoActionPairProto(); foreach (var sensor in sensors) { agentProto.AgentInfo.Observations.Add(sensor.GetObservationProto(m_WriteAdapter)); } agentProto.WriteDelimitedTo(m_Writer); }
public void TestDefaultAgentInfoToProto() { // Should be able to convert a default instance to proto. var agentInfo = new AgentInfo(); agentInfo.ToInfoActionPairProto(); agentInfo.ToAgentInfoProto(); }