Mesa 3.0.0b2__tar.gz → 3.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of Mesa might be problematic. Click here for more details.
- {mesa-3.0.0b2 → mesa-3.0.1}/.gitignore +2 -1
- {mesa-3.0.0b2 → mesa-3.0.1}/.pre-commit-config.yaml +3 -3
- {mesa-3.0.0b2 → mesa-3.0.1}/HISTORY.md +196 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/PKG-INFO +6 -8
- {mesa-3.0.0b2 → mesa-3.0.1}/README.md +5 -5
- {mesa-3.0.0b2 → mesa-3.0.1}/benchmarks/configurations.py +1 -4
- {mesa-3.0.0b2 → mesa-3.0.1}/benchmarks/global_benchmark.py +8 -8
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/apis/experimental.md +10 -0
- mesa-3.0.1/docs/apis/visualization.md +47 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/best-practices.md +9 -5
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/conf.py +17 -8
- mesa-3.0.1/docs/examples_overview_template.txt +13 -0
- mesa-3.0.0b2/docs/overview.md → mesa-3.0.1/docs/getting_started.md +49 -16
- mesa-3.0.1/docs/images/wolf_sheep.png +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/index.md +12 -13
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/migration_guide.md +11 -7
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/tutorials/MoneyModel.py +4 -5
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/tutorials/intro_tutorial.ipynb +2 -4
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/tutorials/visualization_tutorial.ipynb +98 -67
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/__init__.py +1 -1
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/agent.py +15 -3
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/batchrunner.py +26 -1
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/README.md +11 -11
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/__init__.py +2 -2
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/epstein_civil_violence/agents.py +44 -38
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/epstein_civil_violence/app.py +29 -28
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/epstein_civil_violence/model.py +33 -65
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/pd_grid/app.py +9 -5
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/pd_grid/model.py +1 -1
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/sugarscape_g1mt/app.py +5 -13
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/sugarscape_g1mt/model.py +3 -1
- mesa-3.0.1/mesa/examples/advanced/wolf_sheep/agents.py +116 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/wolf_sheep/app.py +37 -19
- mesa-3.0.1/mesa/examples/advanced/wolf_sheep/model.py +131 -0
- mesa-3.0.1/mesa/examples/basic/boid_flockers/agents.py +102 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/boid_flockers/app.py +2 -2
- mesa-3.0.1/mesa/examples/basic/boid_flockers/model.py +105 -0
- mesa-3.0.1/mesa/examples/basic/boltzmann_wealth_model/agents.py +49 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/boltzmann_wealth_model/app.py +22 -13
- mesa-3.0.1/mesa/examples/basic/boltzmann_wealth_model/model.py +78 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/boltzmann_wealth_model/st_app.py +2 -2
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/conways_game_of_life/app.py +15 -3
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/schelling/agents.py +9 -5
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/schelling/app.py +5 -5
- mesa-3.0.1/mesa/examples/basic/schelling/model.py +81 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/virus_on_network/app.py +25 -47
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/experimental/cell_space/cell_collection.py +14 -2
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/experimental/cell_space/discrete_space.py +16 -2
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/experimental/devs/simulator.py +59 -14
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/model.py +4 -4
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/space.py +0 -30
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/time.py +4 -4
- mesa-3.0.1/mesa/visualization/__init__.py +26 -0
- mesa-3.0.1/mesa/visualization/components/__init__.py +83 -0
- mesa-3.0.0b2/mesa/visualization/components/altair.py → mesa-3.0.1/mesa/visualization/components/altair_components.py +34 -2
- mesa-3.0.1/mesa/visualization/components/matplotlib_components.py +175 -0
- mesa-3.0.1/mesa/visualization/mpl_space_drawing.py +593 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/visualization/solara_viz.py +156 -67
- {mesa-3.0.0b2 → mesa-3.0.1}/tests/test_cell_space.py +66 -33
- mesa-3.0.1/tests/test_components_matplotlib.py +237 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/tests/test_devs.py +42 -2
- {mesa-3.0.0b2 → mesa-3.0.1}/tests/test_examples.py +6 -5
- {mesa-3.0.0b2 → mesa-3.0.1}/tests/test_solara_viz.py +77 -12
- mesa-3.0.0b2/benchmarks/BoltzmannWealth/__init__.py +0 -1
- mesa-3.0.0b2/benchmarks/BoltzmannWealth/boltzmann_wealth.py +0 -112
- mesa-3.0.0b2/benchmarks/Flocking/__init__.py +0 -1
- mesa-3.0.0b2/benchmarks/Flocking/flocking.py +0 -156
- mesa-3.0.0b2/benchmarks/Schelling/__init__.py +0 -1
- mesa-3.0.0b2/benchmarks/Schelling/schelling.py +0 -113
- mesa-3.0.0b2/benchmarks/WolfSheep/__init__.py +0 -1
- mesa-3.0.0b2/benchmarks/WolfSheep/wolf_sheep.py +0 -231
- mesa-3.0.0b2/docs/apis/visualization.md +0 -21
- mesa-3.0.0b2/docs/examples.md +0 -14
- mesa-3.0.0b2/docs/examples_overview_template.txt +0 -10
- mesa-3.0.0b2/docs/howto.md +0 -122
- mesa-3.0.0b2/docs/images/wolf_scheep.png +0 -0
- mesa-3.0.0b2/docs/packages.md +0 -110
- mesa-3.0.0b2/mesa/examples/advanced/wolf_sheep/agents.py +0 -102
- mesa-3.0.0b2/mesa/examples/advanced/wolf_sheep/model.py +0 -137
- mesa-3.0.0b2/mesa/examples/basic/boid_flockers/agents.py +0 -71
- mesa-3.0.0b2/mesa/examples/basic/boid_flockers/model.py +0 -69
- mesa-3.0.0b2/mesa/examples/basic/boltzmann_wealth_model/agents.py +0 -31
- mesa-3.0.0b2/mesa/examples/basic/boltzmann_wealth_model/model.py +0 -43
- mesa-3.0.0b2/mesa/examples/basic/schelling/model.py +0 -59
- mesa-3.0.0b2/mesa/visualization/__init__.py +0 -15
- mesa-3.0.0b2/mesa/visualization/components/matplotlib.py +0 -386
- {mesa-3.0.0b2 → mesa-3.0.1}/.codespellignore +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/.coveragerc +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/.github/ISSUE_TEMPLATE/bug-report.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/.github/ISSUE_TEMPLATE/feature-request.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/.github/PULL_REQUEST_TEMPLATE/bug.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/.github/dependabot.yml +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/.github/pull_request_template.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/.github/release.yml +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/.github/workflows/benchmarks.yml +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/.github/workflows/build_lint.yml +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/.github/workflows/release.yml +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/.readthedocs.yml +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/CITATION.bib +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/CODE_OF_CONDUCT.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/CONTRIBUTING.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/Dockerfile +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/LICENSE +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/NOTICE +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/benchmarks/compare_timings.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/binder/environment.yml +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/codecov.yaml +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docker-compose.yml +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/Makefile +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/README.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/_static/switcher.json +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/apis/agent.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/apis/api_main.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/apis/batchrunner.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/apis/datacollection.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/apis/model.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/apis/space.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/apis/time.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/example_template.txt +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/images/mesa_logo.ico +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/images/mesa_logo.png +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/images/tutorial/br_ginis.png +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/images/tutorial/dc_endwealth.png +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/images/tutorial/dc_gini.png +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/images/tutorial/dc_oneagent.png +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/images/tutorial/first_hist.png +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/images/tutorial/multirun_hist.png +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/images/tutorial/numpy_grid.png +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/images/tutorial/viz_chart.png +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/images/tutorial/viz_empty.png +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/images/tutorial/viz_greycircles.png +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/images/tutorial/viz_histogram.png +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/images/tutorial/viz_redcircles.png +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/make.bat +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/mesa.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/tutorials/files/viz_chart.png +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/tutorials/files/viz_empty.png +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/tutorials/files/viz_greycircles.png +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/tutorials/files/viz_histogram.png +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/tutorials/files/viz_redcircles.png +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/docs/tutorials/files/viz_slider.png +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/maintenance/fetch_unlabeled_prs.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/datacollection.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/__init__.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/epstein_civil_violence/Epstein Civil Violence.ipynb +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/epstein_civil_violence/Readme.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/epstein_civil_violence/__init__.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/pd_grid/Readme.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/pd_grid/__init__.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/pd_grid/agents.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/pd_grid/analysis.ipynb +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/sugarscape_g1mt/Readme.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/sugarscape_g1mt/__init__.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/sugarscape_g1mt/agents.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/sugarscape_g1mt/sugar-map.txt +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/sugarscape_g1mt/tests.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/wolf_sheep/Readme.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/advanced/wolf_sheep/__init__.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/__init__.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/boid_flockers/Readme.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/boid_flockers/__init__.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/boltzmann_wealth_model/Readme.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/boltzmann_wealth_model/__init__.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/conways_game_of_life/Readme.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/conways_game_of_life/__init__.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/conways_game_of_life/agents.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/conways_game_of_life/model.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/conways_game_of_life/st_app.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/schelling/Readme.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/schelling/__init__.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/schelling/analysis.ipynb +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/virus_on_network/Readme.md +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/virus_on_network/__init__.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/virus_on_network/agents.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/examples/basic/virus_on_network/model.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/experimental/UserParam.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/experimental/__init__.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/experimental/cell_space/__init__.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/experimental/cell_space/cell.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/experimental/cell_space/cell_agent.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/experimental/cell_space/grid.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/experimental/cell_space/network.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/experimental/cell_space/voronoi.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/experimental/components/altair.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/experimental/components/matplotlib.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/experimental/devs/__init__.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/experimental/devs/eventlist.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/experimental/devs/examples/epstein_civil_violence.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/experimental/devs/examples/wolf_sheep.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/experimental/solara_viz.py +0 -0
- /mesa-3.0.0b2/mesa/visualization/UserParam.py → /mesa-3.0.1/mesa/visualization/user_param.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mesa/visualization/utils.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/mypy.ini +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/pyproject.toml +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/tests/__init__.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/tests/read_requirements.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/tests/test_agent.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/tests/test_batch_run.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/tests/test_datacollector.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/tests/test_end_to_end_viz.sh +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/tests/test_grid.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/tests/test_import_namespace.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/tests/test_lifespan.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/tests/test_model.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/tests/test_space.py +0 -0
- {mesa-3.0.0b2 → mesa-3.0.1}/tests/test_time.py +0 -0
|
@@ -4,7 +4,7 @@ ci:
|
|
|
4
4
|
repos:
|
|
5
5
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
6
6
|
# Ruff version.
|
|
7
|
-
rev: v0.
|
|
7
|
+
rev: v0.7.2
|
|
8
8
|
hooks:
|
|
9
9
|
# Run the linter.
|
|
10
10
|
- id: ruff
|
|
@@ -14,12 +14,12 @@ repos:
|
|
|
14
14
|
- id: ruff-format
|
|
15
15
|
types_or: [ python, pyi, jupyter ]
|
|
16
16
|
- repo: https://github.com/asottile/pyupgrade
|
|
17
|
-
rev: v3.
|
|
17
|
+
rev: v3.19.0
|
|
18
18
|
hooks:
|
|
19
19
|
- id: pyupgrade
|
|
20
20
|
args: [--py310-plus]
|
|
21
21
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
22
|
-
rev:
|
|
22
|
+
rev: v5.0.0 # Use the ref you want to point at
|
|
23
23
|
hooks:
|
|
24
24
|
- id: trailing-whitespace
|
|
25
25
|
- id: check-toml
|
|
@@ -1,6 +1,202 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Release History
|
|
3
3
|
---
|
|
4
|
+
# 3.0.1 (2024-11-11)
|
|
5
|
+
## Highlights
|
|
6
|
+
After our huge [3.0.0 release](https://github.com/projectmesa/mesa/releases/tag/v3.0.0), Mesa 3.0.1 follows up with two improvements to experimental features, examples and docs.
|
|
7
|
+
|
|
8
|
+
## What's Changed
|
|
9
|
+
### 🧪 Experimental features
|
|
10
|
+
* Bugfixes to DEVS by @quaquel in https://github.com/projectmesa/mesa/pull/2478
|
|
11
|
+
* Support simulators in SolaraViz by @quaquel in https://github.com/projectmesa/mesa/pull/2470
|
|
12
|
+
### 🛠 Enhancements made
|
|
13
|
+
* issue a user warning if random is None by @quaquel in https://github.com/projectmesa/mesa/pull/2479
|
|
14
|
+
### 🔍 Examples updated
|
|
15
|
+
* Integrate benchmarks and example models by @EwoutH in https://github.com/projectmesa/mesa/pull/2473
|
|
16
|
+
### 📜 Documentation improvements
|
|
17
|
+
* docs/tutorial: Replace scheduler in MoneyModel by @EwoutH in https://github.com/projectmesa/mesa/pull/2475
|
|
18
|
+
* docs: update migration_guide.md by @eltociear in https://github.com/projectmesa/mesa/pull/2480
|
|
19
|
+
* Update some DeprecationWarnings to note they are removed in Mesa 3.1 by @EwoutH in https://github.com/projectmesa/mesa/pull/2481
|
|
20
|
+
|
|
21
|
+
## New Contributors
|
|
22
|
+
* @eltociear made their first contribution in https://github.com/projectmesa/mesa/pull/2480
|
|
23
|
+
|
|
24
|
+
**Full Changelog**: https://github.com/projectmesa/mesa/compare/v3.0.0...v3.0.1
|
|
25
|
+
|
|
26
|
+
# 3.0.0 (2024-11-09)
|
|
27
|
+
## Highlights
|
|
28
|
+
Mesa 3.0 brings major improvements to agent-based modeling, making it more intuitive and powerful while reducing complexity. This release modernizes core functionalities and introduces new capabilities for both beginners and advanced users.
|
|
29
|
+
|
|
30
|
+
### Streamlined agent management
|
|
31
|
+
The centerpiece of Mesa 3.0 is its new agent management system. Agents are now automatically tracked and assigned unique IDs, eliminating common boilerplate code. The new AgentSet functionality provides an elegant and flexible way to work with agents, for example:
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
# Find agents meeting specific criteria
|
|
35
|
+
wealthy_agents = model.agents.select(lambda a: a.wealth > 1000)
|
|
36
|
+
|
|
37
|
+
# Group and analyze agents
|
|
38
|
+
grouped = model.agents.groupby("state")
|
|
39
|
+
state_stats = grouped.agg({
|
|
40
|
+
"count": len,
|
|
41
|
+
"avg_age": ("age", np.mean),
|
|
42
|
+
"total_wealth": ("wealth", sum)
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
# Activate agents in different patterns
|
|
46
|
+
model.agents.shuffle_do("step") # Random activation
|
|
47
|
+
model.agents.select(lambda a: a.energy > 0).do("move") # Conditional activation
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The AgentSet provides powerful methods for filtering, grouping, and analyzing agents, making it easier to express complex model logic. Each model automatically maintains an AgentSet containing all agents (`model.agents`) and separate AgentSets for each agent type (`model.agents_by_type`). See the full [AgentSet docs](https://mesa.readthedocs.io/latest/apis/agent.html#mesa.agent.AgentSet) here.
|
|
51
|
+
|
|
52
|
+
### Modern Visualization with SolaraViz
|
|
53
|
+
Mesa 3.0's new experimental visualization system, SolaraViz, provides a modern, interactive interface for model exploration:
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from mesa.visualization import SolaraViz, make_space_component, make_plot_component
|
|
57
|
+
|
|
58
|
+
visualization = SolaraViz(
|
|
59
|
+
model,
|
|
60
|
+
[
|
|
61
|
+
make_space_component(agent_portrayal),
|
|
62
|
+
make_plot_component(["population", "average_wealth"]),
|
|
63
|
+
lambda m: f"Step {m.steps}: {len(m.agents)} agents" # Custom text component
|
|
64
|
+
],
|
|
65
|
+
model_params=parameter_controls
|
|
66
|
+
)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Key visualization features:
|
|
70
|
+
- Interactive browser-based interface with real-time updates
|
|
71
|
+
- Support for both grid-based and network models
|
|
72
|
+
- Visualization of PropertyLayers and hexagonal grids
|
|
73
|
+
- Custom components using Matplotlib or text
|
|
74
|
+
- Improved performance and responsiveness
|
|
75
|
+
|
|
76
|
+
Check out the [Visualization Tutorial](https://mesa.readthedocs.io/latest/tutorials/visualization_tutorial.html) to get started.
|
|
77
|
+
|
|
78
|
+
*Note: SolaraViz is in active development. We might make API breaking changes between Mesa 3.0 and 3.1.*
|
|
79
|
+
|
|
80
|
+
### Enhanced data collection
|
|
81
|
+
The DataCollector now supports collecting different metrics for different agent types, using `agenttype_reporters`:
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
self.datacollector = DataCollector(
|
|
85
|
+
model_reporters={"total_wealth": lambda m: m.agents.agg("wealth", sum)},
|
|
86
|
+
agent_reporters={"age": "age", "wealth": "wealth"},
|
|
87
|
+
agenttype_reporters={
|
|
88
|
+
Predator: {"kills": "kills_count"},
|
|
89
|
+
Prey: {"distance_fled": "total_flight_distance"}
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Experimental features
|
|
95
|
+
Mesa 3.0 introduces several experimental features for advanced modeling:
|
|
96
|
+
- [Cell Space](https://mesa.readthedocs.io/latest/apis/experimental.html#module-experimental.cell_space.cell) with integrated PropertyLayers and improved agent movement capabilities
|
|
97
|
+
- Voronoi grid implementation
|
|
98
|
+
- [Event-scheduling simulation](https://mesa.readthedocs.io/latest/apis/experimental.html#module-experimental.devs.eventlist) capabilities
|
|
99
|
+
|
|
100
|
+
These experimental features are in active development and might break API between releases.
|
|
101
|
+
|
|
102
|
+
## Breaking changes
|
|
103
|
+
_See our [Mesa 3.0 migration guide](https://mesa.readthedocs.io/latest/migration_guide.html#mesa-3-0) for a full overview._
|
|
104
|
+
|
|
105
|
+
If you want to move existing models from Mesa 2.x to 3.0, there are a few things you have to change.
|
|
106
|
+
|
|
107
|
+
1. Models must explicitly initialize the Mesa base class:
|
|
108
|
+
```python
|
|
109
|
+
class MyModel(mesa.Model):
|
|
110
|
+
def __init__(self, n_agents, seed=None):
|
|
111
|
+
super().__init__(seed=seed) # Required in Mesa 3.0
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
2. Agents are created without manual ID assignment:
|
|
115
|
+
```python
|
|
116
|
+
# Old
|
|
117
|
+
agent = MyAgent(unique_id=1, model=self)
|
|
118
|
+
# New
|
|
119
|
+
agent = MyAgent(model=self)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
3. Scheduler replacement with AgentSet operations:
|
|
123
|
+
```python
|
|
124
|
+
# Old (RandomActivation)
|
|
125
|
+
self.schedule = RandomActivation(self)
|
|
126
|
+
self.schedule.step()
|
|
127
|
+
|
|
128
|
+
# New
|
|
129
|
+
self.agents.shuffle_do("step")
|
|
130
|
+
|
|
131
|
+
# Old (SimultaneousActivation)
|
|
132
|
+
self.schedule = SimultaneousActivation(self)
|
|
133
|
+
self.schedule.step()
|
|
134
|
+
|
|
135
|
+
# New
|
|
136
|
+
self.agents.do("step")
|
|
137
|
+
self.agents.do("advance")
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Furthermore:
|
|
141
|
+
- Steps counter automatically increments
|
|
142
|
+
- `mesa.flat` namespace removed
|
|
143
|
+
- Python 3.10+ required
|
|
144
|
+
- Reserved model variables (`agents`, `steps`, etc.) protected
|
|
145
|
+
- Simplified DataCollector initialization
|
|
146
|
+
- Old visualization system replaced by SolaraViz
|
|
147
|
+
|
|
148
|
+
## Getting Started
|
|
149
|
+
Install Mesa 3.0:
|
|
150
|
+
```bash
|
|
151
|
+
pip install --upgrade mesa
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
If building a new model, we recommend checking out the updated [Mesa Overview](https://mesa.readthedocs.io/latest/overview.html) and [Introductory Tutorial](https://mesa.readthedocs.io/latest/tutorials/intro_tutorial.html).
|
|
155
|
+
|
|
156
|
+
For updating existing models, we recommend upgrading in steps:
|
|
157
|
+
1. Update to latest Mesa 2.x
|
|
158
|
+
2. Address deprecation warnings
|
|
159
|
+
3. Upgrade to Mesa 3.0
|
|
160
|
+
4. Replace schedulers with AgentSet functionality
|
|
161
|
+
|
|
162
|
+
A detailed [migration guide](https://mesa.readthedocs.io/latest/migration_guide.html#mesa-3-0) is available to help moving to Mesa 3.0. For questions or support, join our [GitHub Discussions](https://github.com/projectmesa/mesa/discussions) or [Matrix Chat](https://matrix.to/#/#project-mesa:matrix.org).
|
|
163
|
+
|
|
164
|
+
We would love to hear what you think about Mesa 3.0! [Say hello here](https://github.com/projectmesa/mesa/discussions/2465) and leave any [feedback on 3.0 here](https://github.com/projectmesa/mesa/discussions/2338).
|
|
165
|
+
|
|
166
|
+
# 3.0.0rc0 (2024-11-06)
|
|
167
|
+
## Highlights
|
|
168
|
+
We're releasing the Mesa 3.0 Release Candidate, ready for final testing before we release Mesa 3.0 later this week!
|
|
169
|
+
|
|
170
|
+
In this last 3.0 pre-release, the visualisation has been thoroughly updated, with a brand new API. Visualizing the experimental Cell Space, including PropertyLayers and hexogonal grids, is now also supported.
|
|
171
|
+
|
|
172
|
+
We're still working very active on the visualisation, so we have marked that experimental for Mesa 3.0. We will stabilize SolaraViz in Mesa 3.1.
|
|
173
|
+
|
|
174
|
+
Any feedback and last-minute bug reports are welcome [here](https://github.com/projectmesa/mesa/discussions/2338).
|
|
175
|
+
|
|
176
|
+
## What's Changed
|
|
177
|
+
### ⚠️ Breaking changes
|
|
178
|
+
* Viz: Refactor Matplotlib plotting by @quaquel in https://github.com/projectmesa/mesa/pull/2430
|
|
179
|
+
* api reorganization by @quaquel in https://github.com/projectmesa/mesa/pull/2447
|
|
180
|
+
### 🧪 Experimental features
|
|
181
|
+
* Mark SolaraViz as experimental for Mesa 3.0 by @EwoutH in https://github.com/projectmesa/mesa/pull/2459
|
|
182
|
+
### 🛠 Enhancements made
|
|
183
|
+
* expand ax.scatter kwargs that can be used by @quaquel in https://github.com/projectmesa/mesa/pull/2445
|
|
184
|
+
### 🐛 Bugs fixed
|
|
185
|
+
* Fix #2452 - handle solara viz model params better by @Corvince in https://github.com/projectmesa/mesa/pull/2454
|
|
186
|
+
* Update MoneyModel.py by @quaquel in https://github.com/projectmesa/mesa/pull/2458
|
|
187
|
+
### 🔍 Examples updated
|
|
188
|
+
* Updates to Epstein example by @quaquel in https://github.com/projectmesa/mesa/pull/2429
|
|
189
|
+
* Update examples to use updated space drawing by @quaquel in https://github.com/projectmesa/mesa/pull/2442
|
|
190
|
+
### 📜 Documentation improvements
|
|
191
|
+
* Update wolf-sheep png and fix typo in file name by @quaquel in https://github.com/projectmesa/mesa/pull/2444
|
|
192
|
+
* Include main examples readme in docs by @quaquel in https://github.com/projectmesa/mesa/pull/2448
|
|
193
|
+
* remove how-to guide and update docs in places by @quaquel in https://github.com/projectmesa/mesa/pull/2449
|
|
194
|
+
### 🔧 Maintenance
|
|
195
|
+
* remove deprecated HexGrid class by @quaquel in https://github.com/projectmesa/mesa/pull/2441
|
|
196
|
+
* rename make_plot_measure to make_plot_component and add some kwargs by @quaquel in https://github.com/projectmesa/mesa/pull/2446
|
|
197
|
+
|
|
198
|
+
**Full Changelog**: https://github.com/projectmesa/mesa/compare/v3.0.0b2...v3.0.0rc0
|
|
199
|
+
|
|
4
200
|
# 3.0.0b2 (2024-10-26)
|
|
5
201
|
## Highlights
|
|
6
202
|
Mesa 3.0 beta 2 includes major work on the example models, docs, a new tutorial and visualisation.
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: Mesa
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.1
|
|
4
4
|
Summary: Agent-based modeling (ABM) in Python
|
|
5
5
|
Project-URL: homepage, https://github.com/projectmesa/mesa
|
|
6
6
|
Project-URL: repository, https://github.com/projectmesa/mesa
|
|
7
7
|
Author-email: Project Mesa Team <projectmesa@googlegroups.com>
|
|
8
8
|
License: Apache 2.0
|
|
9
|
-
License-File: LICENSE
|
|
10
|
-
License-File: NOTICE
|
|
11
9
|
Keywords: ABM,agent,based,model,modeling,multi-agent,simulation
|
|
12
10
|
Classifier: Development Status :: 3 - Alpha
|
|
13
11
|
Classifier: Intended Audience :: Science/Research
|
|
@@ -93,9 +91,9 @@ interface; and analyze their results using Python's data analysis
|
|
|
93
91
|
tools. Its goal is to be the Python-based alternative to NetLogo,
|
|
94
92
|
Repast, or MASON.
|
|
95
93
|
|
|
96
|
-

|
|
97
95
|
|
|
98
|
-
*Above: A Mesa implementation of the
|
|
96
|
+
*Above: A Mesa implementation of the WolfSheep model, this
|
|
99
97
|
can be displayed in browser windows or Jupyter.*
|
|
100
98
|
|
|
101
99
|
## Features
|
|
@@ -107,18 +105,18 @@ can be displayed in browser windows or Jupyter.*
|
|
|
107
105
|
|
|
108
106
|
## Using Mesa
|
|
109
107
|
|
|
110
|
-
To install our latest stable release (
|
|
108
|
+
To install our latest stable release (3.0.x), run:
|
|
111
109
|
|
|
112
110
|
``` bash
|
|
113
111
|
pip install -U mesa
|
|
114
112
|
```
|
|
115
113
|
|
|
116
|
-
To install our latest pre-release
|
|
114
|
+
To install our latest pre-release, run:
|
|
117
115
|
|
|
118
116
|
``` bash
|
|
119
117
|
pip install -U --pre mesa
|
|
120
118
|
```
|
|
121
|
-
|
|
119
|
+
Starting with Mesa 3.0, we don't install all our dependencies anymore by default.
|
|
122
120
|
```bash
|
|
123
121
|
# You can customize the additional dependencies you need, if you want. Available are:
|
|
124
122
|
pip install -U --pre mesa[network,viz]
|
|
@@ -14,9 +14,9 @@ interface; and analyze their results using Python's data analysis
|
|
|
14
14
|
tools. Its goal is to be the Python-based alternative to NetLogo,
|
|
15
15
|
Repast, or MASON.
|
|
16
16
|
|
|
17
|
-

|
|
18
18
|
|
|
19
|
-
*Above: A Mesa implementation of the
|
|
19
|
+
*Above: A Mesa implementation of the WolfSheep model, this
|
|
20
20
|
can be displayed in browser windows or Jupyter.*
|
|
21
21
|
|
|
22
22
|
## Features
|
|
@@ -28,18 +28,18 @@ can be displayed in browser windows or Jupyter.*
|
|
|
28
28
|
|
|
29
29
|
## Using Mesa
|
|
30
30
|
|
|
31
|
-
To install our latest stable release (
|
|
31
|
+
To install our latest stable release (3.0.x), run:
|
|
32
32
|
|
|
33
33
|
``` bash
|
|
34
34
|
pip install -U mesa
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
To install our latest pre-release
|
|
37
|
+
To install our latest pre-release, run:
|
|
38
38
|
|
|
39
39
|
``` bash
|
|
40
40
|
pip install -U --pre mesa
|
|
41
41
|
```
|
|
42
|
-
|
|
42
|
+
Starting with Mesa 3.0, we don't install all our dependencies anymore by default.
|
|
43
43
|
```bash
|
|
44
44
|
# You can customize the additional dependencies you need, if you want. Available are:
|
|
45
45
|
pip install -U --pre mesa[network,viz]
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"""configurations for benchmarks."""
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
from Flocking.flocking import BoidFlockers
|
|
5
|
-
from Schelling.schelling import Schelling
|
|
6
|
-
from WolfSheep.wolf_sheep import WolfSheep
|
|
3
|
+
from mesa.examples import BoidFlockers, BoltzmannWealth, Schelling, WolfSheep
|
|
7
4
|
|
|
8
5
|
configurations = {
|
|
9
6
|
# Schelling Model Configurations
|
|
@@ -28,21 +28,21 @@ def run_model(model_class, seed, parameters):
|
|
|
28
28
|
Returns:
|
|
29
29
|
startup time and run time
|
|
30
30
|
"""
|
|
31
|
-
|
|
31
|
+
uses_simulator = ["WolfSheep"]
|
|
32
32
|
start_init = timeit.default_timer()
|
|
33
|
-
if model_class.__name__ in
|
|
34
|
-
model = model_class(seed=seed, **parameters)
|
|
35
|
-
else:
|
|
33
|
+
if model_class.__name__ in uses_simulator:
|
|
36
34
|
simulator = ABMSimulator()
|
|
37
35
|
model = model_class(simulator=simulator, seed=seed, **parameters)
|
|
38
|
-
|
|
36
|
+
else:
|
|
37
|
+
model = model_class(seed=seed, **parameters)
|
|
39
38
|
|
|
40
39
|
end_init_start_run = timeit.default_timer()
|
|
41
40
|
|
|
42
|
-
if model_class.__name__ in
|
|
43
|
-
model.run_model(config["steps"])
|
|
44
|
-
else:
|
|
41
|
+
if model_class.__name__ in uses_simulator:
|
|
45
42
|
simulator.run_for(config["steps"])
|
|
43
|
+
else:
|
|
44
|
+
for _ in range(config["steps"]):
|
|
45
|
+
model.step()
|
|
46
46
|
|
|
47
47
|
end_run = timeit.default_timer()
|
|
48
48
|
|
|
@@ -3,6 +3,11 @@ This namespace contains experimental features. These are under development, and
|
|
|
3
3
|
|
|
4
4
|
## Cell Space
|
|
5
5
|
|
|
6
|
+
```{eval-rst}
|
|
7
|
+
.. automodule:: experimental.cell_space.__init__
|
|
8
|
+
:members:
|
|
9
|
+
```
|
|
10
|
+
|
|
6
11
|
```{eval-rst}
|
|
7
12
|
.. automodule:: experimental.cell_space.cell
|
|
8
13
|
:members:
|
|
@@ -33,6 +38,11 @@ This namespace contains experimental features. These are under development, and
|
|
|
33
38
|
:members:
|
|
34
39
|
```
|
|
35
40
|
|
|
41
|
+
```{eval-rst}
|
|
42
|
+
.. automodule:: experimental.cell_space.voronoi
|
|
43
|
+
:members:
|
|
44
|
+
```
|
|
45
|
+
|
|
36
46
|
## Devs
|
|
37
47
|
|
|
38
48
|
```{eval-rst}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Visualization
|
|
2
|
+
|
|
3
|
+
For a detailed tutorial, please refer to our [Visualization Tutorial](../tutorials/visualization_tutorial.ipynb).
|
|
4
|
+
|
|
5
|
+
## Jupyter Visualization
|
|
6
|
+
|
|
7
|
+
```{eval-rst}
|
|
8
|
+
.. automodule:: mesa.visualization.solara_viz
|
|
9
|
+
:members:
|
|
10
|
+
:undoc-members:
|
|
11
|
+
:show-inheritance:
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## User Parameters
|
|
15
|
+
|
|
16
|
+
```{eval-rst}
|
|
17
|
+
.. automodule:: mesa.visualization.user_param
|
|
18
|
+
:members:
|
|
19
|
+
:undoc-members:
|
|
20
|
+
:show-inheritance:
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## Matplotlib-based visualizations
|
|
25
|
+
|
|
26
|
+
```{eval-rst}
|
|
27
|
+
.. automodule:: mesa.visualization.components.matplotlib_components
|
|
28
|
+
:members:
|
|
29
|
+
:undoc-members:
|
|
30
|
+
:show-inheritance:
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```{eval-rst}
|
|
34
|
+
.. automodule:: mesa.visualization.mpl_space_drawing
|
|
35
|
+
:members:
|
|
36
|
+
:undoc-members:
|
|
37
|
+
:show-inheritance:
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Altair-based visualizations
|
|
41
|
+
|
|
42
|
+
```{eval-rst}
|
|
43
|
+
.. automodule:: mesa.visualization.components.altair_components
|
|
44
|
+
:members:
|
|
45
|
+
:undoc-members:
|
|
46
|
+
:show-inheritance:
|
|
47
|
+
```
|
|
@@ -24,7 +24,7 @@ All our [examples](examples) follow this layout.
|
|
|
24
24
|
## Randomization
|
|
25
25
|
|
|
26
26
|
If your model involves some random choice, you can use the built-in `random`
|
|
27
|
-
property that Mesa `Model` and `
|
|
27
|
+
property that many Mesa objects have, including `Model`, `Agent`, and `AgentSet`. This works exactly
|
|
28
28
|
like the built-in `random` library.
|
|
29
29
|
|
|
30
30
|
```python
|
|
@@ -45,20 +45,24 @@ class AwesomeAgent(Agent):
|
|
|
45
45
|
random_number = self.random.randint(0, 100)
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
`random`
|
|
48
|
+
`Agent.random` is just a convenient shorthand in the Agent class to `self.model.random`. If you create your own `AgentSet`
|
|
49
|
+
instances, you have to pass `random` explicitly. Typically, you can simply do, in a Model instance,
|
|
50
|
+
`my_agentset = AgentSet([], random=self.random)`. This ensures that `my_agentset` uses the same random
|
|
51
|
+
number generator as the rest of the model.
|
|
52
|
+
|
|
50
53
|
|
|
51
54
|
When a model object is created, its random property is automatically seeded
|
|
52
55
|
with the current time. The seed determines the sequence of random numbers; if
|
|
53
56
|
you instantiate a model with the same seed, you will get the same results.
|
|
54
57
|
To allow you to set the seed, make sure your model has a `seed` argument in its
|
|
55
|
-
|
|
58
|
+
`__init__`.
|
|
56
59
|
|
|
57
60
|
```python
|
|
58
61
|
class AwesomeModel(Model):
|
|
59
62
|
|
|
60
63
|
def __init__(self, seed=None):
|
|
61
|
-
|
|
64
|
+
super().__init__(seed=seed)
|
|
65
|
+
...
|
|
62
66
|
|
|
63
67
|
def cool_method(self):
|
|
64
68
|
interesting_number = self.random.random()
|
|
@@ -175,7 +175,9 @@ html_static_path = ["_static"]
|
|
|
175
175
|
# html_use_smartypants = True
|
|
176
176
|
|
|
177
177
|
# Custom sidebar templates, maps document names to template names.
|
|
178
|
-
|
|
178
|
+
html_sidebars = {
|
|
179
|
+
'migration_guide': [], # No sidebar migration
|
|
180
|
+
}
|
|
179
181
|
|
|
180
182
|
# Additional templates that should be rendered to pages, maps page names to
|
|
181
183
|
# template names.
|
|
@@ -316,17 +318,20 @@ def setup_examples_pages():
|
|
|
316
318
|
# create md files for all examples
|
|
317
319
|
# check what examples exist
|
|
318
320
|
examples_folder = osp.abspath(osp.join(HERE, "..", "mesa", "examples"))
|
|
319
|
-
basic_examples = [f.path for f in os.scandir(osp.join(examples_folder, "basic")) if f.is_dir() and not f.name.startswith("__") ]
|
|
320
|
-
advanced_examples = [f.path for f in os.scandir(osp.join(examples_folder, "advanced")) if f.is_dir() and not f.name.startswith("__")]
|
|
321
|
+
basic_examples = [("basic", f.path) for f in os.scandir(osp.join(examples_folder, "basic")) if f.is_dir() and not f.name.startswith("__") ]
|
|
322
|
+
advanced_examples = [("advanced", f.path) for f in os.scandir(osp.join(examples_folder, "advanced")) if f.is_dir() and not f.name.startswith("__")]
|
|
321
323
|
examples = basic_examples + advanced_examples
|
|
322
324
|
|
|
323
325
|
with open(os.path.join(HERE, "example_template.txt")) as fh:
|
|
324
326
|
template = string.Template(fh.read())
|
|
325
327
|
|
|
326
|
-
pathlib.Path(os.path.join(HERE, "examples"))
|
|
328
|
+
root_folder = pathlib.Path(os.path.join(HERE, "examples"))
|
|
329
|
+
root_folder.mkdir(parents=True, exist_ok=True)
|
|
330
|
+
pathlib.Path(os.path.join(root_folder, "basic")).mkdir(parents=True, exist_ok=True)
|
|
331
|
+
pathlib.Path(os.path.join(root_folder, "advanced")).mkdir(parents=True, exist_ok=True)
|
|
327
332
|
|
|
328
333
|
examples_md = []
|
|
329
|
-
for example in examples:
|
|
334
|
+
for kind, example in examples:
|
|
330
335
|
base_name = os.path.basename(os.path.normpath(example))
|
|
331
336
|
|
|
332
337
|
agent_filename = os.path.join(example, "agents.py")
|
|
@@ -335,19 +340,23 @@ def setup_examples_pages():
|
|
|
335
340
|
app_filename = os.path.join(example, "app.py")
|
|
336
341
|
|
|
337
342
|
md_filename = f"{base_name}.md"
|
|
338
|
-
examples_md.append(base_name)
|
|
343
|
+
examples_md.append((base_name, f"{kind}/{base_name}"))
|
|
339
344
|
|
|
340
|
-
md_filepath = os.path.join(HERE, "examples", md_filename)
|
|
345
|
+
md_filepath = os.path.join(HERE, "examples", kind, md_filename)
|
|
341
346
|
write_example_md_file(agent_filename, model_filename, readme_filename, app_filename, md_filepath, template)
|
|
342
347
|
|
|
343
348
|
# create overview of examples.md
|
|
344
349
|
with open(os.path.join(HERE, "examples_overview_template.txt")) as fh:
|
|
345
350
|
template = string.Template(fh.read())
|
|
346
351
|
|
|
352
|
+
with open(os.path.join(examples_folder, "README.md")) as fh:
|
|
353
|
+
readme_md = fh.read()
|
|
354
|
+
|
|
347
355
|
with open(os.path.join(HERE, "examples.md"), "w") as fh:
|
|
348
356
|
content = template.substitute(
|
|
349
357
|
dict(
|
|
350
|
-
|
|
358
|
+
readme=readme_md,
|
|
359
|
+
example_paths="\n".join([f"{' '.join(a.split('_'))} </examples/{b}>" for a, b in examples_md]),
|
|
351
360
|
)
|
|
352
361
|
)
|
|
353
362
|
fh.write(content)
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Getting started
|
|
2
2
|
Mesa is a modular framework for building, analyzing and visualizing agent-based models.
|
|
3
3
|
|
|
4
4
|
**Agent-based models** are computer simulations involving multiple entities (the agents) acting and interacting with one another based on their programmed behavior. Agents can be used to represent living cells, animals, individual humans, even entire organizations or abstract entities. Sometimes, we may have an understanding of how the individual components of a system behave, and want to see what system-level behaviors and effects emerge from their interaction. Other times, we may have a good idea of how the system overall behaves, and want to figure out what individual behaviors explain it. Or we may want to see how to get agents to cooperate or compete most effectively. Or we may just want to build a cool toy with colorful little dots moving around.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
## Tutorials
|
|
8
|
+
If you want to get a quick start on how to build agent based models with MESA, check the tutorials:
|
|
9
|
+
|
|
10
|
+
- [Introductory Tutorial](tutorials/intro_tutorial): Learn how to create your first Mesa model.
|
|
11
|
+
- [Visualization Tutorial](tutorials/visualization_tutorial): Learn how to create interactive visualizations for your models.
|
|
12
|
+
|
|
13
|
+
## Examples
|
|
14
|
+
Mesa ships with a collection of example models. These are classic ABMs, so if you are familiar with ABMs and want to get a quick sense of how MESA works, these examples are great place to start. You can find them [here](examples).
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Overview of the MESA library
|
|
7
18
|
|
|
8
19
|
Mesa is modular, meaning that its modeling, analysis and visualization components are kept separate but intended to work together. The modules are grouped into three categories:
|
|
9
20
|
|
|
@@ -165,14 +176,22 @@ results = mesa.batch_run(
|
|
|
165
176
|
The results are returned as a list of dictionaries, which can be easily converted to a pandas DataFrame for further analysis.
|
|
166
177
|
|
|
167
178
|
### Visualization
|
|
168
|
-
Mesa now uses a new browser-based visualization system called SolaraViz. This allows for interactive, customizable visualizations of your models.
|
|
179
|
+
Mesa now uses a new browser-based visualization system called SolaraViz. This allows for interactive, customizable visualizations of your models.
|
|
180
|
+
|
|
181
|
+
> **Note:** SolaraViz is experimental and still in active development for Mesa 3.0. While we attempt to minimize them, there might be API breaking changes between Mesa 3.0 and 3.1. There won't be breaking changes between Mesa 3.0.x patch releases.
|
|
182
|
+
|
|
183
|
+
The core functionality for building your own visualizations resides in the [`mesa.visualization`](apis/visualization) namespace
|
|
184
|
+
|
|
185
|
+
Here's a basic example of how to set up a visualization:
|
|
169
186
|
|
|
170
187
|
```python
|
|
171
|
-
from mesa.visualization import SolaraViz,
|
|
188
|
+
from mesa.visualization import SolaraViz, make_space_component, make_plot_component
|
|
189
|
+
|
|
172
190
|
|
|
173
191
|
def agent_portrayal(agent):
|
|
174
192
|
return {"color": "blue", "size": 50}
|
|
175
193
|
|
|
194
|
+
|
|
176
195
|
model_params = {
|
|
177
196
|
"N": {
|
|
178
197
|
"type": "SliderInt",
|
|
@@ -181,14 +200,14 @@ model_params = {
|
|
|
181
200
|
"min": 10,
|
|
182
201
|
"max": 100,
|
|
183
202
|
"step": 1,
|
|
184
|
-
|
|
203
|
+
}
|
|
185
204
|
}
|
|
186
205
|
|
|
187
206
|
page = SolaraViz(
|
|
188
207
|
MyModel,
|
|
189
208
|
[
|
|
190
|
-
|
|
191
|
-
|
|
209
|
+
make_space_component(agent_portrayal),
|
|
210
|
+
make_plot_component("mean_age")
|
|
192
211
|
],
|
|
193
212
|
model_params=model_params
|
|
194
213
|
)
|
|
@@ -202,28 +221,42 @@ This will create an interactive visualization of your model, including:
|
|
|
202
221
|
|
|
203
222
|
You can also create custom visualization components using Matplotlib. For more advanced usage and customization options, please refer to the [visualization tutorial](tutorials/visualization_tutorial).
|
|
204
223
|
|
|
205
|
-
|
|
224
|
+
## Further resources
|
|
206
225
|
To further explore Mesa and its features, we have the following resources available:
|
|
207
226
|
|
|
208
|
-
|
|
209
|
-
- [
|
|
210
|
-
- [Visualization Tutorial](tutorials/visualization_tutorial.html): Learn how to create interactive visualizations for your models.
|
|
227
|
+
### Best practices
|
|
228
|
+
- [Mesa best practices](best-practices): an overview of tips and guidelines for using MESA.
|
|
211
229
|
|
|
212
|
-
|
|
230
|
+
### API documentation
|
|
213
231
|
- [Mesa API reference](apis): Detailed documentation of Mesa's classes and functions.
|
|
214
232
|
|
|
215
|
-
|
|
233
|
+
### Repository of models built using MESA
|
|
216
234
|
- [Mesa Examples repository](https://github.com/projectmesa/mesa-examples): A collection of example models demonstrating various Mesa features and modeling techniques.
|
|
217
235
|
|
|
218
|
-
|
|
236
|
+
### Migration guide
|
|
219
237
|
- [Mesa 3.0 Migration guide](migration_guide): If you're upgrading from an earlier version of Mesa, this guide will help you navigate the changes in Mesa 3.0.
|
|
220
238
|
|
|
221
|
-
|
|
239
|
+
### Source Ccode and development
|
|
222
240
|
- [Mesa GitHub repository](https://github.com/projectmesa/mesa): Access the full source code of Mesa, contribute to its development, or report issues.
|
|
223
241
|
- [Mesa release notes](https://github.com/projectmesa/mesa/releases): View the detailed changelog of Mesa, including all past releases and their features.
|
|
224
242
|
|
|
225
|
-
|
|
243
|
+
### Community and support
|
|
226
244
|
- [Mesa GitHub Discussions](https://github.com/projectmesa/mesa/discussions): Join discussions, ask questions, and connect with other Mesa users.
|
|
227
245
|
- [Matrix Chat](https://matrix.to/#/#project-mesa:matrix.org): Real-time chat for quick questions and community interaction.
|
|
228
246
|
|
|
229
247
|
Enjoy modelling with Mesa, and feel free to reach out!
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
```{toctree}
|
|
254
|
+
:hidden: true
|
|
255
|
+
:maxdepth: 7
|
|
256
|
+
|
|
257
|
+
tutorials/intro_tutorial
|
|
258
|
+
tutorials/visualization_tutorial
|
|
259
|
+
Best Practices <best-practices>
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
```
|