Agent

class Melodie.Agent(agent_id: int)

Bases: Element

setup()

This is the initialization method where agent properties can be declared.

“Declaration” means defining properties with initial values, such as 0, 0.0, or “”. For example:

class NewAgent(Agent)
    def setup(self):
        self.int_property = 0
        self.float_property = 0.0
        self.str_property = ""

While it is possible to define properties with complex data structures like dicts, lists, or sets, their values can be difficult for the DataCollector to record automatically.

This method is executed automatically at the end of the agent’s __init__ method.

Returns:

None