-
-
Notifications
You must be signed in to change notification settings - Fork 238
Description
Hi everyone,
While exploring the mesa-examples repository and experimenting with Mesa’s newer APIs, I noticed that some spatial models represent environment state using stationary patch agents. For example, in the forest fire model, each grid cell is represented by a TreeCell agent whose main purpose is just to store the cell’s state (Fine, Burning, Burned).
Since Mesa now provides PropertyLayer for storing grid-based properties, I was wondering if some of these cases could be simplified by moving environment state to a property layer attached to the grid rather than creating thousands of patch agents.
For example, instead of something like:
class TreeCell(Agent):
def __init__(self, model, pos):
super().__init__(model)
self.condition = "Fine"
the model could store this information directly on the grid using a PropertyLayer, e.g.:
fire_state = PropertyLayer(...)
with something like:
fire_state[x, y] = 0 # fine
fire_state[x, y] = 1 # burning
fire_state[x, y] = 2 # burned
The simulation step would then update the grid state directly instead of modifying agent attributes.
The idea would be to apply this only in examples where patch agents are acting purely as containers for environment state, not where they represent actual acting entities.
Some potential steps could be:
-
Identify examples where patch agents are used mainly for environment variables (e.g., forest fire–type models).
-
Replace those patch agents with one or more PropertyLayers attached to the grid.
-
Update the model step logic to read/write from the property layer instead of agent attributes.
-
Ensure the simulation behavior remains the same as the original example.
The motivation is mainly to:
-
align examples with newer Mesa patterns (especially as the project moves toward Mesa 4),
-
reduce unnecessary object overhead when cells are just storing simple state,
-
and show new users how PropertyLayer can be used for environment data.
Before trying to work on something like this, @jackiekazil @EwoutH I wanted to check:
-
whether this direction makes sense for the examples repository,
-
and if there are particular models where this approach would be recommended or discouraged.