Struct ActionSpec
Defines the structure of the actions to be used by the Actuator system.
Inherited Members
Namespace: Unity.MLAgents.Actuators
Syntax
[Serializable]
public struct ActionSpec
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
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 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. |