Refactoring mesa.space
- Dominant language
- Python
- Stars
- 42
- Forks
- 18
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
## Roadmap
- [x] #39
- [x] #40
- [x] #41
- [x] #34
- [x] #35
- [ ] #36
- [ ] #37
- [ ] #38
- [ ] #47
## Class Structure and Design
### SpaceDF
- Base class for all spaces
- Defines a common interface for all spaces
- Stores agent positions in the `_agents` attribute in a DataFrame/GeoDataFrame. This approach avoids many missing values in the AgentSetDF and reduces confusion when multiple spaces of the same type are present (e.g., an agent in both a grid and in a social network)
- TODO: Implement a `pos` property for AgentContainer that performs an instant join with the space `_agents` DataFrame
### MultiSpaceDF
- Stores the collection of spaces in a model, similar to AgentsDF
### DiscreteSpaceDF
- Defines an interface for GridDF and NetworkDF
- Supports setting cell properties at both class level (setting an attribute of the class) and cell level (using the `set_cells` method)
- In addition to `_agents` stores cell properties in the `_cells` attribute in a DataFrame. The `_cells` DataFrame explicitly stores only cells that have agents or have specific properties different from the class level
### ContinousSpaceDF
- Stores agents in a GeoDataFrame (only geopandas in the future)
- Bridges mesa and mesa-geo
- All agents are geoagents and shapely objects
- Can be used as a continuous space in mesa without setting CRS, or as a geospace in mesa-geo by setting CRS
### GridDF
- Implemented in both GridPolars and GridPandas versions
- Supports multiple dimensions
- The '_empty_grid' attribute stores the remaining capacity of the grid.
### GeoGridDF
- Position in the class hierarchy still to be determined
- Is it possible to create a unique class or attempt to merge with GridDF? Probably not possible to merge as GridDF supports multiple dimensions, while shapely objects are limited to 2 dimensions.
Contributor guide
Assessment
This issue has not been assessed yet.