浏览代码

[MLA-1223] Backport Heuristic fixes (#4176)

* [bugfix] Make FoodCollector heuristic playable (#4147)
* Modified the documentation of the Heuristic method (default action = previous action) (#4174)

Co-authored-by: Ervin T <ervin@unity3d.com>
Co-authored-by: Vincent-Pierre BERGES <vincentpierre@unity3d.com>
/r2v-yamato-linux
GitHub 4 年前
当前提交
a54aef02
共有 5 个文件被更改,包括 9 次插入0 次删除
  1. 3
      Project/Assets/ML-Agents/Examples/FoodCollector/Scripts/FoodCollectorAgent.cs
  2. 1
      Project/Assets/ML-Agents/Examples/Soccer/Scripts/AgentSoccer.cs
  3. 1
      Project/Assets/ML-Agents/Examples/WallJump/Scripts/WallJumpAgent.cs
  4. 2
      com.unity.ml-agents/CHANGELOG.md
  5. 2
      com.unity.ml-agents/Runtime/Agent.cs

3
Project/Assets/ML-Agents/Examples/FoodCollector/Scripts/FoodCollectorAgent.cs


public override void Heuristic(float[] actionsOut)
{
actionsOut[0] = 0f;
actionsOut[1] = 0f;
actionsOut[2] = 0f;
if (Input.GetKey(KeyCode.D))
{
actionsOut[2] = 2f;

1
Project/Assets/ML-Agents/Examples/Soccer/Scripts/AgentSoccer.cs


public override void Heuristic(float[] actionsOut)
{
Array.Clear(actionsOut, 0, actionsOut.Length);
//forward
if (Input.GetKey(KeyCode.W))
{

1
Project/Assets/ML-Agents/Examples/WallJump/Scripts/WallJumpAgent.cs


public override void Heuristic(float[] actionsOut)
{
System.Array.Clear(actionsOut, 0, actionsOut.Length);
if (Input.GetKey(KeyCode.D))
{
actionsOut[1] = 2f;

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


- Fixed an issue where RayPerceptionSensor would raise an exception when the
list of tags was empty, or a tag in the list was invalid (unknown, null, or
empty string). (#4155)
#### ml-agents / ml-agents-envs / gym-unity (Python)
- Fixed issue with FoodCollector, Soccer, and WallJump when playing with keyboard. (#4147, #4174)
## [1.0.2] - 2020-06-04
### Minor Changes

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


///
/// Your heuristic implementation can use any decision making logic you specify. Assign decision
/// values to the float[] array, <paramref name="actionsOut"/>, passed to your function as a parameter.
/// The same array will be reused between steps. It is up to the user to initialize
/// the values on each call, for example by calling `Array.Clear(actionsOut, 0, actionsOut.Length);`.
/// Add values to the array at the same indexes as they are used in your
/// <seealso cref="OnActionReceived(float[])"/> function, which receives this array and
/// implements the corresponding agent behavior. See [Actions] for more information

正在加载...
取消
保存