Class Academy
The Academy singleton manages agent training and decision making.
Implements
Inherited Members
Namespace: Unity.MLAgents
Assembly: Unity.ML-Agents.dll
Syntax
[HelpURL("https://github.com/Unity-Technologies/ml-agents/tree/release_22_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 Behavior
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 |
---|---|
bool | Set |
EnvironmentParameters
Returns the Environment
Declaration
public EnvironmentParameters EnvironmentParameters { get; }
Property Value
Type | Description |
---|---|
Environment |
The |
EpisodeCount
The current episode count.
Declaration
public int EpisodeCount { get; }
Property Value
Type | Description |
---|---|
int | 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 |
---|---|
int |
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 |
---|---|
bool |
|
See Also
IsInitialized
Reports whether the Academy has been initialized yet.
Declaration
public static bool IsInitialized { get; }
Property Value
Type | Description |
---|---|
bool |
|
NumAreas
Number of training areas to instantiate.
Declaration
public int NumAreas { get; }
Property Value
Type | Description |
---|---|
int |
StatsRecorder
Returns the Stats
Declaration
public StatsRecorder StatsRecorder { get; }
Property Value
Type | Description |
---|---|
Stats |
StepCount
The current step count (within the current episode).
Declaration
public int StepCount { get; }
Property Value
Type | Description |
---|---|
int |
TotalStepCount
Returns the total step count.
Declaration
public int TotalStepCount { get; }
Property Value
Type | Description |
---|---|
int |
Methods
Dispose()
Shut down the Academy.
Declaration
public void 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 Request
Declaration
public event Action<int> AgentPreStep
Event Type
OnEnvironmentReset
Signals that the Academy has been reset by the training process.
Declaration
public event Action OnEnvironmentReset
Event Type
Type | Description |
---|---|
Action |