You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi everyone! We've just released a significant update to Mesa's continuous space functionality. This reimplementation introduces an agent-centric API, n-dimensional space support, and various performance improvements. We'd love to hear your feedback, experiences, and suggestions.
Key Changes
The new implementation features:
An agent-centric API similar to cell spaces (e.g., agent.position property)
Direct vector arithmetic for movement (agent.position += [0.1, 0.1])
Efficient neighbor calculations using optimized distance computations
Support for n-dimensional spaces
Better memory management with dynamic array resizing
Here's an overview of the new interface:
# Create a 2D continuous spacespace=ContinuousSpace(
dimensions=[[0, 1], [0, 1]],
torus=True,
random=model.random
)
# Create and position an agentagent=ContinuousSpaceAgent(space, model)
agent.position= [0.5, 0.5]
# Move agent using vector arithmeticagent.position+= [0.1, 0.1]
# Get neighbors within radiusneighbors, distances=agent.get_neighbors_in_radius(radius=0.2)
# Find k nearest neighborsnearest, distances=agent.get_nearest_neighbors(k=5)
And if you want to migrate an existing model, here's a quick before/after comparison:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi everyone! We've just released a significant update to Mesa's continuous space functionality. This reimplementation introduces an agent-centric API, n-dimensional space support, and various performance improvements. We'd love to hear your feedback, experiences, and suggestions.
Key Changes
The new implementation features:
agent.position
property)agent.position += [0.1, 0.1]
)Here's an overview of the new interface:
And if you want to migrate an existing model, here's a quick before/after comparison:
For more details, see:
Discussion Points
We're particularly interested in hearing about:
Please share your thoughts, questions, and any issues you encounter!
Beta Was this translation helpful? Give feedback.
All reactions