Struct ActionSpec
Defines the structure of the actions to be used by the Actuator system.
Inherited Members
Namespace: Unity.MLAgents.Actuators
Assembly: Unity.ML-Agents.dll
Syntax
[Serializable]
public struct ActionSpec
Constructors
ActionSpec(int, int[])
Create an ActionSpec initialized with the specified action sizes.
Declaration
public ActionSpec(int numContinuousActions = 0, int[] discreteBranchSizes = null)
Parameters
Type | Name | Description |
---|---|---|
int | numContinuousActions | The number of continuous actions available. |
int[] | 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 Sum
For an IActuator with a Continuous it will be null.
Declaration
public int[] BranchSizes
Field Value
Type | Description |
---|---|
int[] |
Properties
NumContinuousActions
The number of continuous actions that an Agent can take.
Declaration
public int NumContinuousActions { get; set; }
Property Value
Type | Description |
---|---|
int |
NumDiscreteActions
The number of branches for discrete actions that an Agent can take.
Declaration
public int NumDiscreteActions { get; }
Property Value
Type | Description |
---|---|
int |
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 |
---|---|
int |
Methods
Combine(params 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 |
---|---|---|
Action |
specs | The list of action specs to combine. |
Returns
Type | Description |
---|---|
Action |
An ActionSpec which represents the aggregate of the ActionSpecs passed in. |
MakeContinuous(int)
Creates a Continuous Action
Declaration
public static ActionSpec MakeContinuous(int numActions)
Parameters
Type | Name | Description |
---|---|---|
int | numActions | The number of continuous actions available. |
Returns
Type | Description |
---|---|
Action |
An Continuous ActionSpec initialized with the number of actions available. |
MakeDiscrete(params int[])
Creates a Discrete Action
Declaration
public static ActionSpec MakeDiscrete(params int[] branchSizes)
Parameters
Type | Name | Description |
---|---|---|
int[] | branchSizes | The array of branch sizes for the discrete actions. Each index contains the number of actions available for that branch. |
Returns
Type | Description |
---|---|
Action |
An Discrete ActionSpec initialized with the array of branch sizes. |