Replies: 3 comments 4 replies
-
SGTM. Numpy arrays are rather slow for small grid size, but having an N-dimensional grid implementation, albeit slow, is better than none. You can check how Agents.jl does it, if they have some perf optimization. |
Beta Was this translation helpful? Give feedback.
-
I have another idea how we could create an n-dimensional grid, I will write down that idea in this thread next week :) But we should also consider how common and/or useful n dimensional grids really are. |
Beta Was this translation helpful? Give feedback.
-
@rht An additional argument for higher dimensional spaces can be that some of the dimensions do not necessarily have to be spatial; they can be "ranks". or "power levels". Something that would still make sense to search for "neighbors" in. E.g., get agents that are not only near you, but also in a similar "power level". This could be done with only a 2D grid, and then filtering based on a "power" agent property. But it can also be done in 3D space where the 3rd dimension is "power". Example: https://juliadynamics.github.io/AgentsExampleZoo.jl/dev/examples/battle/ (unfortunately the example is broken because I haven't managed to update it yet to newer Agents.jl version, but I hope the model description will give you the rough idea) Note that in AGents.jl there is a clear performance benefit in doing this in a 3D space rather than filtering. We can dispatch the search function so that if radious is a tuple (r1, r2, r3), a different search range is used across dimensions. This way we avoid filtering alltogether. I am not sure how one would implement this in Mesa. |
Beta Was this translation helpful? Give feedback.
-
I have seen many proposals in PRs to extend the Grid so that it can tackle more than 2 dimensions, I think that trying to do it with Numpy should be rather doable, I can work on it if others think it's a good idea, as a start making it as a separate class from the 2d-case could be rather safe in terms of compatibility, what do you guys think about it?
Beta Was this translation helpful? Give feedback.
All reactions