Remove PropertyLayer and HasPropertyLayers mixin #3340
Conversation
|
Performance benchmarks:
|
|
Hi @quaquel |
|
I'll try to take a look somewhere today. |
quaquel
left a comment
There was a problem hiding this comment.
I like the direction this is taking. I have some initial thoughts and comments.
Also, separate from this, I still want to add sugarscape to the benchmarks.
|
Performance benchmarks:
|
|
This PR is ready for review. During refactoring, I noticed that using |
|
I profiled the Sugarscape model comparing main against this PR and results are:
1000 steps in each Run with different rng |
|
On termites model from mesa-examples
1000 steps in each run with different rng |
|
Can you take a look at the pre-commit and fix the errors? |
|
In some methods/arguments naming, we were using |
| "> **NOTE:**\n", | ||
| "> This is not a tutorial on property layers themselves, but rather on their visualization. To explore the functionalities of property layers, please refer to this tutorial.\n", |
There was a problem hiding this comment.
I removed this Note because I couldn't find any tuorial link here.
|
I think this is good to go from my end. I have also opened a PR in mesa-examples for failing example mesa/mesa-examples#334 |
quaquel
left a comment
There was a problem hiding this comment.
This looks largely fine. One remaining API level question.
f3065c1 to
ec1cc65
Compare
Co-authored-by: Jan Kwakkel <[email protected]>
Refactor sugar and spice updates in step function for clarity.
This PR removes
PropertyLayerandHasPropertyLayersfrom discrete spacesReplaces
PropertyLayerwith raw NumPy arrays stored directly on the grid as_property_layers: dict[str, np.ndarray]. Property access on cells is handled via nativepropertyclosures attached to the dynamicGridCellclass.Changes:
create_property_layer(name, ...)- allocates and attaches a new arrayadd_property_layer(name, array)- attaches an existing arrayremove_property_layer(name)- removes array and cell accessorselect_cells()removed - use numpy directly onproperty_layersExample Usage