Unity 机器学习代理工具包 (ML-Agents) 是一个开源项目,它使游戏和模拟能够作为训练智能代理的环境。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

48 行
1.4 KiB

using UnityEngine;
using System.Collections.Generic;
using MLAgents.Sensor;
using System;
namespace MLAgents
{
/// <summary>
/// The Remote Policy only works when training.
/// When training your Agents, the RemotePolicy will be controlled by Python.
/// </summary>
public class RemotePolicy : IPolicy
{
string m_FullyQualifiedBehaviorName;
protected ICommunicator m_Communicator;
/// <summary>
/// Sensor shapes for the associated Agents. All Agents must have the same shapes for their Sensors.
/// </summary>
List<int[]> m_SensorShapes;
/// <inheritdoc />
public RemotePolicy(
BrainParameters brainParameters,
string fullyQualifiedBehaviorName)
{
m_FullyQualifiedBehaviorName = fullyQualifiedBehaviorName;
m_Communicator = Academy.Instance.Communicator;
m_Communicator.SubscribeBrain(m_FullyQualifiedBehaviorName, brainParameters);
}
/// <inheritdoc />
public void RequestDecision(AgentInfo info, List<ISensor> sensors, Action<AgentAction> action)
{
m_Communicator?.PutObservations(m_FullyQualifiedBehaviorName, info, sensors, action);
}
/// <inheritdoc />
public void DecideAction()
{
m_Communicator?.DecideBatch();
}
public void Dispose()
{
}
}
}