-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples: Adding Sugarscape IG - polars with numba vectorized loop (#91)
* adding numba to project.toml * splitting agent_type * splitting antpolars and antpolarsloop * adding py-spy to dev tools * splitting between numba, loop with DF and loop non vectorized implementations * performance comparison between loop and numba * fix: cuda target, not gpu * adding polars comparison * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * correcting dtypes * adding writable_args (see https://numba.readthedocs.io/en/stable/user/vectorize.html#overwriting-input-values) * processed_agents is of type bool * fix: occupied cells sorted by agent_order, assertion to verify best moves aren't duplicated * adding fixed initial positions (to assert equality between simulations) * adding complete reproducibility via seed * fix: taking into account potential (max) sugar when creating the neighborhood. For both numba and completely vectorized it's easier to reason this way then update the current sugar and "best moves" ranking when agents move * fix: considering priority (if there are previous order agents that might make the same move and haven't found the optimal move yet). This avoids race conditions. * fix: formatting * clarifying with comments * updating actual sugar before executing the step (NOTE: might be unncessary since we prepare the neighborhood looking at potential/max sugar anyway) * whitespace fixes * adding initial_positions and seed to mesa model * renaming grid to space for mesa_models * fix: best_moves only uses neighborhood and not agent_order * adding documentation and type hints * fix: logic for the priority condition (right order of parentheses) * removing assertion (testing purposes only) * adding equality_check on model state * changing n_range to reflect million of agents * fix: changing callable to typing.Callable * removing extra requirement * removing flame_graph (it was just a one-off, we can add memory-profiling in the future) * fix: comparing DFs * removing outdated picture * adding mesa_comparison.png * adding polars_cocmparison.png * updating kernels for comparison --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
04714fa
commit 1d7b3ed
Showing
11 changed files
with
521 additions
and
86 deletions.
There are no files selected for viewing
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
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
Oops, something went wrong.