浏览代码

minor fixes

/develop-generalizationTraining-TrainerController
vincentpierre 7 年前
当前提交
0df8326e
共有 3 个文件被更改,包括 31 次插入3 次删除
  1. 1
      python/unityagents/environment.py
  2. 9
      unity-environment/Assets/ML-Agents/Scripts/Agent.cs
  3. 24
      unity-environment/Assets/ML-Agents/Scripts/CoreBrainInternal.cs

1
python/unityagents/environment.py


self._resetParameters = p["resetParameters"]
for i in range(self._num_brains):
self._brains[self._brain_names[i]] = BrainParameters(self._brain_names[i], p["brainParameters"][i])
print(p["brainParameters"][i])
self._conn.send(b".")
self._loaded = True
logger.info("\n'{}' started successfully!".format(self._academy_name))

9
unity-environment/Assets/ML-Agents/Scripts/Agent.cs


RemoveBrain();
brain = b;
brain.agents.Add(id, gameObject.GetComponent<Agent>());
agentStoredAction = new float[brain.brainParameters.actionSize];
if (brain.brainParameters.actionSpaceType == StateType.continuous)
{
agentStoredAction = new float[brain.brainParameters.actionSize];
}
else
{
agentStoredAction = new float[1];
}
memory = new float[brain.brainParameters.memorySize];
}

24
unity-environment/Assets/ML-Agents/Scripts/CoreBrainInternal.cs


}
ExternalCommunicator coord;
/// Modify only in inspector : Reference to the Graph asset
public TextAsset graphModel;
/// Modify only in inspector : If a scope was used when training the model, specify it here

}
#endif
if (brain.gameObject.transform.parent.gameObject.GetComponent<Academy>().communicator == null)
{
coord = null;
}
else if (brain.gameObject.transform.parent.gameObject.GetComponent<Academy>().communicator is ExternalCommunicator)
{
coord = (ExternalCommunicator)brain.gameObject.transform.parent.gameObject.GetComponent<Academy>().communicator;
coord.SubscribeBrain(brain);
}
if (graphModel != null)
{

currentBatchSize = brain.agents.Count;
if (currentBatchSize == 0)
{
if (coord!=null)
{
coord.giveBrainInfo(brain);
}
return;
}

i++;
}
}
#endif
if (coord!=null)
{
coord.giveBrainInfo(brain);
}
#endif
}

正在加载...
取消
保存