Mesa 2.4.0__tar.gz → 3.0.0a0__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-2.4.0 → mesa-3.0.0a0}/.codespellignore +1 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/.github/workflows/build_lint.yml +0 -6
- {mesa-2.4.0 → mesa-3.0.0a0}/.gitignore +4 -2
- {mesa-2.4.0 → mesa-3.0.0a0}/.pre-commit-config.yaml +5 -5
- {mesa-2.4.0 → mesa-3.0.0a0}/.readthedocs.yml +3 -3
- {mesa-2.4.0 → mesa-3.0.0a0}/CODE_OF_CONDUCT.md +1 -1
- {mesa-2.4.0 → mesa-3.0.0a0}/CONTRIBUTING.md +0 -34
- {mesa-2.4.0 → mesa-3.0.0a0}/HISTORY.md +21 -90
- {mesa-2.4.0 → mesa-3.0.0a0}/PKG-INFO +4 -11
- {mesa-2.4.0 → mesa-3.0.0a0}/README.md +1 -6
- {mesa-2.4.0 → mesa-3.0.0a0}/benchmarks/Flocking/flocking.py +0 -1
- {mesa-2.4.0 → mesa-3.0.0a0}/benchmarks/WolfSheep/wolf_sheep.py +2 -3
- mesa-3.0.0a0/docs/apis/visualization.md +21 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/conf.py +2 -10
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/index.md +2 -6
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/mesa.md +0 -6
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/overview.md +5 -84
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/packages.md +2 -2
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/tutorials/intro_tutorial.ipynb +2 -4
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/tutorials/visualization_tutorial.ipynb +3 -3
- mesa-3.0.0a0/maintenance/fetch_unlabeled_prs.py +81 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/__init__.py +1 -3
- mesa-3.0.0a0/mesa/agent.py +362 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/batchrunner.py +8 -11
- mesa-3.0.0a0/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/app.pytemplate +27 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}/model.pytemplate +1 -1
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/datacollection.py +21 -136
- mesa-3.0.0a0/mesa/experimental/__init__.py +3 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/experimental/cell_space/cell_collection.py +2 -2
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/experimental/cell_space/grid.py +1 -1
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/experimental/cell_space/network.py +3 -3
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/experimental/devs/eventlist.py +2 -1
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/experimental/devs/examples/epstein_civil_violence.py +1 -2
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/experimental/devs/examples/wolf_sheep.py +2 -3
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/experimental/devs/simulator.py +2 -1
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/model.py +23 -93
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/space.py +11 -17
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/time.py +1 -3
- {mesa-2.4.0/mesa/experimental → mesa-3.0.0a0/mesa/visualization}/UserParam.py +1 -1
- mesa-3.0.0a0/mesa/visualization/__init__.py +3 -0
- {mesa-2.4.0/mesa/experimental → mesa-3.0.0a0/mesa/visualization}/components/altair.py +1 -2
- {mesa-2.4.0/mesa/experimental → mesa-3.0.0a0/mesa/visualization}/components/matplotlib.py +4 -6
- {mesa-2.4.0/mesa/experimental → mesa-3.0.0a0/mesa/visualization}/jupyter_viz.py +117 -20
- {mesa-2.4.0 → mesa-3.0.0a0}/pyproject.toml +4 -6
- mesa-3.0.0a0/tests/test_agent.py +284 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/tests/test_datacollector.py +5 -176
- {mesa-2.4.0 → mesa-3.0.0a0}/tests/test_import_namespace.py +0 -10
- {mesa-2.4.0 → mesa-3.0.0a0}/tests/test_jupyter_viz.py +2 -2
- {mesa-2.4.0 → mesa-3.0.0a0}/tests/test_model.py +1 -17
- {mesa-2.4.0 → mesa-3.0.0a0}/tests/test_space.py +0 -17
- {mesa-2.4.0 → mesa-3.0.0a0}/tests/test_time.py +1 -1
- mesa-2.4.0/docs/_static/switcher.json +0 -12
- mesa-2.4.0/docs/apis/visualization.md +0 -38
- mesa-2.4.0/docs/mesa.visualization.md +0 -46
- mesa-2.4.0/docs/mesa.visualization.modules.md +0 -76
- mesa-2.4.0/docs/migration_guide.md +0 -294
- mesa-2.4.0/docs/modular-visualization.md +0 -249
- mesa-2.4.0/docs/tutorials/adv_tutorial_legacy.ipynb +0 -510
- mesa-2.4.0/mesa/agent.py +0 -641
- mesa-2.4.0/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/run.pytemplate +0 -3
- mesa-2.4.0/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}/server.pytemplate +0 -36
- mesa-2.4.0/mesa/experimental/__init__.py +0 -5
- mesa-2.4.0/mesa/flat/__init__.py +0 -6
- mesa-2.4.0/mesa/flat/visualization.py +0 -5
- mesa-2.4.0/mesa/visualization/ModularVisualization.py +0 -1
- mesa-2.4.0/mesa/visualization/TextVisualization.py +0 -1
- mesa-2.4.0/mesa/visualization/UserParam.py +0 -1
- mesa-2.4.0/mesa/visualization/__init__.py +0 -7
- mesa-2.4.0/mesa/visualization/modules.py +0 -1
- mesa-2.4.0/tests/test_agent.py +0 -594
- mesa-2.4.0/tests/test_main.py +0 -34
- mesa-2.4.0/tests/test_tornado.py +0 -41
- mesa-2.4.0/tests/test_usersettableparam.py +0 -57
- mesa-2.4.0/tests/test_visualization.py +0 -105
- {mesa-2.4.0 → mesa-3.0.0a0}/.coveragerc +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/.github/ISSUE_TEMPLATE/asking-help.md +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/.github/ISSUE_TEMPLATE/bug-report.md +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/.github/ISSUE_TEMPLATE/feature-request.md +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/.github/dependabot.yml +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/.github/release.yml +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/.github/workflows/benchmarks.yml +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/.github/workflows/release.yml +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/CITATION.bib +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/Dockerfile +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/LICENSE +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/benchmarks/Flocking/__init__.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/benchmarks/Schelling/__init__.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/benchmarks/Schelling/schelling.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/benchmarks/WolfSheep/__init__.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/benchmarks/compare_timings.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/benchmarks/configurations.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/benchmarks/global_benchmark.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/codecov.yaml +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docker-compose.yml +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/Makefile +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/README.md +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/apis/api_main.md +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/apis/batchrunner.md +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/apis/datacollection.md +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/apis/experimental.md +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/apis/init.md +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/apis/space.md +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/apis/time.md +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/best-practices.md +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/howto.md +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/images/Mesa_Screenshot.png +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/images/mesa_logo.ico +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/images/mesa_logo.png +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/images/tutorial/br_ginis.png +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/images/tutorial/dc_endwealth.png +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/images/tutorial/dc_gini.png +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/images/tutorial/dc_oneagent.png +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/images/tutorial/first_hist.png +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/images/tutorial/multirun_hist.png +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/images/tutorial/numpy_grid.png +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/images/tutorial/viz_chart.png +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/images/tutorial/viz_empty.png +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/images/tutorial/viz_greycircles.png +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/images/tutorial/viz_histogram.png +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/images/tutorial/viz_redcircles.png +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/make.bat +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/tutorials/MoneyModel.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/tutorials/files/viz_chart.png +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/tutorials/files/viz_empty.png +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/tutorials/files/viz_greycircles.png +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/tutorials/files/viz_histogram.png +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/tutorials/files/viz_redcircles.png +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/docs/tutorials/files/viz_slider.png +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/cookiecutter-mesa/cookiecutter.json +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/cookiecutter-mesa/hooks/post_gen_project.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/README.md +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/setup.pytemplate +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}/__init__.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/experimental/cell_space/__init__.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/experimental/cell_space/cell.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/experimental/cell_space/cell_agent.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/experimental/cell_space/discrete_space.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/experimental/devs/__init__.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/mesa/main.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/mypy.ini +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/tests/__init__.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/tests/read_requirements.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/tests/test_batch_run.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/tests/test_cell_space.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/tests/test_devs.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/tests/test_end_to_end_viz.sh +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/tests/test_examples.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/tests/test_grid.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/tests/test_lifespan.py +0 -0
- {mesa-2.4.0 → mesa-3.0.0a0}/tests/test_scaffold.py +0 -0
|
@@ -33,14 +33,10 @@ jobs:
|
|
|
33
33
|
os: [windows, ubuntu, macos]
|
|
34
34
|
python-version: ["3.12"]
|
|
35
35
|
include:
|
|
36
|
-
- os: ubuntu
|
|
37
|
-
python-version: "3.13"
|
|
38
36
|
- os: ubuntu
|
|
39
37
|
python-version: "3.11"
|
|
40
38
|
- os: ubuntu
|
|
41
39
|
python-version: "3.10"
|
|
42
|
-
- os: ubuntu
|
|
43
|
-
python-version: "3.9"
|
|
44
40
|
# Disabled for now. See https://github.com/projectmesa/mesa/issues/1253
|
|
45
41
|
#- os: ubuntu
|
|
46
42
|
# python-version: 'pypy-3.8'
|
|
@@ -51,7 +47,6 @@ jobs:
|
|
|
51
47
|
uses: actions/setup-python@v5
|
|
52
48
|
with:
|
|
53
49
|
python-version: ${{ matrix.python-version }}
|
|
54
|
-
allow-prereleases: true
|
|
55
50
|
cache: 'pip'
|
|
56
51
|
- name: Install uv
|
|
57
52
|
run: pip install uv
|
|
@@ -82,7 +77,6 @@ jobs:
|
|
|
82
77
|
with:
|
|
83
78
|
repository: projectmesa/mesa-examples
|
|
84
79
|
path: mesa-examples
|
|
85
|
-
ref: mesa-2.x # Legacy branch for mesa-examples that work with Mesa 2.x
|
|
86
80
|
- name: Test examples
|
|
87
81
|
run: |
|
|
88
82
|
cd mesa-examples
|
|
@@ -15,8 +15,6 @@ __pycache__/
|
|
|
15
15
|
.Python
|
|
16
16
|
env/
|
|
17
17
|
venv/
|
|
18
|
-
pythonenv*/
|
|
19
|
-
.venv/
|
|
20
18
|
build/
|
|
21
19
|
develop-eggs/
|
|
22
20
|
dist/
|
|
@@ -85,6 +83,10 @@ target/
|
|
|
85
83
|
.dmypy.json
|
|
86
84
|
dmypy.json
|
|
87
85
|
|
|
86
|
+
# pythonenv
|
|
87
|
+
pythonenv*/
|
|
88
|
+
|
|
88
89
|
# JS dependencies
|
|
89
90
|
mesa/visualization/templates/external/
|
|
90
91
|
mesa/visualization/templates/js/external/
|
|
92
|
+
|
|
@@ -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.5.0
|
|
8
8
|
hooks:
|
|
9
9
|
# Run the linter.
|
|
10
10
|
- id: ruff
|
|
@@ -14,18 +14,18 @@ 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.16.0
|
|
18
18
|
hooks:
|
|
19
19
|
- id: pyupgrade
|
|
20
|
-
args: [--
|
|
20
|
+
args: [--py310-plus]
|
|
21
21
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
22
|
-
rev: v4.
|
|
22
|
+
rev: v4.6.0 # Use the ref you want to point at
|
|
23
23
|
hooks:
|
|
24
24
|
- id: trailing-whitespace
|
|
25
25
|
- id: check-toml
|
|
26
26
|
- id: check-yaml
|
|
27
27
|
- repo: https://github.com/codespell-project/codespell
|
|
28
|
-
rev: v2.
|
|
28
|
+
rev: v2.3.0
|
|
29
29
|
hooks:
|
|
30
30
|
- id: codespell
|
|
31
31
|
args: [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Read the Docs configuration file
|
|
2
|
-
# See https://docs.readthedocs.io/stable/config-file/v2.html for details
|
|
2
|
+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
|
3
3
|
|
|
4
4
|
# Required
|
|
5
5
|
version: 2
|
|
@@ -13,9 +13,9 @@ formats:
|
|
|
13
13
|
- pdf
|
|
14
14
|
|
|
15
15
|
build:
|
|
16
|
-
os: ubuntu-
|
|
16
|
+
os: "ubuntu-22.04"
|
|
17
17
|
tools:
|
|
18
|
-
python:
|
|
18
|
+
python: "3"
|
|
19
19
|
|
|
20
20
|
# Optionally set the version of Python and requirements required to build your docs
|
|
21
21
|
python:
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
We as members, contributors, and leaders pledge to make participation in our
|
|
6
6
|
community a harassment-free experience for everyone, regardless of age, body
|
|
7
7
|
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
-
identity and expression, level of experience, education,
|
|
8
|
+
identity and expression, level of experience, education, socioeconomic status,
|
|
9
9
|
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
10
|
identity and orientation.
|
|
11
11
|
|
|
@@ -36,40 +36,6 @@ discuss via [Matrix] OR via [an issue].
|
|
|
36
36
|
- Describe the change w/ ticket number(s) that the code fixes.
|
|
37
37
|
- Format your commit message as per [Tim Pope's guideline].
|
|
38
38
|
|
|
39
|
-
## I have no idea where to start
|
|
40
|
-
That's fine! Here's a rough outline where you could start, depending on your experience:
|
|
41
|
-
|
|
42
|
-
### I'm a modeller (but not an experienced developer)
|
|
43
|
-
You already know how to build Mesa models (if not skip below), and probably have found things Mesa can't do (elegantly). You want to improve that. Awesome!
|
|
44
|
-
|
|
45
|
-
First step is to install some proper tools, if you haven't already.
|
|
46
|
-
- A good IDE helps for code development, testing and formatting. [PyCharm](https://www.jetbrains.com/pycharm/) or [VSCode](https://code.visualstudio.com/) for example.
|
|
47
|
-
- Dive into Git and GitHub. Watch some videos, this takes some time to click. [GitHub Desktop](https://desktop.github.com/) is great.
|
|
48
|
-
- [`https://github.dev/projectmesa/mesa`](https://github.dev/projectmesa/mesa) is great for small changes (to docs).
|
|
49
|
-
|
|
50
|
-
Learn the tools, talk to us about what you want to change, and open a small PR. Or update an [example model](https://github.com/projectmesa/mesa-examples) (check open [issues](https://github.com/projectmesa/mesa-examples/issues))!
|
|
51
|
-
|
|
52
|
-
### I'm a developer (but not a modeller)
|
|
53
|
-
Awesome! You have the basics of open-source software development (if not check above), but not much modelling experience.
|
|
54
|
-
|
|
55
|
-
First step is to start thinking like a modeller. To understand the fine details about our library and contribute meaningfully, get some modelling experience:
|
|
56
|
-
- Go though our [Introductory Tutorial](https://mesa.readthedocs.io/latest/tutorials/intro_tutorial.html) and [Visualization Tutorial](https://mesa.readthedocs.io/latest/tutorials/visualization_tutorial.html). While going through them, dive into the source code to really see what everything does.
|
|
57
|
-
- Follow an ABM course (if possible). They might be a bit outdated programming language wise, but conceptual they're sound.
|
|
58
|
-
- This MOOC on ABM concepts: [Agent Based Modeling](https://ocw.tudelft.nl/course-lectures/agent-based-modeling/)
|
|
59
|
-
- This MOOC on practical ABM modelling: [Agent-Based Models with Python: An Introduction to Mesa](https://www.complexityexplorer.org/courses/172-agent-based-models-with-python-an-introduction-to-mesa)
|
|
60
|
-
- Go though multiple of our [examples](https://github.com/projectmesa/mesa-examples). Play with them, modify things and get a feel for Mesa and ABMs.
|
|
61
|
-
- Check our open [issues](https://github.com/projectmesa/mesa-examples/issues) for the examples.
|
|
62
|
-
- If you see anything you want to improve, feel free to open a (small) PR!
|
|
63
|
-
- If you have a feel for Mesa, check our [discussions](https://github.com/projectmesa/mesa/discussions) and [issues](https://github.com/projectmesa/mesa/issues).
|
|
64
|
-
- Also go thought our [release notes](https://github.com/projectmesa/mesa/releases) to see what we recently have been working on, and see some examples of successful PRs.
|
|
65
|
-
- Once you found or thought of a nice idea, comment on the issue/discussion (or open a new one) and get to work!
|
|
66
|
-
|
|
67
|
-
### I'm both
|
|
68
|
-
That's great! You can just start working on things, reach out to us. Skim to the list above if you feel you're missing anything. Start small but don't be afraid to dream big!
|
|
69
|
-
|
|
70
|
-
### I'm neither
|
|
71
|
-
Start with creating your own models, for fun. Once you have some experience, move to the topics above.
|
|
72
|
-
|
|
73
39
|
## Testing and Code Standards
|
|
74
40
|
|
|
75
41
|
```{image} https://codecov.io/gh/projectmesa/mesa/branch/main/graph/badge.svg
|
|
@@ -1,111 +1,42 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Release History
|
|
3
3
|
---
|
|
4
|
-
#
|
|
4
|
+
# 3.0.0a0 (2024-07-04)
|
|
5
5
|
## Highlights
|
|
6
|
-
|
|
6
|
+
This is the first pre-release in the Mesa 3.0 series, which is still in active development. The `v3.0.0a0` pre-release can help active Mesa developers help starting to test the latest features in their models.
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Since it's in active development, more breaking changes may follow and it's not recommended for general usage.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
Wolf: {"sheep_eaten": "sheep_eaten"},
|
|
14
|
-
Sheep: {"wool": "wool_amount"}
|
|
15
|
-
}
|
|
16
|
-
)
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
The AgentSet class, which underpins `model.agents`, has received major enhancements:
|
|
20
|
-
- A new `groupby()` method to split agents into groups ([#2220](https://github.com/projectmesa/mesa/pull/2220))
|
|
21
|
-
- An `agg()` method to quickly compute aggregate values ([#2266](https://github.com/projectmesa/mesa/pull/2266))
|
|
22
|
-
- A faster `shuffle_do()` method for more efficient random agent activation ([#2283](https://github.com/projectmesa/mesa/pull/2283))
|
|
23
|
-
- The `select()` method now allows choosing a fraction of agents ([#2253](https://github.com/projectmesa/mesa/pull/2253))
|
|
24
|
-
- The `do()` method can now take any callable function, not just string method names ([#2219](https://github.com/projectmesa/mesa/pull/2219))
|
|
10
|
+
There are two major breaking changes at this point:
|
|
11
|
+
- The old visualisation is removed, in favor of the new, Solara based, Jupyter Viz. This was already available in the 2.3.x release series, but is now stabilized. Checkout out our new [Visualization Tutorial](https://mesa.readthedocs.io/en/latest/tutorials/visualization_tutorial.html). More examples and a migration guide will follow later in the Mesa 3.0 development.
|
|
12
|
+
- The `mesa.flat` namespace is removed, since was not used very often.
|
|
25
13
|
|
|
26
|
-
|
|
27
|
-
- The Model class now exposes an `agents_by_type` property for easier access to agents of specific types ([#2267](https://github.com/projectmesa/mesa/pull/2267))
|
|
28
|
-
- Performance enhancements for `Model.agents` ([#2251](https://github.com/projectmesa/mesa/pull/2251))
|
|
29
|
-
- The `AgentSet.get()` method now handles missing values with optional default value ([#2279](https://github.com/projectmesa/mesa/pull/2279))
|
|
14
|
+
Mesa 3.0 will require Python 3.10+.
|
|
30
15
|
|
|
31
|
-
This release
|
|
32
|
-
|
|
33
|
-
Finally, we've made significant documentation improvements, including the addition of a new [Migration guide](https://mesa.readthedocs.io/latest/migration_guide.html) to help users transition to future Mesa versions ([#2257](https://github.com/projectmesa/mesa/pull/2257)).
|
|
16
|
+
This pre-release can be installed with `pip install mesa --upgrade --pre`.
|
|
34
17
|
|
|
35
18
|
## What's Changed
|
|
19
|
+
### ⚠️ Breaking changes
|
|
20
|
+
* Remove mesa.flat namespace by @rht in https://github.com/projectmesa/mesa/pull/2091
|
|
21
|
+
* breaking: Remove visualization_old (mesa-viz-tornado) by @rht in https://github.com/projectmesa/mesa/pull/2133
|
|
36
22
|
### 🎉 New features added
|
|
37
|
-
*
|
|
38
|
-
* AgentSet: Add `agg` method by @EwoutH in [#2266](https://github.com/projectmesa/mesa/pull/2266)
|
|
39
|
-
* GroupBy: Add `count` and `agg` methods by @EwoutH in [#2290](https://github.com/projectmesa/mesa/pull/2290)
|
|
40
|
-
* datacollector: Allow collecting data from Agent (sub)classes by @EwoutH in [#2300](https://github.com/projectmesa/mesa/pull/2300)
|
|
41
|
-
* Add optimized shuffle_do() method to AgentSet by @EwoutH in [#2283](https://github.com/projectmesa/mesa/pull/2283)
|
|
42
|
-
|
|
43
|
-
### 🛠 Enhancements made
|
|
44
|
-
* Allow AgentSet.do() to take Callable function by @quaquel in [#2219](https://github.com/projectmesa/mesa/pull/2219)
|
|
45
|
-
* Split AgentSet into map and do to separate return types by @quaquel in [#2237](https://github.com/projectmesa/mesa/pull/2237)
|
|
46
|
-
* Performance enhancements for Model.agents by @quaquel in [#2251](https://github.com/projectmesa/mesa/pull/2251)
|
|
47
|
-
* AgentSet: Allow selecting a fraction of agents in the AgentSet by @EwoutH in [#2253](https://github.com/projectmesa/mesa/pull/2253)
|
|
48
|
-
* Model: Replace `get_agents_of_type` method with `agents_by_type` property by @EwoutH in [#2267](https://github.com/projectmesa/mesa/pull/2267)
|
|
49
|
-
* Add default values and missing value handling to `agentset.get` by @quaquel in [#2279](https://github.com/projectmesa/mesa/pull/2279)
|
|
50
|
-
|
|
23
|
+
* Set JupyterViz as stable by @rht in https://github.com/projectmesa/mesa/pull/2090
|
|
51
24
|
### 🐛 Bugs fixed
|
|
52
|
-
* Jupyter_viz: Allow measures to be None by @EwoutH in
|
|
53
|
-
*
|
|
54
|
-
|
|
55
|
-
### 📜 Documentation improvements
|
|
56
|
-
* Contribution: Add "I have no idea where to start" section by @EwoutH in [#2258](https://github.com/projectmesa/mesa/pull/2258)
|
|
57
|
-
* Write initial Mesa Migration guide by @EwoutH in [#2257](https://github.com/projectmesa/mesa/pull/2257)
|
|
58
|
-
* Docs: Fix broken relative links by removing `.html` suffix by @EwoutH in [#2274](https://github.com/projectmesa/mesa/pull/2274)
|
|
59
|
-
* Readthedocs: Don't let notebook failures pass silently by @EwoutH in [#2276](https://github.com/projectmesa/mesa/pull/2276)
|
|
60
|
-
* update migration guide to describe solaraviz updates by @Corvince in [#2297](https://github.com/projectmesa/mesa/pull/2297)
|
|
61
|
-
* Migration Guide: Add Model initialization requirement and automatic Agent.unique_id assignment by @EwoutH in [#2302](https://github.com/projectmesa/mesa/pull/2302)
|
|
62
|
-
|
|
63
|
-
### 🔧 Maintenance
|
|
64
|
-
* make typing behavior of AgentSet.get explicit by @quaquel in [#2293](https://github.com/projectmesa/mesa/pull/2293)
|
|
65
|
-
|
|
66
|
-
**Full Changelog**: [https://github.com/projectmesa/mesa/compare/v2.3.4...v2.4.0](https://github.com/projectmesa/mesa/compare/v2.3.4...v2.4.0)
|
|
67
|
-
|
|
68
|
-
# 2.3.4 (2024-09-04)
|
|
69
|
-
## Highlights
|
|
70
|
-
Two fixes in our docs: The visualization tutorial started using an example model that wasn't compatible with Mesa 2.x anymore, and some relative links were broken. This release fixes both.
|
|
71
|
-
|
|
72
|
-
## What's Changed
|
|
73
|
-
### 📜 Documentation improvements
|
|
74
|
-
* docs: Fix Visualization Tutorial (2.x branch) by @EwoutH in https://github.com/projectmesa/mesa/pull/2272
|
|
75
|
-
* Docs: Fix broken relative links by removing `.html` suffix by @EwoutH in https://github.com/projectmesa/mesa/pull/2274
|
|
76
|
-
|
|
77
|
-
**Full Changelog**: https://github.com/projectmesa/mesa/compare/v2.3.3...v2.3.4
|
|
78
|
-
|
|
79
|
-
# 2.3.3 (2024-09-01)
|
|
80
|
-
## Highlights
|
|
81
|
-
Mesa v2.3.3 is a small patch release with documentation and maintenance updates backported from our main branch.
|
|
82
|
-
|
|
83
|
-
We do have included one feature as preview for Mesa 3.0: The AgentSet got a convenient `set` method to quickly set a variable value to (a subset of) agents. See #2254 for some examples.
|
|
84
|
-
|
|
85
|
-
## What's Changed
|
|
86
|
-
### 🎉 New features added
|
|
87
|
-
* AgentSet: Add `set` method by @EwoutH in https://github.com/projectmesa/mesa/pull/2254
|
|
25
|
+
* Jupyter_viz: Allow measures to be None by @EwoutH in https://github.com/projectmesa/mesa/pull/2163
|
|
26
|
+
* Jupyter Viz: Don't avoid interactive backend by @EwoutH in https://github.com/projectmesa/mesa/pull/2165
|
|
88
27
|
### 📜 Documentation improvements
|
|
89
28
|
* Fix image on landing page of docs. by @jackiekazil in https://github.com/projectmesa/mesa/pull/2146
|
|
90
29
|
* Replace links in docs - google group to matrix. by @jackiekazil in https://github.com/projectmesa/mesa/pull/2148
|
|
91
|
-
* Add experimental features to documentation as per #2122 by @stephenfmann in https://github.com/projectmesa/mesa/pull/2154
|
|
92
30
|
* Update visualisation docs by @EwoutH in https://github.com/projectmesa/mesa/pull/2162
|
|
93
|
-
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
|
|
97
|
-
**Full Changelog**: https://github.com/projectmesa/mesa/compare/v2.3.2...v2.3.3
|
|
98
|
-
|
|
99
|
-
# 2.3.2 (2024-07-22)
|
|
100
|
-
## Highlights
|
|
101
|
-
Mesa 2.3.2 is a small patch release which fixes two bugs, one to the batch_run function still depending on `schedule.steps`, and one in the agent marker visualisation.
|
|
31
|
+
### 🔧 Maintenance
|
|
32
|
+
* CI: Add weekly scheduled run to all CI workflows by @EwoutH in https://github.com/projectmesa/mesa/pull/2130
|
|
33
|
+
* Drop support for Python 3.9, require Python >= 3.10 by @EwoutH in https://github.com/projectmesa/mesa/pull/2132
|
|
34
|
+
* Add script to list unlabeled PR's since latest release by @rht in https://github.com/projectmesa/mesa/pull/2047
|
|
102
35
|
|
|
103
|
-
##
|
|
104
|
-
|
|
105
|
-
* fix: Render agent marker radius correctly by @rht in https://github.com/projectmesa/mesa/pull/2181
|
|
106
|
-
* fix: Use model.schedule.steps -> mode._steps for batch_run by @rht in https://github.com/projectmesa/mesa/pull/2183
|
|
36
|
+
## New Contributors
|
|
37
|
+
* @stephenfmann made their first contribution in https://github.com/projectmesa/mesa/pull/2154
|
|
107
38
|
|
|
108
|
-
**Full Changelog**: https://github.com/projectmesa/mesa/compare/v2.3.1...
|
|
39
|
+
**Full Changelog**: https://github.com/projectmesa/mesa/compare/v2.3.1...v3.0.0a0
|
|
109
40
|
|
|
110
41
|
# 2.3.1 (2024-07-03)
|
|
111
42
|
## Highlights
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: Mesa
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.0a0
|
|
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
|
|
@@ -14,25 +14,23 @@ Classifier: License :: OSI Approved :: Apache Software License
|
|
|
14
14
|
Classifier: Natural Language :: English
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
16
16
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
22
20
|
Classifier: Topic :: Scientific/Engineering
|
|
23
21
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
24
22
|
Classifier: Topic :: Scientific/Engineering :: Artificial Life
|
|
25
|
-
Requires-Python: >=3.
|
|
23
|
+
Requires-Python: >=3.10
|
|
26
24
|
Requires-Dist: click
|
|
27
25
|
Requires-Dist: cookiecutter
|
|
28
26
|
Requires-Dist: matplotlib
|
|
29
|
-
Requires-Dist: mesa-viz-tornado>=0.1.3,~=0.1.0
|
|
30
27
|
Requires-Dist: networkx
|
|
31
28
|
Requires-Dist: numpy
|
|
32
29
|
Requires-Dist: pandas
|
|
33
30
|
Requires-Dist: solara
|
|
34
31
|
Requires-Dist: tqdm
|
|
35
32
|
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: coverage; extra == 'dev'
|
|
36
34
|
Requires-Dist: pytest-cov; extra == 'dev'
|
|
37
35
|
Requires-Dist: pytest-mock; extra == 'dev'
|
|
38
36
|
Requires-Dist: pytest>=4.6; extra == 'dev'
|
|
@@ -56,8 +54,6 @@ Description-Content-Type: text/markdown
|
|
|
56
54
|
| Meta | [](https://github.com/astral-sh/ruff) [](https://github.com/psf/black) [](https://github.com/pypa/hatch) |
|
|
57
55
|
| Chat | [](https://matrix.to/#/#project-mesa:matrix.org) |
|
|
58
56
|
|
|
59
|
-
*This is the `2.4.x-maintenance` branch. Example models for Mesa 2.x can be found [here](https://github.com/projectmesa/mesa-examples/tree/mesa-2.x/examples).*
|
|
60
|
-
|
|
61
57
|
Mesa allows users to quickly create agent-based models using built-in
|
|
62
58
|
core components (such as spatial grids and agent schedulers) or
|
|
63
59
|
customized implementations; visualize them using a browser-based
|
|
@@ -97,18 +93,15 @@ Or any other (development) branch on this repo or your own fork:
|
|
|
97
93
|
pip install -U -e git+https://github.com/YOUR_FORK/mesa@YOUR_BRANCH#egg=mesa
|
|
98
94
|
```
|
|
99
95
|
|
|
100
|
-
## Resources
|
|
101
96
|
For resources or help on using Mesa, check out the following:
|
|
102
97
|
|
|
103
98
|
- [Intro to Mesa Tutorial](http://mesa.readthedocs.org/en/stable/tutorials/intro_tutorial.html) (An introductory model, the Boltzmann
|
|
104
99
|
Wealth Model, for beginners or those new to Mesa.)
|
|
105
|
-
- [Visualization Tutorial](https://mesa.readthedocs.io/stable/tutorials/visualization_tutorial.html) (An introduction into our Solara visualization)
|
|
106
100
|
- [Complexity Explorer Tutorial](https://www.complexityexplorer.org/courses/172-agent-based-models-with-python-an-introduction-to-mesa) (An advanced-beginner model,
|
|
107
101
|
SugarScape with Traders, with instructional videos)
|
|
108
|
-
- [Mesa Examples](https://github.com/projectmesa/mesa-examples/tree/
|
|
102
|
+
- [Mesa Examples](https://github.com/projectmesa/mesa-examples/tree/main/examples) (A repository of seminal ABMs using Mesa and
|
|
109
103
|
examples of employing specific Mesa Features)
|
|
110
104
|
- [Docs](http://mesa.readthedocs.org/) (Mesa's documentation, API and useful snippets)
|
|
111
|
-
- [Development version docs](https://mesa.readthedocs.io/latest/) (the latest version docs if you're using a pre-release Mesa version)
|
|
112
105
|
- [Discussions](https://github.com/projectmesa/mesa/discussions) (GitHub threaded discussions about Mesa)
|
|
113
106
|
- [Matrix Chat](https://matrix.to/#/#project-mesa:matrix.org) (Chat Forum via Matrix to talk about Mesa)
|
|
114
107
|
|
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
| Meta | [](https://github.com/astral-sh/ruff) [](https://github.com/psf/black) [](https://github.com/pypa/hatch) |
|
|
8
8
|
| Chat | [](https://matrix.to/#/#project-mesa:matrix.org) |
|
|
9
9
|
|
|
10
|
-
*This is the `2.4.x-maintenance` branch. Example models for Mesa 2.x can be found [here](https://github.com/projectmesa/mesa-examples/tree/mesa-2.x/examples).*
|
|
11
|
-
|
|
12
10
|
Mesa allows users to quickly create agent-based models using built-in
|
|
13
11
|
core components (such as spatial grids and agent schedulers) or
|
|
14
12
|
customized implementations; visualize them using a browser-based
|
|
@@ -48,18 +46,15 @@ Or any other (development) branch on this repo or your own fork:
|
|
|
48
46
|
pip install -U -e git+https://github.com/YOUR_FORK/mesa@YOUR_BRANCH#egg=mesa
|
|
49
47
|
```
|
|
50
48
|
|
|
51
|
-
## Resources
|
|
52
49
|
For resources or help on using Mesa, check out the following:
|
|
53
50
|
|
|
54
51
|
- [Intro to Mesa Tutorial](http://mesa.readthedocs.org/en/stable/tutorials/intro_tutorial.html) (An introductory model, the Boltzmann
|
|
55
52
|
Wealth Model, for beginners or those new to Mesa.)
|
|
56
|
-
- [Visualization Tutorial](https://mesa.readthedocs.io/stable/tutorials/visualization_tutorial.html) (An introduction into our Solara visualization)
|
|
57
53
|
- [Complexity Explorer Tutorial](https://www.complexityexplorer.org/courses/172-agent-based-models-with-python-an-introduction-to-mesa) (An advanced-beginner model,
|
|
58
54
|
SugarScape with Traders, with instructional videos)
|
|
59
|
-
- [Mesa Examples](https://github.com/projectmesa/mesa-examples/tree/
|
|
55
|
+
- [Mesa Examples](https://github.com/projectmesa/mesa-examples/tree/main/examples) (A repository of seminal ABMs using Mesa and
|
|
60
56
|
examples of employing specific Mesa Features)
|
|
61
57
|
- [Docs](http://mesa.readthedocs.org/) (Mesa's documentation, API and useful snippets)
|
|
62
|
-
- [Development version docs](https://mesa.readthedocs.io/latest/) (the latest version docs if you're using a pre-release Mesa version)
|
|
63
58
|
- [Discussions](https://github.com/projectmesa/mesa/discussions) (GitHub threaded discussions about Mesa)
|
|
64
59
|
- [Matrix Chat](https://matrix.to/#/#project-mesa:matrix.org) (Chat Forum via Matrix to talk about Mesa)
|
|
65
60
|
|
|
@@ -227,9 +227,8 @@ class WolfSheep(Model):
|
|
|
227
227
|
patch.move_to(cell)
|
|
228
228
|
|
|
229
229
|
def step(self):
|
|
230
|
-
"
|
|
231
|
-
self.
|
|
232
|
-
self.agents_by_type[Wolf].shuffle_do("step")
|
|
230
|
+
self.get_agents_of_type(Sheep).shuffle(inplace=True).do("step")
|
|
231
|
+
self.get_agents_of_type(Wolf).shuffle(inplace=True).do("step")
|
|
233
232
|
|
|
234
233
|
|
|
235
234
|
if __name__ == "__main__":
|
|
@@ -0,0 +1,21 @@
|
|
|
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.jupyter_viz
|
|
9
|
+
:members:
|
|
10
|
+
:undoc-members:
|
|
11
|
+
:show-inheritance:
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## User Parameters
|
|
15
|
+
|
|
16
|
+
```{eval-rst}
|
|
17
|
+
.. automodule:: mesa.visualization.UserParam
|
|
18
|
+
:members:
|
|
19
|
+
:undoc-members:
|
|
20
|
+
:show-inheritance:
|
|
21
|
+
```
|
|
@@ -113,8 +113,6 @@ pygments_style = "gruvbox-dark"
|
|
|
113
113
|
|
|
114
114
|
nb_execution_timeout = 60
|
|
115
115
|
nb_execution_mode = "cache"
|
|
116
|
-
nb_execution_allow_errors = False
|
|
117
|
-
nb_execution_raise_on_error = True
|
|
118
116
|
|
|
119
117
|
# -- Options for HTML output ----------------------------------------------
|
|
120
118
|
|
|
@@ -125,13 +123,7 @@ html_theme = "pydata_sphinx_theme"
|
|
|
125
123
|
# Theme options are theme-specific and customize the look and feel of a theme
|
|
126
124
|
# further. For a list of options available for each theme, see the
|
|
127
125
|
# documentation.
|
|
128
|
-
html_theme_options = {
|
|
129
|
-
"navbar_start": ["navbar-logo", "version-switcher"], # Show switcher in navbar
|
|
130
|
-
"switcher": {
|
|
131
|
-
"json_url": "https://mesa.readthedocs.io/latest/_static/switcher.json", # URL of your switcher.json file
|
|
132
|
-
"version_match": version # Automatically matches the current version
|
|
133
|
-
}
|
|
134
|
-
}
|
|
126
|
+
# html_theme_options = {}
|
|
135
127
|
|
|
136
128
|
# Add any paths that contain custom themes here, relative to this directory.
|
|
137
129
|
# html_theme_path = []
|
|
@@ -287,4 +279,4 @@ texinfo_documents = [
|
|
|
287
279
|
|
|
288
280
|
|
|
289
281
|
# Example configuration for intersphinx: refer to the Python standard library.
|
|
290
|
-
intersphinx_mapping = {
|
|
282
|
+
intersphinx_mapping = {"http://docs.python.org/": None}
|
|
@@ -18,8 +18,6 @@
|
|
|
18
18
|
|
|
19
19
|
[Mesa] is an Apache2 licensed agent-based modeling (or ABM) framework in Python.
|
|
20
20
|
|
|
21
|
-
The original conference paper is [available here](http://conference.scipy.org.s3-website-us-east-1.amazonaws.com/proceedings/scipy2015/jacqueline_kazil.html).
|
|
22
|
-
|
|
23
21
|
Mesa allows users to quickly create agent-based models using built-in core components (such as spatial grids and agent schedulers) or customized implementations; visualize them using a browser-based interface; and analyze their results using Python's data analysis tools. Its goal is to be the Python-based counterpart to NetLogo, Repast, or MASON.
|
|
24
22
|
|
|
25
23
|
|
|
@@ -81,12 +79,10 @@ ABM features users have shared that you may want to use in your model
|
|
|
81
79
|
Mesa Overview <overview>
|
|
82
80
|
tutorials/intro_tutorial
|
|
83
81
|
tutorials/visualization_tutorial
|
|
84
|
-
Migration guide <migration_guide>
|
|
85
82
|
Best Practices <best-practices>
|
|
86
83
|
How-to Guide <howto>
|
|
87
84
|
API Documentation <apis/api_main>
|
|
88
85
|
Mesa Packages <packages>
|
|
89
|
-
tutorials/adv_tutorial_legacy.ipynb
|
|
90
86
|
```
|
|
91
87
|
|
|
92
88
|
# Indices and tables
|
|
@@ -100,7 +96,7 @@ tutorials/adv_tutorial_legacy.ipynb
|
|
|
100
96
|
[github issue tracker]: https://github.com/projectmesa/mesa/issues
|
|
101
97
|
[matrix chat room]: https://matrix.to/#/#project-mesa:matrix.org
|
|
102
98
|
[mesa]: https://github.com/projectmesa/mesa/
|
|
103
|
-
[mesa introductory tutorial]: tutorials/intro_tutorial
|
|
104
|
-
[mesa visualization tutorial]: tutorials/visualization_tutorial
|
|
99
|
+
[mesa introductory tutorial]: tutorials/intro_tutorial.html
|
|
100
|
+
[mesa visualization tutorial]: tutorials/visualization_tutorial.html
|
|
105
101
|
[pypi]: https://pypi.python.org/pypi/Mesa/
|
|
106
102
|
[ticket]: https://github.com/projectmesa/mesa/issues
|
|
@@ -17,8 +17,8 @@ Mesa is modular, meaning that its modeling, analysis and visualization component
|
|
|
17
17
|
Most models consist of one class to represent the model itself; one class (or more) for agents; a scheduler to handle time (what order the agents act in), and possibly a space for the agents to inhabit and move through. These are implemented in Mesa's modeling modules:
|
|
18
18
|
|
|
19
19
|
- `mesa.Model`, `mesa.Agent`
|
|
20
|
-
- [mesa.time](apis/time)
|
|
21
|
-
- [mesa.space](apis/space)
|
|
20
|
+
- [mesa.time](apis/time.html)
|
|
21
|
+
- [mesa.space](apis/space.html)
|
|
22
22
|
|
|
23
23
|
The skeleton of a model might look like this:
|
|
24
24
|
|
|
@@ -56,65 +56,16 @@ model = MyModel(5)
|
|
|
56
56
|
model.step()
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
You should see agents 0-4, activated in random order. See the [tutorial](tutorials/intro_tutorial) or API documentation for more detail on how to add model functionality.
|
|
59
|
+
You should see agents 0-4, activated in random order. See the [tutorial](tutorials/intro_tutorial.html) or API documentation for more detail on how to add model functionality.
|
|
60
60
|
|
|
61
61
|
To bootstrap a new model install mesa and run `mesa startproject`
|
|
62
62
|
|
|
63
|
-
### AgentSet and model.agents
|
|
64
|
-
Mesa 3.0 makes `model.agents` and the AgentSet class central in managing and activating agents.
|
|
65
|
-
|
|
66
|
-
#### model.agents
|
|
67
|
-
`model.agents` is an AgentSet containing all agents in the model. It's automatically updated when agents are added or removed:
|
|
68
|
-
|
|
69
|
-
```python
|
|
70
|
-
# Get total number of agents
|
|
71
|
-
num_agents = len(model.agents)
|
|
72
|
-
|
|
73
|
-
# Iterate over all agents
|
|
74
|
-
for agent in model.agents:
|
|
75
|
-
print(agent.unique_id)
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
#### AgentSet Functionality
|
|
79
|
-
AgentSet offers several methods for efficient agent management:
|
|
80
|
-
|
|
81
|
-
1. **Selecting**: Filter agents based on criteria.
|
|
82
|
-
```python
|
|
83
|
-
high_energy_agents = model.agents.select(lambda a: a.energy > 50)
|
|
84
|
-
```
|
|
85
|
-
2. **Shuffling and Sorting**: Randomize or order agents.
|
|
86
|
-
```python
|
|
87
|
-
shuffled_agents = model.agents.shuffle()
|
|
88
|
-
sorted_agents = model.agents.sort(key="energy", ascending=False)
|
|
89
|
-
```
|
|
90
|
-
3. **Applying methods**: Execute methods on all agents.
|
|
91
|
-
```python
|
|
92
|
-
model.agents.do("step")
|
|
93
|
-
model.agents.shuffle_do("move") # Shuffle then apply method
|
|
94
|
-
```
|
|
95
|
-
4. **Aggregating**: Compute aggregate values across agents.
|
|
96
|
-
```python
|
|
97
|
-
avg_energy = model.agents.agg("energy", func=np.mean)
|
|
98
|
-
```
|
|
99
|
-
5. **Grouping**: Group agents by attributes.
|
|
100
|
-
```python
|
|
101
|
-
grouped_agents = model.agents.groupby("species")
|
|
102
|
-
|
|
103
|
-
for _, agent_group in grouped_agents:
|
|
104
|
-
agent_group.shuffle_do()
|
|
105
|
-
species_counts = grouped_agents.count()
|
|
106
|
-
mean_age_by_group = grouped_agents.agg("age", np.mean)
|
|
107
|
-
```
|
|
108
|
-
`model.agents` can also be accessed within a model instance using `self.agents`.
|
|
109
|
-
|
|
110
|
-
These are just some examples of using the AgentSet, there are many more possibilities
|
|
111
|
-
|
|
112
63
|
### Analysis modules
|
|
113
64
|
|
|
114
65
|
If you're using modeling for research, you'll want a way to collect the data each model run generates. You'll probably also want to run the model multiple times, to see how some output changes with different parameters. Data collection and batch running are implemented in the appropriately-named analysis modules:
|
|
115
66
|
|
|
116
|
-
- [mesa.datacollection](apis/datacollection)
|
|
117
|
-
- [mesa.batchrunner](apis/batchrunner)
|
|
67
|
+
- [mesa.datacollection](apis/datacollection.html)
|
|
68
|
+
- [mesa.batchrunner](apis/batchrunner.html)
|
|
118
69
|
|
|
119
70
|
You'd add a data collector to the model like this:
|
|
120
71
|
|
|
@@ -163,33 +114,3 @@ As with the data collector, once the runs are all over, you can extract the data
|
|
|
163
114
|
```python
|
|
164
115
|
batch_df = batch_run.get_model_vars_dataframe()
|
|
165
116
|
```
|
|
166
|
-
|
|
167
|
-
### Visualization modules
|
|
168
|
-
|
|
169
|
-
Finally, you may want to directly observe your model as it runs. Mesa's main visualization tool uses a small local web server to render the model in a browser, using JavaScript. There are different components for drawing different types of data: for example, grids for drawing agents moving around on a grid, or charts for showing how some data changes as the model runs. A few core modules are:
|
|
170
|
-
|
|
171
|
-
- mesa.visualization.ModularVisualization
|
|
172
|
-
- mesa.visualization.modules
|
|
173
|
-
|
|
174
|
-
To quickly spin up a model visualization, you might do something like:
|
|
175
|
-
|
|
176
|
-
```python
|
|
177
|
-
import mesa
|
|
178
|
-
|
|
179
|
-
def agent_portrayal(agent):
|
|
180
|
-
portrayal = {"Shape": "circle",
|
|
181
|
-
"Filled": "true",
|
|
182
|
-
"Layer": 0,
|
|
183
|
-
"Color": "red",
|
|
184
|
-
"r": 0.5}
|
|
185
|
-
return portrayal
|
|
186
|
-
|
|
187
|
-
grid = mesa.visualization.CanvasGrid(agent_portrayal, 10, 10, 500, 500)
|
|
188
|
-
server = mesa.visualization.ModularServer(MyModel,
|
|
189
|
-
[grid],
|
|
190
|
-
"My Model",
|
|
191
|
-
{'n_agents': 10})
|
|
192
|
-
server.launch()
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
This will launch the browser-based visualization, on the default port 8521.
|
|
@@ -73,9 +73,9 @@ Most likely you created an ABM that has the code that you want to share in it, w
|
|
|
73
73
|
|
|
74
74
|
**Sharing your package**
|
|
75
75
|
|
|
76
|
-
> 1. Layout a new file structure to move the code into and then make sure it is callable from Mesa, in a simple, easy to understand way. For example, `from example_package import foo`. See [Creating the Scaffolding](https://python-packaging.readthedocs.io/latest/minimal.html#creating-the-scaffolding).
|
|
76
|
+
> 1. Layout a new file structure to move the code into and then make sure it is callable from Mesa, in a simple, easy to understand way. For example, `from example_package import foo`. See [Creating the Scaffolding](https://python-packaging.readthedocs.io/en/latest/minimal.html#creating-the-scaffolding).
|
|
77
77
|
>
|
|
78
|
-
> 2. [Pick a name](https://python-packaging.readthedocs.io/latest/minimal.html#picking-a-name).
|
|
78
|
+
> 2. [Pick a name](https://python-packaging.readthedocs.io/en/latest/minimal.html#picking-a-name).
|
|
79
79
|
>
|
|
80
80
|
> 3. [Create a repo on GitHub](https://help.github.com/articles/create-a-repo/).
|
|
81
81
|
>
|