docs.unity3d.com
    Show / Hide Table of Contents

    Class Academy

    The Academy singleton manages agent training and decision making.

    Inheritance
    Object
    Academy
    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
    [HelpURL("https://github.com/Unity-Technologies/ml-agents/tree/release_20_docs/docs/Learning-Environment-Design.md")]
    public class Academy : IDisposable
    Remarks

    Access the Academy singleton through the Instance property. The Academy instance is initialized the first time it is accessed (which will typically be by the first Agent initialized in a scene).

    At initialization, the Academy attempts to connect to the Python training process through the external communicator. If successful, the training process can train Agent instances. When you set an agent's BehaviorType setting to Default, the agent exchanges data with the training process to make decisions. If no training process is available, agents with the default behavior fall back to inference or heuristic decisions. (You can also set agents to always use inference or heuristics.)

    Constructors

    Academy()

    Private constructor called the first time the Academy is used. Academy uses this time to initialize internal data structures, initialize the environment and check for the existence of a communicator.

    Declaration
    protected Academy()

    Properties

    AutomaticSteppingEnabled

    Determines whether or not the Academy is automatically stepped during the FixedUpdate phase.

    Declaration
    public bool AutomaticSteppingEnabled { get; set; }
    Property Value
    Type Description
    Boolean

    Set true to enable automatic stepping; false to disable.

    EnvironmentParameters

    Returns the EnvironmentParameters instance. If training features such as Curriculum Learning or Environment Parameter Randomization are used, then the values of the parameters generated from the training process can be retrieved here.

    Declaration
    public EnvironmentParameters EnvironmentParameters { get; }
    Property Value
    Type Description
    EnvironmentParameters

    EpisodeCount

    The current episode count.

    Declaration
    public int EpisodeCount { get; }
    Property Value
    Type Description
    Int32

    Current episode number.

    InferenceSeed

    Set the random seed used for inference. This should be set before any Agents are added to the scene. The seed is passed to the ModelRunner constructor, and incremented each time a new ModelRunner is created.

    Declaration
    public int InferenceSeed { set; }
    Property Value
    Type Description
    Int32

    Instance

    The singleton Academy object.

    Declaration
    public static Academy Instance { get; }
    Property Value
    Type Description
    Academy

    Getting the instance initializes the Academy, if necessary.

    IsCommunicatorOn

    Reports whether or not the communicator is on.

    Declaration
    public bool IsCommunicatorOn { get; }
    Property Value
    Type Description
    Boolean

    True, if communicator is on, false otherwise.

    See Also
    ICommunicator

    IsInitialized

    Reports whether the Academy has been initialized yet.

    Declaration
    public static bool IsInitialized { get; }
    Property Value
    Type Description
    Boolean

    True if the Academy is initialized, false otherwise.

    NumAreas

    Number of training areas to instantiate.

    Declaration
    public int NumAreas { get; }
    Property Value
    Type Description
    Int32

    StatsRecorder

    Returns the StatsRecorder instance. This instance can be used to record any statistics from the Unity environment.

    Declaration
    public StatsRecorder StatsRecorder { get; }
    Property Value
    Type Description
    StatsRecorder

    StepCount

    The current step count (within the current episode).

    Declaration
    public int StepCount { get; }
    Property Value
    Type Description
    Int32

    Current step count.

    TotalStepCount

    Returns the total step count.

    Declaration
    public int TotalStepCount { get; }
    Property Value
    Type Description
    Int32

    Total step count.

    Methods

    Dispose()

    Shut down the Academy.

    Declaration
    public void Dispose()
    Implements
    IDisposable.Dispose()

    EnvironmentStep()

    Performs a single environment update of the Academy and Agent objects within the environment.

    Declaration
    public void EnvironmentStep()

    Events

    AgentPreStep

    Signals to all of the Agents that their step is about to begin. This is a good time for an Agent to decide if it would like to call RequestDecision() or RequestAction() for this step. Any other pre-step setup could be done during this event as well.

    Declaration
    public event Action<int> AgentPreStep
    Event Type
    Type Description
    Action<Int32>

    OnEnvironmentReset

    Signals that the Academy has been reset by the training process.

    Declaration
    public event Action OnEnvironmentReset
    Event Type
    Type Description
    Action
    In This Article
    • Constructors
      • Academy()
    • Properties
      • AutomaticSteppingEnabled
      • EnvironmentParameters
      • EpisodeCount
      • InferenceSeed
      • Instance
      • IsCommunicatorOn
      • IsInitialized
      • NumAreas
      • StatsRecorder
      • StepCount
      • TotalStepCount
    • Methods
      • Dispose()
      • EnvironmentStep()
    • Events
      • AgentPreStep
      • OnEnvironmentReset
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023