|
|
|
|
|
|
/// * <see cref="BehaviorType.InferenceOnly"/>: decisions are always made using the trained
|
|
|
|
/// model specified in the <see cref="BehaviorParameters"/> component.
|
|
|
|
/// * <see cref="BehaviorType.HeuristicOnly"/>: when a decision is needed, the agent's
|
|
|
|
/// <see cref="Heuristic"/> function is called. Your implementation is responsible for
|
|
|
|
/// <see cref="Heuristic(in ActionBuffers)"/> function is called. Your implementation is responsible for
|
|
|
|
/// providing the appropriate action.
|
|
|
|
///
|
|
|
|
/// To trigger an agent decision automatically, you can attach a <see cref="DecisionRequester"/>
|
|
|
|
|
|
|
/// can only take an action when it touches the ground, so several frames might elapse between
|
|
|
|
/// one decision and the need for the next.
|
|
|
|
///
|
|
|
|
/// Use the <see cref="OnActionReceived(float[])"/> function to implement the actions your agent can take,
|
|
|
|
/// Use the <see cref="OnActionReceived(ActionBuffers)"/> function to implement the actions your agent can take,
|
|
|
|
/// such as moving to reach a goal or interacting with its environment.
|
|
|
|
///
|
|
|
|
/// When you call <see cref="EndEpisode"/> on an agent or the agent reaches its <see cref="MaxStep"/> count,
|
|
|
|
|
|
|
/// only use the [MonoBehaviour.Update] function for cosmetic purposes. If you override the [MonoBehaviour]
|
|
|
|
/// methods, [OnEnable()] or [OnDisable()], always call the base Agent class implementations.
|
|
|
|
///
|
|
|
|
/// You can implement the <see cref="Heuristic"/> function to specify agent actions using
|
|
|
|
/// You can implement the <see cref="Heuristic(in ActionBuffers)"/> function to specify agent actions using
|
|
|
|
/// your own heuristic algorithm. Implementing a heuristic function can be useful
|
|
|
|
/// for debugging. For example, you can use keyboard input to select agent actions in
|
|
|
|
/// order to manually control an agent's behavior.
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// VectorActuator which is used by default if no other sensors exist on this Agent. This VectorSensor will
|
|
|
|
/// delegate its actions to <see cref="OnActionReceived(float[])"/> by default in order to keep backward compatibility
|
|
|
|
/// delegate its actions to <see cref="OnActionReceived(ActionBuffers)"/> by default in order to keep backward compatibility
|
|
|
|
/// with the current behavior of Agent.
|
|
|
|
/// </summary>
|
|
|
|
IActuator m_VectorActuator; |
|
|
|
|
|
|
/// Use <see cref="AddReward(float)"/> to incrementally change the reward rather than
|
|
|
|
/// overriding it.
|
|
|
|
///
|
|
|
|
/// Typically, you assign rewards in the Agent subclass's <see cref="OnActionReceived(float[])"/>
|
|
|
|
/// Typically, you assign rewards in the Agent subclass's <see cref="OnActionReceived(ActionBuffers)"/>
|
|
|
|
/// implementation after carrying out the received action and evaluating its success.
|
|
|
|
///
|
|
|
|
/// Rewards are used during reinforcement learning; they are ignored during inference.
|
|
|
|
|
|
|
/// You can also use the [Input System package], which provides a more flexible and
|
|
|
|
/// configurable input system.
|
|
|
|
/// <code>
|
|
|
|
/// public override void Heuristic(ActionBuffers actionsOut)
|
|
|
|
/// public override void Heuristic(in ActionBuffers actionsOut)
|
|
|
|
/// actionsOut.ContinuousActions[0] = Input.GetAxis("Horizontal");
|
|
|
|
/// actionsOut.ContinuousActions[1] = Input.GetKey(KeyCode.Space) ? 1.0f : 0.0f;
|
|
|
|
/// actionsOut.ContinuousActions[2] = Input.GetAxis("Vertical");
|
|
|
|
/// var continuousActionsOut = actionsOut.ContinuousActions;
|
|
|
|
/// continuousActionsOut[0] = Input.GetAxis("Horizontal");
|
|
|
|
/// continuousActionsOut[1] = Input.GetKey(KeyCode.Space) ? 1.0f : 0.0f;
|
|
|
|
/// continuousActionsOut[2] = Input.GetAxis("Vertical");
|
|
|
|
/// }
|
|
|
|
/// </code>
|
|
|
|
/// [Input Manager]: https://docs.unity3d.com/Manual/class-InputManager.html
|
|
|
|