Struct ActionSpec
Defines the structure of the actions to be used by the Actuator system.
Namespace: Unity.MLAgents.Actuators
Syntax
public struct ActionSpec
Constructors
ActionSpec(Int32, Int32[])
Create an ActionSpec initialized with the specified action sizes.
Declaration
public ActionSpec(int numContinuousActions = 0, int[] discreteBranchSizes = null)
Parameters
Type | Name | Description |
---|---|---|
Int32 | numContinuousActions | The number of continuous actions available. |
Int32[] | discreteBranchSizes | The array of branch sizes for the discrete actions. Each index contains the number of actions available for that branch. |
Fields
BranchSizes
An array of branch sizes for discrete actions.
For an IActuator that uses discrete actions, the number of branches is the Length of the Array and each index contains the branch size. The cumulative sum of the total number of discrete actions can be retrieved by the SumOfDiscreteBranchSizes property.
For an IActuator with a Continuous it will be null.
Declaration
public int[] BranchSizes
Field Value
Type | Description |
---|---|
Int32[] |
Properties
NumContinuousActions
The number of continuous actions that an Agent can take.
Declaration
public int NumContinuousActions { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
NumDiscreteActions
The number of branches for discrete actions that an Agent can take.
Declaration
public int NumDiscreteActions { get; }
Property Value
Type | Description |
---|---|
Int32 |
SumOfDiscreteBranchSizes
Get the total number of Discrete Actions that can be taken by calculating the Sum of all of the Discrete Action branch sizes.
Declaration
public int SumOfDiscreteBranchSizes { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
Combine(ActionSpec[])
Combines a list of actions specs and allocates a new array of branch sizes if needed.
Declaration
public static ActionSpec Combine(params ActionSpec[] specs)
Parameters
Type | Name | Description |
---|---|---|
ActionSpec[] | specs | The list of action specs to combine. |
Returns
Type | Description |
---|---|
ActionSpec | An ActionSpec which represents the aggregate of the ActionSpecs passed in. |
MakeContinuous(Int32)
Creates a Continuous ActionSpec with the number of actions available.
Declaration
public static ActionSpec MakeContinuous(int numActions)
Parameters
Type | Name | Description |
---|---|---|
Int32 | numActions | The number of continuous actions available. |
Returns
Type | Description |
---|---|
ActionSpec | An Continuous ActionSpec initialized with the number of actions available. |
MakeDiscrete(Int32[])
Creates a Discrete ActionSpec with the array of branch sizes that represents the action space.
Declaration
public static ActionSpec MakeDiscrete(params int[] branchSizes)
Parameters
Type | Name | Description |
---|---|---|
Int32[] | branchSizes | The array of branch sizes for the discrete actions. Each index contains the number of actions available for that branch. |
Returns
Type | Description |
---|---|
ActionSpec | An Discrete ActionSpec initialized with the array of branch sizes. |