Class Academy
The Academy singleton manages agent training and decision making.
Implements
Inherited Members
Namespace: Unity.MLAgents
Assembly: solution.dll
Syntax
[HelpURL("https://github.com/Unity-Technologies/ml-agents/tree/release_21_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
| Name | Description |
|---|---|
| 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. |
Properties
| Name | Description |
|---|---|
| AutomaticSteppingEnabled | Determines whether or not the Academy is automatically stepped during the FixedUpdate phase. |
| 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. |
| EpisodeCount | The current episode count. |
| 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. |
| Instance | The singleton Academy object. |
| IsCommunicatorOn | Reports whether or not the communicator is on. |
| IsInitialized | Reports whether the Academy has been initialized yet. |
| NumAreas | Number of training areas to instantiate. |
| StatsRecorder | Returns the StatsRecorder instance. This instance can be used to record any statistics from the Unity environment. |
| StepCount | The current step count (within the current episode). |
| TotalStepCount | Returns the total step count. |
Methods
| Name | Description |
|---|---|
| Dispose() | Shut down the Academy. |
| EnvironmentStep() | Performs a single environment update of the Academy and Agent objects within the environment. |
Events
| Name | Description |
|---|---|
| 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. |
| OnEnvironmentReset | Signals that the Academy has been reset by the training process. |