Struct ActionSpec
Defines the structure of an Action Space to be used by the Actuator system.
Inherited Members
Namespace: Unity.MLAgents.Actuators
Syntax
public struct ActionSpec
Fields
BranchSizes
An array of branch sizes for our action space.
For an IActuator that uses a Discrete SpaceType, 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 readonly int[] BranchSizes
Field Value
Type | Description |
---|---|
Int32[] |
Properties
NumContinuousActions
The number of actions for a Continuous SpaceType.
Declaration
public int NumContinuousActions { get; }
Property Value
Type | Description |
---|---|
Int32 |
NumDiscreteActions
The number of branches for a Discrete SpaceType.
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
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 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 action space. 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. |