Class DiscreteActionMasker | ML Agents | 1.6.0-preview
docs.unity.cn
    Show / Hide Table of Contents

    Class DiscreteActionMasker

    The DiscreteActionMasker class represents a set of masked (disallowed) actions and provides utilities for setting and retrieving them.

    Inheritance
    Object
    DiscreteActionMasker
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.MLAgents
    Syntax
    public class DiscreteActionMasker : IDiscreteActionMask
    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

    GetMask()

    Get the current mask for an agent.

    Declaration
    public bool[] GetMask()
    Returns
    Type Description
    Boolean[]

    A mask for the agent. A boolean array of length equal to the total number of actions.

    Implements
    IDiscreteActionMask.GetMask()

    ResetMask()

    Resets the current mask for an agent.

    Declaration
    public void ResetMask()
    Implements
    IDiscreteActionMask.ResetMask()

    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.

    WriteMask(Int32, IEnumerable<Int32>)

    Modifies an action mask for discrete control agents.

    Declaration
    public void WriteMask(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.

    Implements
    IDiscreteActionMask.WriteMask(Int32, IEnumerable<Int32>)
    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.

    Back to top Copyright © 2020 Unity Technologies
    Generated by DocFX
    on 20 November 2020