浏览代码

Make IActuator implement IHeuristicProvider. (#5110)

/v2-staging-rebase
GitHub 4 年前
当前提交
59d530fe
共有 6 个文件被更改,包括 7 次插入6 次删除
  1. 2
      com.unity.ml-agents.extensions/Runtime/Input/InputActionActuator.cs
  2. 1
      com.unity.ml-agents/CHANGELOG.md
  3. 4
      com.unity.ml-agents/Runtime/Actuators/ActuatorManager.cs
  4. 2
      com.unity.ml-agents/Runtime/Actuators/IActuator.cs
  5. 2
      com.unity.ml-agents/Runtime/Actuators/VectorActuator.cs
  6. 2
      docs/Migrating.md

2
com.unity.ml-agents.extensions/Runtime/Input/InputActionActuator.cs


/// <see cref="Agent"/>'s <see cref="BehaviorParameters"/> indicate that the Agent is running in Heuristic Mode,
/// this Actuator will write actions from the <see cref="InputSystem"/> to the <see cref="ActionBuffers"/> object.
/// </summary>
public class InputActionActuator : IActuator, IHeuristicProvider, IBuiltInActuator
public class InputActionActuator : IActuator, IBuiltInActuator
{
readonly BehaviorParameters m_BehaviorParameters;
readonly InputAction m_Action;

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


- The interface for disabling discrete actions in `IDiscreteActionMask` has changed.
`WriteMask(int branch, IEnumerable<int> actionIndices)` was replaced with
`SetActionEnabled(int branch, int actionIndex, bool isEnabled)`. See the
- IActuator now implements IHeuristicProvider. (#5110)
[Migration Guide](https://github.com/Unity-Technologies/ml-agents/blob/release_14_docs/docs/Migrating.md) for more
details. (#5060)
#### ml-agents / ml-agents-envs / gym-unity (Python)

4
com.unity.ml-agents/Runtime/Actuators/ActuatorManager.cs


discreteStart,
numDiscreteActions);
}
var heuristic = actuator as IHeuristicProvider;
heuristic?.Heuristic(new ActionBuffers(continuousActions, discreteActions));
actuator.Heuristic(new ActionBuffers(continuousActions, discreteActions));
continuousStart += numContinuousActions;
discreteStart += numDiscreteActions;
}

2
com.unity.ml-agents/Runtime/Actuators/IActuator.cs


/// <summary>
/// Abstraction that facilitates the execution of actions.
/// </summary>
public interface IActuator : IActionReceiver
public interface IActuator : IActionReceiver, IHeuristicProvider
{
/// <summary>
/// The specification of the actions for this IActuator.

2
com.unity.ml-agents/Runtime/Actuators/VectorActuator.cs


/// <summary>
/// IActuator implementation that forwards calls to an <see cref="IActionReceiver"/> and an <see cref="IHeuristicProvider"/>.
/// </summary>
internal class VectorActuator : IActuator, IHeuristicProvider, IBuiltInActuator
internal class VectorActuator : IActuator, IBuiltInActuator
{
IActionReceiver m_ActionReceiver;
IHeuristicProvider m_HeuristicProvider;

2
docs/Migrating.md


actionMask.SetActionEnabled(branch, 3, false);
}
```
- The `IActuator` interface now implements `IHeuristicProvider`. Please add the corresponding `Heuristic(in ActionBuffers)`
method to your custom Actuator classes.
## Migrating to Release 13
### Implementing IHeuristic in your IActuator implementations

正在加载...
取消
保存