浏览代码

fix on the CoreBrains so that if one Corebrain gets eraised, it will be reinstanciated

/develop-generalizationTraining-TrainerController
vincentpierre 7 年前
当前提交
447da485
共有 1 个文件被更改,包括 14 次插入2 次删除
  1. 16
      unity-environment/Assets/ML-Agents/Scripts/Brain.cs

16
unity-environment/Assets/ML-Agents/Scripts/Brain.cs


}
}
else
{
foreach (BrainType bt in System.Enum.GetValues(typeof(BrainType)))
{
if ((int)bt >= CoreBrains.Length)
break;
if (CoreBrains[(int)bt] == null)
{
CoreBrains[(int)bt] = ScriptableObject.CreateInstance("CoreBrain" + bt.ToString());
}
}
}
// If the length of CoreBrains does not match the number of BrainTypes,
// we increase the length of CoreBrains

foreach (KeyValuePair<int, Agent> idAgent in agents)
{
List<float> states = idAgent.Value.CollectState();
if ((states.Count != brainParameters.stateSize) && (brainParameters.stateSpaceType == StateType.continuous ))
if ((states.Count != brainParameters.stateSize) && (brainParameters.stateSpaceType == StateType.continuous))
if ((states.Count != 1) && (brainParameters.stateSpaceType == StateType.discrete ))
if ((states.Count != 1) && (brainParameters.stateSpaceType == StateType.discrete))
{
throw new UnityAgentsException(string.Format(@"The number of states does not match for agent {0}:
Was expecting 1 discrete states but received {1}.", idAgent.Value.gameObject.name, states.Count));

正在加载...
取消
保存