Skip to content

Refactoring mesa.space #6

Open
Open
@adamamer20

Description

@adamamer20

Roadmap

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.

Metadata

Metadata

Assignees

Labels

enhancementImprovements to existing features or performance.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions