BaseRLProtocol
Full path:
schola.core.protocols.base.BaseRLProtocol
schola.core.protocols.base.BaseRLProtocol
BaseRLProtocol
BaseRLProtocolBases: BaseProtocol
Base class for reinforcement learning protocols.
This class extends BaseProtocol with methods specific to RL environments, including reset, step, and action messaging.
Methods
| Item | Description |
|---|---|
__init__() | — |
close() | Close the protocol connection. |
| get_definition | Get the environment definition from Unreal Engine. |
| send_action_msg | Send actions to the environment and receive the next state. |
| send_reset_msg | Send a reset message to restart the environment. |
| send_startup_msg | Send the startup message with auto-reset configuration. |
start() | Start the protocol connection. |
Attributes
| Item | Description |
|---|---|
properties | Get protocol-specific properties. |
get_definition
get_definition()Get the environment definition from Unreal Engine.
Returns
A tuple containing:
- List of agent IDs per environment
- List of agent groups per environment (used for grouping agents)
- Observation spaces for each environment and agent
- Action spaces for each environment and agent
Return type: Tuple[List[List[str]], List[Dict[int, str]], Dict[int, Dict[str, gym.Space]], Dict[int, Dict[str, gym.Space]]]
send_action_msg
send_action_msg(actions, action_space)Send actions to the environment and receive the next state.
Parameters
actions (Dict[int, Dict[str, Any]])
: Actions to take, indexed by environment ID and agent ID.
action_space (Dict[str, gym.Space])
: The action spaces used to serialize the actions.
Returns
A tuple containing:
- Observations for each environment
- Rewards for each environment
- Termination flags for each environment
- Truncation flags for each environment
- Info dicts for each environment
- Initial observations if auto-reset occurred
- Initial info dicts if auto-reset occurred
Return type: Tuple[List[Dict[str,Any]], List[float], List[Dict[str,bool]], List[Dict[str,bool]], List[Dict[str,str]], Dict[int,Dict[str, Any]], Dict[int,Dict[str, str]]]
send_reset_msg
send_reset_msg(seeds=None, options=None)Send a reset message to restart the environment.
Parameters
seeds (List, optional)
: List of random seeds for each environment.
options (List, optional)
: List of reset options for each environment.
Returns
A tuple containing:
- List of initial observations for each environment
- List of initial info dicts for each environment
Return type: Tuple[List[Dict[str, Any]], List[Dict[str, Dict[str,str]]]]
send_startup_msg
send_startup_msg(auto_reset_type=AutoResetType.SAME_STEP)Send the startup message with auto-reset configuration.
Parameters
auto_reset_type (AutoResetType, default=AutoResetType.SAME_STEP)
: The type of auto-reset behavior to use when episodes end.