-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Abstract space and grid implementation #28
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for more information, see https://pre-commit.ci
…frames into 6-refactoring-mesaspace
for more information, see https://pre-commit.ci
…frames into 6-refactoring-mesaspace
9 tasks
adamamer20
added
the
enhancement
Improvements to existing features or performance.
label
Jul 16, 2024
It's overkill to have all the features listed implemented in a single PR. Can we make it slightly smaller by implementing just enough for Boltzmann wealth model and Sugarscape CG? No continuous space and geo are necessary yet. |
You're right. Let me split up in different PRs. The rest of non-implemented features will become open issues.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Still a work in progress, not everything described below has been implemented yet.
For now, only the GridDF class is completely implemented into GridPolars and GridPandas. The implementation of GeoGridDF, Network, and ContinousSpaceDF will be addressed in their own separate PRs.
Still missing
Class Structure and Design
SpaceDF
_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)pos
property for AgentContainer that performs an instant join with the space_agents
DataFrameMultiSpaceDF
DiscreteSpaceDF
set_cells
method)_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 levelContinousSpaceDF
GridDF
GeoGridDF
Implementation Details for GridDF
Pandas Implementation
np.full
at the start to generate the empty grid, filling with int values corresponding to the specified capacityPolars Implementation
pl.arange
with lazy evaluationCommon Methods
get_neighbors
: Implemented on top ofget_neighborhood
instead ofget_distance
get_distance
might be faster for sparse spacesmove_to_empty
: Implementation delayed due to challenges in avoiding generation of entire grid coordinatesOpen Questions and Future Improvements
pos
property for AgentContainermove_to_empty
method.neighbors[pos]
or.neighbors[agents]
pos
andagents
can be sequences of integers