matrx.logger.log_agent_actions
¶
Module Contents¶
-
class
LogActions
(save_path='', file_name_prefix='', file_extension='.csv', delimeter=';')¶ Bases:
matrx.logger.logger.GridWorldLogger
Logs per agent the action performed per tick
-
LOG_ON_LAST_TICK
= log_last_tick¶ Log strategy to log on the first tick of a world.
-
LOG_ON_FIRST_TICK
= log_first_tick¶ Log strategy to log every time a goal is reached or completed.
-
log
(self, grid_world, agent_data)¶ The main method to be overwritten by your own logger class.
This method is called according to the log_strategy set when the logger was added the world builder. For more details on this see
matrx.world_builder.WorldBuilder.add_logger()
.- Parameters
- grid_worldGridWorld
The entire grid world instance. Use this to log anything you require to log from the grid world.
- agent_datadict
A dictionary of all data coming from all agents’
matrx.agents.agent_brain.get_log_data()
methods. This dictionary has as keys the agent ids of all agents. As value there is the dictionary their log methods returned.- Returns
- ——-
- dict
This method should return a dictionary where the keys are the columns and their value a single row. The keys (e.g., columns) should be always the same every consecutive call. If this is not the case an exception is raised.
-
property
file_name
(self)¶ Make the logger filename publicly available
-
-
class
LogActionsV2
(save_path='', file_name_prefix='', file_extension='.csv', delimeter=';')¶ Bases:
matrx.logger.logger.GridWorldLoggerV2
Logs per agent the action performed per tick
-
LOG_ON_LAST_TICK
= log_last_tick¶ Log strategy to log on the first tick of a world.
-
LOG_ON_FIRST_TICK
= log_first_tick¶ Log strategy to log every time a goal is reached or completed.
-
log
(self, world_state, agent_data, grid_world)¶ The main method to be overwritten by your own logger class.
This method is called according to the log_strategy set when the logger was added the world builder. For more details on this see
matrx.world_builder.WorldBuilder.add_logger()
.- Parameters
- world_stateState
The entire world state as a State object. Use this to quickly find and locate data you want to log.
- agent_datadict
A dictionary of all data coming from all agents’
matrx.agents.agent_brain.get_log_data()
methods. This dictionary has as keys the agent ids of all agents. As value there is the dictionary their log methods returned.- grid_worldGridWorld
The entire grid world instance. Use this to log anything not included into the state, such as the messages send between agents.
- Returns
- ——-
- dict
This method should return a dictionary where the keys are the columns and their value a single row. The keys (e.g., columns) should be always the same every consecutive call. If this is not the case an exception is raised.
-
property
file_name
(self)¶ The file name the loggers writes data to.
-