Agent
Agent and Environment are all defined in Melodie.boost for better performance, and you may find it will only jump to a .pyi file if you are trying to jump into the code. If you would like to view the source code, please visit our git repository. The path to related files are listed below:
Stub File: Melodie/boost/basics.pyi
Source Code: Melodie/boost/basics.pyx
Cython Interface: Melodie/boost/basics.pxd
Just include class Agent inside doc and undoc the Agent.id and Agent.model
- class Melodie.Agent(agent_id: int)
- id
The id of
Agent
, a integer value>=0
- scenario
Current scenario object, of type
Melodie.Scenario
.
- model
The model that this agent belongs to.
- setup()
This is the initialization method, declare properties here. Here, “Declare” is to define properties with zero as initial value, such as: ```python class NewAgent(Agent)
- def setup(self):
self.int_property = 0 self.float_property = 0.0 self.str_property = “”
``` It is also fine to define properties with complex data structure such as dict/list/set, but the values in the complex data structure is hard to be recorded by the DataCollector This method is executed at the end of the __init__ method of the corresponding agent container. :return: