Class DiscreteActionMasker
The DiscreteActionMasker class represents a set of masked (disallowed) actions and provides utilities for setting and retrieving them.
Namespace: Unity.MLAgents
Syntax
public class DiscreteActionMasker : object
Remarks
Agents that take discrete actions can explicitly indicate that specific actions are not allowed at a point in time. This enables the agent to indicate that some actions may be illegal. For example, if an agent is adjacent to a wall or other obstacle you could mask any actions that direct the agent to move into the blocked space.
Methods
SetMask(Int32, IEnumerable<Int32>)
Modifies an action mask for discrete control agents.
Declaration
public void SetMask(int branch, IEnumerable<int> actionIndices)
Parameters
Type | Name | Description |
---|---|---|
Int32 | branch | The branch for which the actions will be masked. |
IEnumerable<Int32> | actionIndices | The indices of the masked actions. |
Remarks
When used, the agent will not be able to perform the actions passed as argument at the next decision for the specified action branch. The actionIndices correspond to the action options the agent will be unable to perform.
See Agents - Actions for more information on masking actions.