pymasep.engine.engine
Classes
Sub application that manages the main environment |
Module Contents
- class pymasep.engine.engine.Engine(app, received_q_id, cfg, max_connection=-1)
Bases:
pymasep.application.SubAppSub application that manages the main environment
- Parameters:
app – main application
received_q_id (int) – id of the queue used by the engine to receive messages.
cfg (omegaconf.DictConfig) – configuration of the engine
max_connection (int) – max number of TCP connection to the engine. -1 means no possible remote communication.
- environment
environment engine
- old_step = None
keep last step of the environment. TODO Maybe deprecated
- end_game = False
is the game is finished? (all episodes)
- env_logger
logger of the environment of the engine
- eps
Expected engine loop per second
- set_engine_for_external_controller()
set the engine of all external controllers during registering
- Return type:
None
- define()
Wait for the “Define” message and initialize the engine according to message parameters (game, …)
- Return type:
None
- register(msg_register)
Register an interface to the engine. For role “ACTOR”, create the external agent, and configure its external controller
- Parameters:
msg_register – Message containing all interface parameters (id, role)
- Return type:
None
- render()
Render the engine, i.e., get all observations and send them to the interfaces in the case of an interface with the observer role, the observation is exactly the current state
- Warning: this method may modify the current state of the environment (the belief part).
I.e., assert current_state_before_render ==/!== current_state_after_render.
- Return type:
None
- handle_event()
Handle received event. Wait for QUIT, ACTION or REGISTER
- Return type:
None
- update()
Update the engine. Mainly the environment
- Return type:
None
- init(id_episode=0)
Init an episode of the environment
- Parameters:
id_episode – ID of the episode to initialize
- Return type:
None
- clean()
Clean the engine, mainly the environment
- Return type:
None
- run()
Main loop of the application.
- Return type:
None