Class DecisionRequester
The DecisionRequester component automatically request decisions for an Agent instance at regular intervals.
Inherited Members
Namespace: Unity.MLAgents
Assembly: Unity.ML-Agents.dll
Syntax
[AddComponentMenu("ML Agents/Decision Requester", 0)]
[RequireComponent(typeof(Agent))]
[DefaultExecutionOrder(-10)]
public class DecisionRequester : MonoBehaviour
Remarks
Attach a DecisionRequester component to the same [GameObject] as the Agent component.
The DecisionRequester component provides a convenient and flexible way to
trigger the agent decision making process. Without a DecisionRequester,
your Agent implementation must manually call its
Request
Fields
DecisionPeriod
The frequency with which the agent requests a decision. A DecisionPeriod of 5 means that the Agent will request a decision every 5 Academy steps. ///
Declaration
[Range(1, 20)]
[Tooltip("The frequency with which the agent requests a decision. A DecisionPeriod of 5 means that the Agent will request a decision every 5 Academy steps.")]
public int DecisionPeriod
Field Value
Type | Description |
---|---|
int |
DecisionStep
Indicates when to requests a decision. By changing this value, the timing of decision can be shifted even among agents with the same decision period. The value can be from 0 to DecisionPeriod - 1.
Declaration
[Range(0, 19)]
[Tooltip("Indicates when to requests a decision. By changing this value, the timing of decision can be shifted even among agents with the same decision period. The value can be from 0 to DecisionPeriod - 1.")]
public int DecisionStep
Field Value
Type | Description |
---|---|
int |
TakeActionsBetweenDecisions
Indicates whether or not the agent will take an action during the Academy steps where it does not request a decision. Has no effect when DecisionPeriod is set to 1.
Declaration
[Tooltip("Indicates whether or not the agent will take an action during the Academy steps where it does not request a decision. Has no effect when DecisionPeriod is set to 1.")]
[FormerlySerializedAs("RepeatAction")]
public bool TakeActionsBetweenDecisions
Field Value
Type | Description |
---|---|
bool |
Properties
Agent
Get the Agent attached to the DecisionRequester.
Declaration
public Agent Agent { get; }
Property Value
Type | Description |
---|---|
Agent |
Methods
ShouldRequestAction(DecisionRequestContext)
Whether Agent.RequestAction should be called on this update step.
Declaration
protected virtual bool ShouldRequestAction(DecisionRequester.DecisionRequestContext context)
Parameters
Type | Name | Description |
---|---|---|
Decision |
context |
|
Returns
Type | Description |
---|---|
bool | True if the agent |
ShouldRequestDecision(DecisionRequestContext)
Whether Agent.RequestDecision should be called on this update step.
Declaration
protected virtual bool ShouldRequestDecision(DecisionRequester.DecisionRequestContext context)
Parameters
Type | Name | Description |
---|---|---|
Decision |
context |
|
Returns
Type | Description |
---|---|
bool | True if the agent |