embrs.base_classes.agent_base#

Module containing base class for agents

class embrs.base_classes.agent_base.AgentBase(id: any, x: float, y: float, label: str = None, marker: str = '*', color: str = 'magenta')#

Base class for agents in user code.

Agent objects must be an instance of this class in order to be registered with the sim and displayed in visualizations.

Parameters:
  • id (any) – unique identifier of the agent

  • x_m (float) – x position in meters of the agent within the sim.

  • y_m (float) – y position in meters of the agent within the sim.

  • label (str, optional) – label added to the agent when it is displayed, if None no label will be added, defaults to None.

  • marker (str, optional) – marker used to represent the agent when displayed, any matplotlib.markers can be used, defaults to ‘*’.

  • color (str, optional) – color used to represent the agent when displayed, any matplotlib.colors can be used, defaults to ‘magenta’.

to_log_format() dict#

Returns the agent in a format that the logger can store

Returns:

dictionary with the following fields:

  • ”id”: unique identifier of the agent

  • ”x_m”: x position in meters of the agent within the sim.

  • ”y_m”: y position in meters of the agent within the sim.

  • ”marker”: marker used to represent the agent when displayed.

  • ”color”: color used to represent the agent when displayed.

Return type:

dict

Classes

AgentBase(id, x, y[, label, marker, color])

Base class for agents in user code.