浏览代码

Remove obsolete methods from Agent class (#3770)

* Removed the obsolete methods from the Agent class

* Documentation changes

* [skip ci] Update com.unity.ml-agents/CHANGELOG.md

Co-Authored-By: Chris Elion <chris.elion@unity3d.com>

* [skip ci] Update docs/Migrating.md

Co-Authored-By: Chris Elion <chris.elion@unity3d.com>

Co-authored-by: Chris Elion <chris.elion@unity3d.com>
/develop/add-fire
GitHub 5 年前
当前提交
8b5587cc
共有 3 个文件被更改,包括 5 次插入48 次删除
  1. 1
      com.unity.ml-agents/CHANGELOG.md
  2. 51
      com.unity.ml-agents/Runtime/Agent.cs
  3. 1
      docs/Migrating.md

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


- The offset logic was removed from DecisionRequester.
- The signature of `Agent.Heuristic()` was changed to take a `float[]` as a parameter, instead of returning the array. This was done to prevent a common source of error where users would return arrays of the wrong size.
- The communication API version has been bumped up to 1.0.0 and will use [Semantic Versioning](https://semver.org/) to do compatibility checks for communication between Unity and the Python process.
- The obsolete `Agent` methods `GiveModel`, `Done`, `InitializeAgent`, `AgentAction` and `AgentReset` have been removed.
### Minor Changes
- Format of console output has changed slightly and now matches the name of the model/summary directory. (#3630, #3616)

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


m_RequestDecision = false;
}
[Obsolete("GiveModel() has been deprecated, use SetModel() instead.")]
public void GiveModel(
string behaviorName,
NNModel model,
InferenceDevice inferenceDevice = InferenceDevice.CPU)
{
SetModel(behaviorName, model, inferenceDevice);
}
/// <summary>
/// Updates the Model for the agent. Any model currently assigned to the
/// agent will be replaced with the provided one. If the arguments are

TimerStack.Instance.SetGauge(gaugeName, GetCumulativeReward());
}
[Obsolete("Done() has been deprecated, use EndEpisode() instead.")]
public void Done()
{
EndEpisode();
}
/// <summary>
/// Sets the done flag to true.
/// </summary>

}
}
[Obsolete("InitializeAgent() has been deprecated, use Initialize() instead.")]
public virtual void InitializeAgent()
{
}
/// <summary>
/// Initializes the agent, called once when the agent is enabled. Can be
/// left empty if there is no special, unique set-up behavior for the

/// One sample use is to store local references to other objects in the
/// scene which would facilitate computing this agents observation.
/// </remarks>
public virtual void Initialize()
{
#pragma warning disable 0618
InitializeAgent();
#pragma warning restore 0618
}
public virtual void Initialize(){}
/// <summary>
/// When the Agent uses Heuristics, it will call this method every time it

{
}
[Obsolete("AgentAction() has been deprecated, use OnActionReceived() instead.")]
public virtual void AgentAction(float[] vectorAction)
{
}
/// <summary>
/// Specifies the agent behavior at every step based on the provided
/// action.

/// will be of length 1.
/// </param>
public virtual void OnActionReceived(float[] vectorAction)
{
#pragma warning disable 0618
AgentAction(m_Action.vectorActions);
#pragma warning restore 0618
}
[Obsolete("AgentReset() has been deprecated, use OnEpisodeBegin() instead.")]
public virtual void AgentReset()
{
}
public virtual void OnActionReceived(float[] vectorAction){}
/// <summary>
/// Specifies the agent behavior when being reset, which can be due to

public virtual void OnEpisodeBegin()
{
#pragma warning disable 0618
AgentReset();
#pragma warning restore 0618
}
public virtual void OnEpisodeBegin(){}
/// <summary>
/// Returns the last action that was decided on by the Agent

1
docs/Migrating.md


* The `play_against_current_self_ratio` self-play trainer hyperparameter has been renamed to `play_against_latest_model_ratio`
* Removed the multi-agent gym option from the gym wrapper. For multi-agent scenarios, use the [Low Level Python API](Python-API.md).
* The low level Python API has changed. You can look at the document [Low Level Python API documentation](Python-API.md) for more information. If you use `mlagents-learn` for training, this should be a transparent change.
* The obsolete `Agent` methods `GiveModel`, `Done`, `InitializeAgent`, `AgentAction` and `AgentReset` have been removed.
* The signature of `Agent.Heuristic()` was changed to take a `float[]` as a parameter, instead of returning the array. This was done to prevent a common source of error where users would return arrays of the wrong size.
### Steps to Migrate

正在加载...
取消
保存