Mesa 3.0.0a4__tar.gz → 3.0.0b0__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.0a4 → mesa-3.0.0b0}/.github/workflows/build_lint.yml +1 -5
- {mesa-3.0.0a4 → mesa-3.0.0b0}/.readthedocs.yml +1 -1
- {mesa-3.0.0a4 → mesa-3.0.0b0}/CONTRIBUTING.md +1 -1
- {mesa-3.0.0a4 → mesa-3.0.0b0}/HISTORY.md +99 -3
- mesa-3.0.0b0/LICENSE +202 -0
- mesa-3.0.0a4/LICENSE → mesa-3.0.0b0/NOTICE +2 -2
- {mesa-3.0.0a4 → mesa-3.0.0b0}/PKG-INFO +55 -13
- {mesa-3.0.0a4 → mesa-3.0.0b0}/README.md +15 -4
- mesa-3.0.0b0/benchmarks/BoltzmannWealth/__init__.py +1 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/benchmarks/BoltzmannWealth/boltzmann_wealth.py +39 -4
- mesa-3.0.0b0/benchmarks/Flocking/__init__.py +1 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/benchmarks/Flocking/flocking.py +18 -24
- mesa-3.0.0b0/benchmarks/Schelling/__init__.py +1 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/benchmarks/Schelling/schelling.py +40 -31
- mesa-3.0.0b0/benchmarks/WolfSheep/__init__.py +1 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/benchmarks/WolfSheep/wolf_sheep.py +48 -66
- {mesa-3.0.0a4 → mesa-3.0.0b0}/benchmarks/compare_timings.py +13 -2
- {mesa-3.0.0a4 → mesa-3.0.0b0}/benchmarks/configurations.py +2 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/benchmarks/global_benchmark.py +19 -0
- mesa-3.0.0b0/docs/_static/switcher.json +12 -0
- mesa-3.0.0b0/docs/apis/agent.md +8 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/apis/api_main.md +2 -1
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/apis/batchrunner.md +2 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/apis/datacollection.md +2 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/apis/experimental.md +1 -5
- mesa-3.0.0b0/docs/apis/model.md +7 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/apis/space.md +2 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/apis/time.md +2 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/conf.py +11 -4
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/index.md +13 -3
- mesa-3.0.0b0/docs/migration_guide.md +313 -0
- mesa-3.0.0b0/docs/overview.md +228 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/packages.md +2 -2
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/tutorials/MoneyModel.py +19 -4
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/tutorials/intro_tutorial.ipynb +32 -32
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/tutorials/visualization_tutorial.ipynb +2 -2
- {mesa-3.0.0a4 → mesa-3.0.0b0}/maintenance/fetch_unlabeled_prs.py +2 -1
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/__init__.py +2 -3
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/agent.py +116 -85
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/batchrunner.py +22 -23
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/cookiecutter-mesa/hooks/post_gen_project.py +2 -0
- mesa-3.0.0b0/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}/__init__.py +1 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/datacollection.py +138 -27
- {mesa-3.0.0a4/mesa/visualization → mesa-3.0.0b0/mesa/experimental}/UserParam.py +17 -6
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/experimental/__init__.py +2 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/experimental/cell_space/__init__.py +14 -1
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/experimental/cell_space/cell.py +84 -23
- mesa-3.0.0b0/mesa/experimental/cell_space/cell_agent.py +133 -0
- mesa-3.0.0b0/mesa/experimental/cell_space/cell_collection.py +118 -0
- mesa-3.0.0b0/mesa/experimental/cell_space/discrete_space.py +136 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/experimental/cell_space/grid.py +19 -8
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/experimental/cell_space/network.py +9 -7
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/experimental/cell_space/voronoi.py +26 -33
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/experimental/components/altair.py +10 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/experimental/components/matplotlib.py +18 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/experimental/devs/__init__.py +2 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/experimental/devs/eventlist.py +36 -15
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/experimental/devs/examples/epstein_civil_violence.py +65 -29
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/experimental/devs/examples/wolf_sheep.py +40 -35
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/experimental/devs/simulator.py +55 -15
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/experimental/solara_viz.py +10 -19
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/main.py +6 -4
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/model.py +51 -54
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/space.py +145 -120
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/time.py +57 -67
- {mesa-3.0.0a4/mesa/experimental → mesa-3.0.0b0/mesa/visualization}/UserParam.py +19 -6
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/visualization/__init__.py +3 -2
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/visualization/components/altair.py +4 -2
- mesa-3.0.0b0/mesa/visualization/components/matplotlib.py +337 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/visualization/solara_viz.py +167 -84
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/visualization/utils.py +3 -1
- {mesa-3.0.0a4 → mesa-3.0.0b0}/pyproject.toml +24 -10
- mesa-3.0.0b0/tests/__init__.py +1 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/tests/read_requirements.py +1 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/tests/test_agent.py +137 -44
- {mesa-3.0.0a4 → mesa-3.0.0b0}/tests/test_batch_run.py +32 -20
- {mesa-3.0.0a4 → mesa-3.0.0b0}/tests/test_cell_space.py +270 -65
- mesa-3.0.0b0/tests/test_datacollector.py +356 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/tests/test_devs.py +6 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/tests/test_examples.py +7 -5
- {mesa-3.0.0a4 → mesa-3.0.0b0}/tests/test_grid.py +38 -88
- {mesa-3.0.0a4 → mesa-3.0.0b0}/tests/test_import_namespace.py +7 -2
- {mesa-3.0.0a4 → mesa-3.0.0b0}/tests/test_lifespan.py +24 -21
- {mesa-3.0.0a4 → mesa-3.0.0b0}/tests/test_model.py +11 -1
- {mesa-3.0.0a4 → mesa-3.0.0b0}/tests/test_scaffold.py +4 -5
- {mesa-3.0.0a4 → mesa-3.0.0b0}/tests/test_solara_viz.py +28 -15
- {mesa-3.0.0a4 → mesa-3.0.0b0}/tests/test_space.py +118 -172
- mesa-3.0.0a4/benchmarks/BoltzmannWealth/__init__.py +0 -0
- mesa-3.0.0a4/benchmarks/Flocking/__init__.py +0 -0
- mesa-3.0.0a4/benchmarks/Schelling/__init__.py +0 -0
- mesa-3.0.0a4/benchmarks/WolfSheep/__init__.py +0 -0
- mesa-3.0.0a4/docs/apis/init.md +0 -11
- mesa-3.0.0a4/docs/migration_guide.md +0 -67
- mesa-3.0.0a4/docs/overview.md +0 -116
- mesa-3.0.0a4/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}/__init__.py +0 -0
- mesa-3.0.0a4/mesa/experimental/cell_space/cell_agent.py +0 -37
- mesa-3.0.0a4/mesa/experimental/cell_space/cell_collection.py +0 -81
- mesa-3.0.0a4/mesa/experimental/cell_space/discrete_space.py +0 -64
- mesa-3.0.0a4/mesa/visualization/components/matplotlib.py +0 -246
- mesa-3.0.0a4/tests/__init__.py +0 -0
- mesa-3.0.0a4/tests/test_datacollector.py +0 -226
- mesa-3.0.0a4/tests/test_time.py +0 -342
- {mesa-3.0.0a4 → mesa-3.0.0b0}/.codespellignore +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/.coveragerc +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/.github/ISSUE_TEMPLATE/bug-report.md +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/.github/ISSUE_TEMPLATE/feature-request.md +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/.github/PULL_REQUEST_TEMPLATE/bug.md +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/.github/dependabot.yml +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/.github/release.yml +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/.github/workflows/benchmarks.yml +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/.github/workflows/release.yml +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/.gitignore +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/.pre-commit-config.yaml +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/CITATION.bib +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/CODE_OF_CONDUCT.md +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/Dockerfile +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/codecov.yaml +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docker-compose.yml +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/Makefile +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/README.md +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/apis/visualization.md +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/best-practices.md +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/howto.md +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/images/Mesa_Screenshot.png +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/images/mesa_logo.ico +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/images/mesa_logo.png +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/images/tutorial/br_ginis.png +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/images/tutorial/dc_endwealth.png +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/images/tutorial/dc_gini.png +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/images/tutorial/dc_oneagent.png +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/images/tutorial/first_hist.png +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/images/tutorial/multirun_hist.png +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/images/tutorial/numpy_grid.png +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/images/tutorial/viz_chart.png +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/images/tutorial/viz_empty.png +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/images/tutorial/viz_greycircles.png +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/images/tutorial/viz_histogram.png +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/images/tutorial/viz_redcircles.png +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/make.bat +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/mesa.md +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/tutorials/files/viz_chart.png +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/tutorials/files/viz_empty.png +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/tutorials/files/viz_greycircles.png +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/tutorials/files/viz_histogram.png +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/tutorials/files/viz_redcircles.png +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/docs/tutorials/files/viz_slider.png +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/cookiecutter-mesa/cookiecutter.json +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/README.md +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/app.pytemplate +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/setup.pytemplate +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}/model.pytemplate +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/mypy.ini +0 -0
- {mesa-3.0.0a4 → mesa-3.0.0b0}/tests/test_end_to_end_viz.sh +0 -0
|
@@ -53,12 +53,8 @@ jobs:
|
|
|
53
53
|
cache: 'pip'
|
|
54
54
|
- name: Install uv
|
|
55
55
|
run: pip install uv
|
|
56
|
-
- name: Install Mesa
|
|
56
|
+
- name: Install Mesa and dependencies
|
|
57
57
|
run: uv pip install --system .[dev]
|
|
58
|
-
if: matrix.python-version != '3.13'
|
|
59
|
-
- name: Install Mesa with pip
|
|
60
|
-
run: pip install .[dev]
|
|
61
|
-
if: matrix.python-version == '3.13'
|
|
62
58
|
- name: Test with pytest
|
|
63
59
|
run: pytest --durations=10 --cov=mesa tests/ --cov-report=xml
|
|
64
60
|
- if: matrix.os == 'ubuntu'
|
|
@@ -53,7 +53,7 @@ Learn the tools, talk to us about what you want to change, and open a small PR.
|
|
|
53
53
|
Awesome! You have the basics of open-source software development (if not check above), but not much modelling experience.
|
|
54
54
|
|
|
55
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/
|
|
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
57
|
- Follow an ABM course (if possible). They might be a bit outdated programming language wise, but conceptual they're sound.
|
|
58
58
|
- This MOOC on ABM concepts: [Agent Based Modeling](https://ocw.tudelft.nl/course-lectures/agent-based-modeling/)
|
|
59
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)
|
|
@@ -1,6 +1,102 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Release History
|
|
3
3
|
---
|
|
4
|
+
# 3.0.0b0 (2024-10-04)
|
|
5
|
+
## Highlights
|
|
6
|
+
We're proud to release the first Mesa 3.0 beta! This pre-release announces that we're ready for Mesa 3.0 to be tested by all our regular users. We try to not making breaking changes anymore, but focus on resolving bugs and imperfections.
|
|
7
|
+
|
|
8
|
+
In this beta, not so much has changed as in the alphas (we're stabilizing, that's a good sign), but there are still a few notable things:
|
|
9
|
+
- Agents now have to be initialized without their `unique_id`. See [#2328](https://github.com/projectmesa/mesa/pull/2328) and the [Migration guide](https://mesa.readthedocs.io/latest/migration_guide.html#automatic-assignment-of-unique-id-to-agents).
|
|
10
|
+
- PropertyLayers can now be visualized! See [#2336](https://github.com/projectmesa/mesa/pull/2336) for details and some examples, and [mesa-examples#214](https://github.com/projectmesa/mesa-examples/pull/214) as a simple example model.
|
|
11
|
+
- We reduced the core dependencies of Mesa, so that's a lighter and simpler install. You can now use extras to install the dependencies, for example add `[viz]` to install all visualisation dependencies: `pip install -U --pre mesa[viz]`. See [#2265](https://github.com/projectmesa/mesa/pull/2265) for details.
|
|
12
|
+
- The [Mesa Overview](https://mesa.readthedocs.io/latest/overview.html) as fully updated for 3.0. We highly recommend reading though it!
|
|
13
|
+
- We made some more progress on the experimental Cell Space, adding movement and integrating the PropertyLayer. Among others, Agents have nu initial movement capabilities for grids. Development continues during the betas and
|
|
14
|
+
|
|
15
|
+
We plan to release one or two more beta's in the coming weeks, and tag a release candidate and Mesa 3.0 late October. In the [v3.0 milestone](https://github.com/projectmesa/mesa/milestone/43) are the critical items on our todo-list.
|
|
16
|
+
|
|
17
|
+
You can install this pre-release as usual with:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install --upgrade --pre mesa
|
|
21
|
+
```
|
|
22
|
+
We're very curious what you think, try it out and ask any questions or share any feedback [here](https://github.com/projectmesa/mesa/discussions/2338)!
|
|
23
|
+
|
|
24
|
+
## What's Changed
|
|
25
|
+
### ⚠️ Breaking changes
|
|
26
|
+
* update `Agent.__init__` to remove deprecation warning by @quaquel in https://github.com/projectmesa/mesa/pull/2328
|
|
27
|
+
### 🎉 New features added
|
|
28
|
+
* Visualize PropertyLayers by @EwoutH in https://github.com/projectmesa/mesa/pull/2336
|
|
29
|
+
### 🧪 Experimental features
|
|
30
|
+
* Encapsulate cell movement in properties by @quaquel in https://github.com/projectmesa/mesa/pull/2333
|
|
31
|
+
* experimental: Integrate PropertyLayers into cell space by @EwoutH in https://github.com/projectmesa/mesa/pull/2319
|
|
32
|
+
* Generalize CellAgent by @Corvince in https://github.com/projectmesa/mesa/pull/2292
|
|
33
|
+
### 🛠 Enhancements made
|
|
34
|
+
* Reduce core dependencies, split in optional dependencies by @EwoutH in https://github.com/projectmesa/mesa/pull/2265
|
|
35
|
+
### 🐛 Bugs fixed
|
|
36
|
+
* viz: stop running and disable buttons when model.running is False by @wang-boyu in https://github.com/projectmesa/mesa/pull/2332
|
|
37
|
+
### 📜 Documentation improvements
|
|
38
|
+
* docs: Update overview for Mesa 3.0 by @EwoutH in https://github.com/projectmesa/mesa/pull/2317
|
|
39
|
+
* Readthedocs: Add version switch and update URL by @EwoutH in https://github.com/projectmesa/mesa/pull/2324
|
|
40
|
+
### 🔧 Maintenance
|
|
41
|
+
* tests: Resolve warnings by removing scheduler and updating arguments by @EwoutH in https://github.com/projectmesa/mesa/pull/2329
|
|
42
|
+
* add super call to Model and remove self.schedule by @quaquel in https://github.com/projectmesa/mesa/pull/2334
|
|
43
|
+
### Other changes
|
|
44
|
+
* Deprecate `initialize_data_collector` by @EwoutH in https://github.com/projectmesa/mesa/pull/2327
|
|
45
|
+
|
|
46
|
+
**Full Changelog**: https://github.com/projectmesa/mesa/compare/v3.0.0a5...v3.0.0b0
|
|
47
|
+
|
|
48
|
+
# 3.0.0a5 (2024-09-21)
|
|
49
|
+
## Highlights
|
|
50
|
+
Mesa v3.0 alpha 5 release contains many quality of life updates, a big new feature for the DataCollector and a major deprecation.
|
|
51
|
+
|
|
52
|
+
The entire `mesa.time` module, including all schedulers, has been deprecated ([#2306](https://github.com/projectmesa/mesa/pull/2306)). Users are encouraged to transition to AgentSet functionality for more flexible and explicit agent activation patterns. Check the [migration guide](https://mesa.readthedocs.io/latest/migration_guide.html#time-and-schedulers) on how to upgrade.
|
|
53
|
+
|
|
54
|
+
The DataCollector now supports collecting data from specific Agent subclasses using the new `agenttype_reporters` parameter ([#2300](https://github.com/projectmesa/mesa/pull/2300)). This allows collecting different metrics for different agent types. For example:
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
self.datacollector = DataCollector(
|
|
58
|
+
agenttype_reporters={
|
|
59
|
+
Wolf: {"sheep_eaten": "sheep_eaten"},
|
|
60
|
+
Sheep: {"wool": "wool_amount"}
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Furthermore, a new `shuffle_do()` method for AgentSets provides a faster way to perform `shuffle().do()` ([#2283](https://github.com/projectmesa/mesa/pull/2283)). The GroupBy class gained `count()` and `agg()` methods to count the number of agents in groups and aggregate variables of them ([#2290](https://github.com/projectmesa/mesa/pull/2290)).
|
|
66
|
+
|
|
67
|
+
In the experimental Cell Space, the `CellCollection.select` method was updated to use `at_most` instead of `n`, aligning with the AgentSet API ([#2307](https://github.com/projectmesa/mesa/pull/2307)). Additionally, the Cell class now features a dedicated `neighborhood` property for direct neighbors (default radius=1) and a `get_neighborhood` method for larger radii ([#2309](https://github.com/projectmesa/mesa/pull/2309)).
|
|
68
|
+
|
|
69
|
+
Finally, SolaraViz received updates improving its interface and performance ([#2299](https://github.com/projectmesa/mesa/pull/2299), [#2304](https://github.com/projectmesa/mesa/pull/2304)). Cell connections in grids and networks are now public and named for more intuitive agent movements ([#2296](https://github.com/projectmesa/mesa/pull/2296)). The Model class initialization process was simplified by moving random seed and random object creation to `__init__` ([#1940](https://github.com/projectmesa/mesa/pull/1940)). Documentation has been extensively updated, including enforcing Google docstrings ([#2294](https://github.com/projectmesa/mesa/pull/2294)) and reorganizing the API documentation ([#2298](https://github.com/projectmesa/mesa/pull/2298)) for better clarity and navigation.
|
|
70
|
+
|
|
71
|
+
While the Mesa 3.0 timeline is still being discussed, we're aiming at the first Mesa 3.0 beta in October followed by a stable release in November. Testing new features and sharing feedback is appreciated!
|
|
72
|
+
|
|
73
|
+
## What's Changed
|
|
74
|
+
### 🎉 New features added
|
|
75
|
+
* GroupBy: Add `count` and `agg` methods by @EwoutH in https://github.com/projectmesa/mesa/pull/2290
|
|
76
|
+
* datacollector: Allow collecting data from Agent (sub)classes by @EwoutH in https://github.com/projectmesa/mesa/pull/2300
|
|
77
|
+
* Add optimized shuffle_do() method to AgentSet by @EwoutH in https://github.com/projectmesa/mesa/pull/2283
|
|
78
|
+
### 🛠 Enhancements made
|
|
79
|
+
* Make cell connections public and named by @Corvince in https://github.com/projectmesa/mesa/pull/2296
|
|
80
|
+
* SolaraViz Updates by @Corvince in https://github.com/projectmesa/mesa/pull/2299
|
|
81
|
+
* Solara viz: use_task for non-threaded continuous play by @Corvince in https://github.com/projectmesa/mesa/pull/2304
|
|
82
|
+
### 🧪 Experimental features
|
|
83
|
+
* Update to CellCollection.select by @quaquel in https://github.com/projectmesa/mesa/pull/2307
|
|
84
|
+
* Have a dedicated neighborhood property and a get_neighborhood method on Cell by @quaquel in https://github.com/projectmesa/mesa/pull/2309
|
|
85
|
+
### 📜 Documentation improvements
|
|
86
|
+
* Enforce google docstrings by @quaquel in https://github.com/projectmesa/mesa/pull/2294
|
|
87
|
+
* Api docs by @quaquel in https://github.com/projectmesa/mesa/pull/2298
|
|
88
|
+
* update migration guide to describe solaraviz updates by @Corvince in https://github.com/projectmesa/mesa/pull/2297
|
|
89
|
+
* Migration Guide: Add Model initialization requirement and automatic Agent.unique_id assignment by @EwoutH in https://github.com/projectmesa/mesa/pull/2302
|
|
90
|
+
* Deprecate Time module and all its Schedulers by @EwoutH in https://github.com/projectmesa/mesa/pull/2306
|
|
91
|
+
* intro_tutorial: Don't initialize agents with an unique_id by @EwoutH in https://github.com/projectmesa/mesa/pull/2315
|
|
92
|
+
* Migration guide: Intro, upgrade strategy, model.agents, headers by @EwoutH in https://github.com/projectmesa/mesa/pull/2314
|
|
93
|
+
### 🔧 Maintenance
|
|
94
|
+
* make typing behavior of AgentSet.get explicit by @quaquel in https://github.com/projectmesa/mesa/pull/2293
|
|
95
|
+
* model: Move random seed and random to __init__ by @rht in https://github.com/projectmesa/mesa/pull/1940
|
|
96
|
+
* Remove schedulers from benchmark models. by @quaquel in https://github.com/projectmesa/mesa/pull/2308
|
|
97
|
+
|
|
98
|
+
**Full Changelog**: https://github.com/projectmesa/mesa/compare/v3.0.0a4...v3.0.0a5
|
|
99
|
+
|
|
4
100
|
# 3.0.0a4 (2024-09-09)
|
|
5
101
|
## Highlights
|
|
6
102
|
Mesa 3.0.0a4 contains two major breaking changes:
|
|
@@ -19,7 +115,7 @@ Mesa 3.0.0a4 contains two major breaking changes:
|
|
|
19
115
|
Example models were updated in [mesa-examples#194](https://github.com/projectmesa/mesa-examples/pull/194), which shows more examples on how to update existing models.
|
|
20
116
|
|
|
21
117
|
2. Our visualisation API is being overhauled, to be more flexible and powerful. For more details, see [#2278](https://github.com/projectmesa/mesa/pull/2278).
|
|
22
|
-
- An initial update to the tutorial was made in [#2289](https://github.com/projectmesa/mesa/pull/2289) and is [available here](https://mesa.readthedocs.io/
|
|
118
|
+
- An initial update to the tutorial was made in [#2289](https://github.com/projectmesa/mesa/pull/2289) and is [available here](https://mesa.readthedocs.io/latest/tutorials/visualization_tutorial.html).
|
|
23
119
|
- An initial example model was updated in [mesa-examples#195](https://github.com/projectmesa/mesa-examples/pull/195), and more examples will be updated in [mesa-examples#195](https://github.com/projectmesa/mesa-examples/pull/193).
|
|
24
120
|
- The old SolaraViz API is still available at `mesa.experimental`, but might be removed in future releases.
|
|
25
121
|
|
|
@@ -70,7 +166,7 @@ Our example models also got more love: We removed the `RandomActivation` schedul
|
|
|
70
166
|
|
|
71
167
|
Finally, we have two brand new examples: An Ant Colony Optimization model using an Ant System approach to the Traveling Salesman problem, a Mesa NetworkGrid, and a custom visualisation with SolaraViz ([examples#157](https://github.com/projectmesa/mesa-examples/pull/157) by @zjost). The first example using the `PropertyLayer` was added, a very fast implementation of Conway's Game of Life ([examples#182](https://github.com/projectmesa/mesa-examples/pull/182)).
|
|
72
168
|
|
|
73
|
-
To help the transition to Mesa 3.0, we started writing a [migration guide](https://mesa.readthedocs.io/
|
|
169
|
+
To help the transition to Mesa 3.0, we started writing a [migration guide](https://mesa.readthedocs.io/latest/migration_guide.html). Progress is tracked in #2233, feedback and help is appreciated! Finally, we also added a new section to our [contributor guide](https://github.com/projectmesa/mesa/blob/main/CONTRIBUTING.md#i-have-no-idea-where-to-start) to get new contributors up to speed.
|
|
74
170
|
|
|
75
171
|
This pre-release can be installed as always with `pip install --pre mesa`
|
|
76
172
|
|
|
@@ -161,7 +257,7 @@ This is the first pre-release in the Mesa 3.0 series, which is still in active d
|
|
|
161
257
|
Since it's in active development, more breaking changes may follow and it's not recommended for general usage.
|
|
162
258
|
|
|
163
259
|
There are two major breaking changes at this point:
|
|
164
|
-
- 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/
|
|
260
|
+
- 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/latest/tutorials/visualization_tutorial.html). More examples and a migration guide will follow later in the Mesa 3.0 development.
|
|
165
261
|
- The `mesa.flat` namespace is removed, since was not used very often.
|
|
166
262
|
|
|
167
263
|
Mesa 3.0 will require Python 3.10+.
|
mesa-3.0.0b0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
Copyright
|
|
1
|
+
Copyright 2014-2024 Core Mesa Team and contributors
|
|
2
2
|
|
|
3
3
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
you may not use this file except in compliance with the License.
|
|
5
5
|
You may obtain a copy of the License at
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
8
8
|
|
|
9
9
|
Unless required by applicable law or agreed to in writing, software
|
|
10
10
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: Mesa
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.0b0
|
|
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
9
|
License-File: LICENSE
|
|
10
|
+
License-File: NOTICE
|
|
10
11
|
Keywords: ABM,agent,based,model,modeling,multi-agent,simulation
|
|
11
12
|
Classifier: Development Status :: 3 - Alpha
|
|
12
13
|
Classifier: Intended Audience :: Science/Research
|
|
@@ -22,30 +23,60 @@ Classifier: Topic :: Scientific/Engineering
|
|
|
22
23
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
24
|
Classifier: Topic :: Scientific/Engineering :: Artificial Life
|
|
24
25
|
Requires-Python: >=3.10
|
|
25
|
-
Requires-Dist: click
|
|
26
|
-
Requires-Dist: cookiecutter
|
|
27
|
-
Requires-Dist: matplotlib
|
|
28
|
-
Requires-Dist: networkx
|
|
29
26
|
Requires-Dist: numpy
|
|
30
27
|
Requires-Dist: pandas
|
|
31
|
-
Requires-Dist: solara
|
|
32
28
|
Requires-Dist: tqdm
|
|
29
|
+
Provides-Extra: all
|
|
30
|
+
Requires-Dist: cookiecutter; extra == 'all'
|
|
31
|
+
Requires-Dist: ipython; extra == 'all'
|
|
32
|
+
Requires-Dist: matplotlib; extra == 'all'
|
|
33
|
+
Requires-Dist: myst-nb; extra == 'all'
|
|
34
|
+
Requires-Dist: myst-parser; extra == 'all'
|
|
35
|
+
Requires-Dist: networkx; extra == 'all'
|
|
36
|
+
Requires-Dist: pydata-sphinx-theme; extra == 'all'
|
|
37
|
+
Requires-Dist: pytest; extra == 'all'
|
|
38
|
+
Requires-Dist: pytest-cov; extra == 'all'
|
|
39
|
+
Requires-Dist: pytest-mock; extra == 'all'
|
|
40
|
+
Requires-Dist: ruff; extra == 'all'
|
|
41
|
+
Requires-Dist: scipy; extra == 'all'
|
|
42
|
+
Requires-Dist: seaborn; extra == 'all'
|
|
43
|
+
Requires-Dist: solara; extra == 'all'
|
|
44
|
+
Requires-Dist: sphinx; extra == 'all'
|
|
33
45
|
Provides-Extra: dev
|
|
46
|
+
Requires-Dist: cookiecutter; extra == 'dev'
|
|
47
|
+
Requires-Dist: matplotlib; extra == 'dev'
|
|
48
|
+
Requires-Dist: networkx; extra == 'dev'
|
|
49
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
34
50
|
Requires-Dist: pytest-cov; extra == 'dev'
|
|
35
51
|
Requires-Dist: pytest-mock; extra == 'dev'
|
|
36
|
-
Requires-Dist:
|
|
37
|
-
Requires-Dist:
|
|
52
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
53
|
+
Requires-Dist: solara; extra == 'dev'
|
|
38
54
|
Requires-Dist: sphinx; extra == 'dev'
|
|
39
55
|
Provides-Extra: docs
|
|
40
56
|
Requires-Dist: ipython; extra == 'docs'
|
|
57
|
+
Requires-Dist: matplotlib; extra == 'docs'
|
|
41
58
|
Requires-Dist: myst-nb; extra == 'docs'
|
|
42
59
|
Requires-Dist: myst-parser; extra == 'docs'
|
|
60
|
+
Requires-Dist: networkx; extra == 'docs'
|
|
43
61
|
Requires-Dist: pydata-sphinx-theme; extra == 'docs'
|
|
44
62
|
Requires-Dist: seaborn; extra == 'docs'
|
|
63
|
+
Requires-Dist: solara; extra == 'docs'
|
|
45
64
|
Requires-Dist: sphinx; extra == 'docs'
|
|
46
65
|
Provides-Extra: examples
|
|
47
|
-
Requires-Dist:
|
|
66
|
+
Requires-Dist: matplotlib; extra == 'examples'
|
|
67
|
+
Requires-Dist: networkx; extra == 'examples'
|
|
68
|
+
Requires-Dist: pytest; extra == 'examples'
|
|
48
69
|
Requires-Dist: scipy; extra == 'examples'
|
|
70
|
+
Requires-Dist: solara; extra == 'examples'
|
|
71
|
+
Provides-Extra: network
|
|
72
|
+
Requires-Dist: networkx; extra == 'network'
|
|
73
|
+
Provides-Extra: rec
|
|
74
|
+
Requires-Dist: matplotlib; extra == 'rec'
|
|
75
|
+
Requires-Dist: networkx; extra == 'rec'
|
|
76
|
+
Requires-Dist: solara; extra == 'rec'
|
|
77
|
+
Provides-Extra: viz
|
|
78
|
+
Requires-Dist: matplotlib; extra == 'viz'
|
|
79
|
+
Requires-Dist: solara; extra == 'viz'
|
|
49
80
|
Description-Content-Type: text/markdown
|
|
50
81
|
|
|
51
82
|
# Mesa: Agent-based modeling in Python
|
|
@@ -78,7 +109,7 @@ can be displayed in browser windows or Jupyter.*
|
|
|
78
109
|
|
|
79
110
|
## Using Mesa
|
|
80
111
|
|
|
81
|
-
To install our latest stable release (2.
|
|
112
|
+
To install our latest stable release (2.4.x), run:
|
|
82
113
|
|
|
83
114
|
``` bash
|
|
84
115
|
pip install -U mesa
|
|
@@ -89,6 +120,17 @@ To install our latest pre-release (3.0.0 alpha), run:
|
|
|
89
120
|
``` bash
|
|
90
121
|
pip install -U --pre mesa
|
|
91
122
|
```
|
|
123
|
+
With Mesa 3.0, we don't install all our dependencies anymore by default.
|
|
124
|
+
```bash
|
|
125
|
+
# You can customize the additional dependencies you need, if you want. Available are:
|
|
126
|
+
pip install -U --pre mesa[network,viz]
|
|
127
|
+
|
|
128
|
+
# This is equivalent to our recommended dependencies:
|
|
129
|
+
pip install -U --pre mesa[rec]
|
|
130
|
+
|
|
131
|
+
# To install all, including developer, dependencies:
|
|
132
|
+
pip install -U --pre mesa[all]
|
|
133
|
+
```
|
|
92
134
|
|
|
93
135
|
You can also use `pip` to install the latest GitHub version:
|
|
94
136
|
|
|
@@ -107,13 +149,13 @@ For resources or help on using Mesa, check out the following:
|
|
|
107
149
|
|
|
108
150
|
- [Intro to Mesa Tutorial](http://mesa.readthedocs.org/en/stable/tutorials/intro_tutorial.html) (An introductory model, the Boltzmann
|
|
109
151
|
Wealth Model, for beginners or those new to Mesa.)
|
|
110
|
-
- [Visualization Tutorial](https://mesa.readthedocs.io/
|
|
152
|
+
- [Visualization Tutorial](https://mesa.readthedocs.io/stable/tutorials/visualization_tutorial.html) (An introduction into our Solara visualization)
|
|
111
153
|
- [Complexity Explorer Tutorial](https://www.complexityexplorer.org/courses/172-agent-based-models-with-python-an-introduction-to-mesa) (An advanced-beginner model,
|
|
112
154
|
SugarScape with Traders, with instructional videos)
|
|
113
|
-
- [Mesa Examples](https://github.com/projectmesa/mesa-examples
|
|
155
|
+
- [Mesa Examples](https://github.com/projectmesa/mesa-examples) (A repository of seminal ABMs using Mesa and
|
|
114
156
|
examples of employing specific Mesa Features)
|
|
115
157
|
- [Docs](http://mesa.readthedocs.org/) (Mesa's documentation, API and useful snippets)
|
|
116
|
-
- [Development version docs](https://mesa.readthedocs.io/
|
|
158
|
+
- [Development version docs](https://mesa.readthedocs.io/latest/) (the latest version docs if you're using a pre-release Mesa version)
|
|
117
159
|
- [Discussions](https://github.com/projectmesa/mesa/discussions) (GitHub threaded discussions about Mesa)
|
|
118
160
|
- [Matrix Chat](https://matrix.to/#/#project-mesa:matrix.org) (Chat Forum via Matrix to talk about Mesa)
|
|
119
161
|
|
|
@@ -28,7 +28,7 @@ can be displayed in browser windows or Jupyter.*
|
|
|
28
28
|
|
|
29
29
|
## Using Mesa
|
|
30
30
|
|
|
31
|
-
To install our latest stable release (2.
|
|
31
|
+
To install our latest stable release (2.4.x), run:
|
|
32
32
|
|
|
33
33
|
``` bash
|
|
34
34
|
pip install -U mesa
|
|
@@ -39,6 +39,17 @@ To install our latest pre-release (3.0.0 alpha), run:
|
|
|
39
39
|
``` bash
|
|
40
40
|
pip install -U --pre mesa
|
|
41
41
|
```
|
|
42
|
+
With Mesa 3.0, we don't install all our dependencies anymore by default.
|
|
43
|
+
```bash
|
|
44
|
+
# You can customize the additional dependencies you need, if you want. Available are:
|
|
45
|
+
pip install -U --pre mesa[network,viz]
|
|
46
|
+
|
|
47
|
+
# This is equivalent to our recommended dependencies:
|
|
48
|
+
pip install -U --pre mesa[rec]
|
|
49
|
+
|
|
50
|
+
# To install all, including developer, dependencies:
|
|
51
|
+
pip install -U --pre mesa[all]
|
|
52
|
+
```
|
|
42
53
|
|
|
43
54
|
You can also use `pip` to install the latest GitHub version:
|
|
44
55
|
|
|
@@ -57,13 +68,13 @@ For resources or help on using Mesa, check out the following:
|
|
|
57
68
|
|
|
58
69
|
- [Intro to Mesa Tutorial](http://mesa.readthedocs.org/en/stable/tutorials/intro_tutorial.html) (An introductory model, the Boltzmann
|
|
59
70
|
Wealth Model, for beginners or those new to Mesa.)
|
|
60
|
-
- [Visualization Tutorial](https://mesa.readthedocs.io/
|
|
71
|
+
- [Visualization Tutorial](https://mesa.readthedocs.io/stable/tutorials/visualization_tutorial.html) (An introduction into our Solara visualization)
|
|
61
72
|
- [Complexity Explorer Tutorial](https://www.complexityexplorer.org/courses/172-agent-based-models-with-python-an-introduction-to-mesa) (An advanced-beginner model,
|
|
62
73
|
SugarScape with Traders, with instructional videos)
|
|
63
|
-
- [Mesa Examples](https://github.com/projectmesa/mesa-examples
|
|
74
|
+
- [Mesa Examples](https://github.com/projectmesa/mesa-examples) (A repository of seminal ABMs using Mesa and
|
|
64
75
|
examples of employing specific Mesa Features)
|
|
65
76
|
- [Docs](http://mesa.readthedocs.org/) (Mesa's documentation, API and useful snippets)
|
|
66
|
-
- [Development version docs](https://mesa.readthedocs.io/
|
|
77
|
+
- [Development version docs](https://mesa.readthedocs.io/latest/) (the latest version docs if you're using a pre-release Mesa version)
|
|
67
78
|
- [Discussions](https://github.com/projectmesa/mesa/discussions) (GitHub threaded discussions about Mesa)
|
|
68
79
|
- [Matrix Chat](https://matrix.to/#/#project-mesa:matrix.org) (Chat Forum via Matrix to talk about Mesa)
|
|
69
80
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""init file for BoltzmannWealth module."""
|
|
@@ -1,8 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
"""boltmann wealth model for performance benchmarking.
|
|
2
|
+
|
|
3
|
+
https://github.com/projectmesa/mesa-examples/blob/main/examples/boltzmann_wealth_model_experimental/model.py
|
|
4
|
+
"""
|
|
5
|
+
|
|
2
6
|
import mesa
|
|
3
7
|
|
|
4
8
|
|
|
5
9
|
def compute_gini(model):
|
|
10
|
+
"""Calculate gini for wealth in model.
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
model: a Model instance
|
|
14
|
+
|
|
15
|
+
Returns:
|
|
16
|
+
float: gini score
|
|
17
|
+
|
|
18
|
+
"""
|
|
6
19
|
agent_wealths = [agent.wealth for agent in model.agents]
|
|
7
20
|
x = sorted(agent_wealths)
|
|
8
21
|
n = model.num_agents
|
|
@@ -19,10 +32,17 @@ class BoltzmannWealth(mesa.Model):
|
|
|
19
32
|
"""
|
|
20
33
|
|
|
21
34
|
def __init__(self, seed=None, n=100, width=10, height=10):
|
|
22
|
-
|
|
35
|
+
"""Initializes the model.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
seed: the seed for random number generator
|
|
39
|
+
n: the number of agents
|
|
40
|
+
width: the width of the grid
|
|
41
|
+
height: the height of the grid
|
|
42
|
+
"""
|
|
43
|
+
super().__init__(seed=seed)
|
|
23
44
|
self.num_agents = n
|
|
24
45
|
self.grid = mesa.space.MultiGrid(width, height, True)
|
|
25
|
-
self.schedule = mesa.time.RandomActivation(self)
|
|
26
46
|
self.datacollector = mesa.DataCollector(
|
|
27
47
|
model_reporters={"Gini": compute_gini}, agent_reporters={"Wealth": "wealth"}
|
|
28
48
|
)
|
|
@@ -38,11 +58,18 @@ class BoltzmannWealth(mesa.Model):
|
|
|
38
58
|
self.datacollector.collect(self)
|
|
39
59
|
|
|
40
60
|
def step(self):
|
|
41
|
-
|
|
61
|
+
"""Run the model for a single step."""
|
|
62
|
+
self.agents.shuffle_do("step")
|
|
42
63
|
# collect data
|
|
43
64
|
self.datacollector.collect(self)
|
|
44
65
|
|
|
45
66
|
def run_model(self, n):
|
|
67
|
+
"""Run the model for n steps.
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
n: the number of steps for which to run the model
|
|
71
|
+
|
|
72
|
+
"""
|
|
46
73
|
for _i in range(n):
|
|
47
74
|
self.step()
|
|
48
75
|
|
|
@@ -51,10 +78,16 @@ class MoneyAgent(mesa.Agent):
|
|
|
51
78
|
"""An agent with fixed initial wealth."""
|
|
52
79
|
|
|
53
80
|
def __init__(self, model):
|
|
81
|
+
"""Instantiate an agent.
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
model: a Model instance
|
|
85
|
+
"""
|
|
54
86
|
super().__init__(model)
|
|
55
87
|
self.wealth = 1
|
|
56
88
|
|
|
57
89
|
def move(self):
|
|
90
|
+
"""Move the agent to a random neighboring cell."""
|
|
58
91
|
possible_steps = self.model.grid.get_neighborhood(
|
|
59
92
|
self.pos, moore=True, include_center=False
|
|
60
93
|
)
|
|
@@ -62,6 +95,7 @@ class MoneyAgent(mesa.Agent):
|
|
|
62
95
|
self.model.grid.move_agent(self, new_position)
|
|
63
96
|
|
|
64
97
|
def give_money(self):
|
|
98
|
+
"""Give money to a random cell mate."""
|
|
65
99
|
cellmates = self.model.grid.get_cell_list_contents([self.pos])
|
|
66
100
|
cellmates.pop(
|
|
67
101
|
cellmates.index(self)
|
|
@@ -72,6 +106,7 @@ class MoneyAgent(mesa.Agent):
|
|
|
72
106
|
self.wealth -= 1
|
|
73
107
|
|
|
74
108
|
def step(self):
|
|
109
|
+
"""Run the agent for 1 step."""
|
|
75
110
|
self.move()
|
|
76
111
|
if self.wealth > 0:
|
|
77
112
|
self.give_money()
|