浏览代码

Replace Agent.GetStepCount with Agent.StepCount` (#3476)

/asymm-envs
GitHub 5 年前
当前提交
c55cb4df
共有 5 个文件被更改,包括 11 次插入9 次删除
  1. 2
      Project/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayAgent.cs
  2. 1
      com.unity.ml-agents/CHANGELOG.md
  3. 7
      com.unity.ml-agents/Runtime/Agent.cs
  4. 8
      com.unity.ml-agents/Tests/Editor/MLAgentsEditModeTest.cs
  5. 2
      docs/Migrating.md

2
Project/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayAgent.cs


{
if (useVectorObs)
{
sensor.AddObservation(GetStepCount() / (float)maxStep);
sensor.AddObservation(StepCount / (float)maxStep);
}
}

1
com.unity.ml-agents/CHANGELOG.md


- The stepping logic for the Agent and the Academy has been simplified (#3448)
- Update Barracuda to 0.6.0-preview
- The checkpoint file suffix was changed from `.cptk` to `.ckpt` (#3470)
- The method `GetStepCount()` on the Agent class has been replaced with the property getter `StepCount`
### Bugfixes
- Fixed an issue which caused self-play training sessions to consume a lot of memory. (#3451)

7
com.unity.ml-agents/Runtime/Agent.cs


m_Brain = m_PolicyFactory.GeneratePolicy(Heuristic);
}
/// <summary>
/// Current episode number.
/// Current step count.
public int GetStepCount()
public int StepCount
return m_StepCount;
get { return m_StepCount; }
}
/// <summary>

8
com.unity.ml-agents/Tests/Editor/MLAgentsEditModeTest.cs


Assert.AreEqual(i, aca.TotalStepCount);
Assert.AreEqual(agent2StepSinceReset, agent2.GetStepCount());
Assert.AreEqual(agent2StepSinceReset, agent2.StepCount);
Assert.AreEqual(numberAgent1Reset, agent1.agentResetCalls);
Assert.AreEqual(numberAgent2Reset, agent2.agentResetCalls);

expectedAgentStepCount += 1;
// If the next step will put the agent at maxSteps, we expect it to reset
if (agent1.GetStepCount() == maxStep - 1 || (i == 0))
if (agent1.StepCount == maxStep - 1 || (i == 0))
if (agent1.GetStepCount() == maxStep - 1)
if (agent1.StepCount == maxStep - 1)
{
expectedAgentActionSinceReset = 0;
expectedCollectObsCallsSinceReset = 0;

Assert.AreEqual(expectedAgentStepCount, agent1.GetStepCount());
Assert.AreEqual(expectedAgentStepCount, agent1.StepCount);
Assert.AreEqual(expectedResets, agent1.agentResetCalls);
Assert.AreEqual(expectedAgentAction, agent1.agentActionCalls);
Assert.AreEqual(expectedAgentActionSinceReset, agent1.agentActionCallsSinceLastReset);

2
docs/Migrating.md


* The `Monitor` class has been moved to the Examples Project. (It was prone to errors during testing)
* The `MLAgents.Sensor` namespace has been removed. All sensors now belong to the `MLAgents` namespace.
* The `SetActionMask` method must now be called on the optional `ActionMasker` argument of the `CollectObservations` method. (We now consider an action mask as a type of observation)
* The method `GetStepCount()` on the Agent class has been replaced with the property getter `StepCount`
* Replace all calls to `Agent.GetStepCount()` with `Agent.StepCount`
## Migrating from 0.13 to 0.14

正在加载...
取消
保存