Base Classes

class Agent(unique_id: int, model: Model)[source]

Base class for a model agent.

Create a new agent.


unique_id (int): A unique numeric identified for the agent model: (Model): Instance of the model that contains the agent

step() None[source]

A single step of the agent.

class Model(*args: Any, **kwargs: Any)[source]

Base class for models.

Create a new model. Overload this method with the actual code to start the model.


schedule: schedule object running: a bool indicating if the model should continue running

run_model() None[source]

Run the model until the end condition is reached. Overload as needed.

step() None[source]

A single step. Fill in here.

next_id() int[source]

Return the next unique ID for agents, increment current_id

reset_randomizer(seed: int | None = None) None[source]

Reset the model random number generator.


seed: A new seed for the RNG; if None, reset using the current seed