Mesa 3.0.1__tar.gz → 3.0.3__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.1 → mesa-3.0.3}/HISTORY.md +18 -0
- {mesa-3.0.1 → mesa-3.0.3}/PKG-INFO +1 -1
- {mesa-3.0.1 → mesa-3.0.3}/mesa/__init__.py +1 -1
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/epstein_civil_violence/Readme.md +2 -4
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/sugarscape_g1mt/app.py +18 -2
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/wolf_sheep/app.py +1 -1
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/boid_flockers/agents.py +5 -4
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/boid_flockers/app.py +2 -5
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/conways_game_of_life/app.py +25 -3
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/conways_game_of_life/model.py +2 -2
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/schelling/app.py +1 -1
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/virus_on_network/Readme.md +2 -13
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/virus_on_network/app.py +1 -1
- {mesa-3.0.1 → mesa-3.0.3}/mesa/experimental/cell_space/cell_collection.py +4 -2
- {mesa-3.0.1 → mesa-3.0.3}/mesa/visualization/solara_viz.py +13 -7
- {mesa-3.0.1 → mesa-3.0.3}/tests/test_cell_space.py +34 -0
- {mesa-3.0.1 → mesa-3.0.3}/tests/test_examples.py +35 -0
- {mesa-3.0.1 → mesa-3.0.3}/.codespellignore +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/.coveragerc +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/.github/ISSUE_TEMPLATE/bug-report.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/.github/ISSUE_TEMPLATE/feature-request.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/.github/PULL_REQUEST_TEMPLATE/bug.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/.github/dependabot.yml +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/.github/pull_request_template.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/.github/release.yml +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/.github/workflows/benchmarks.yml +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/.github/workflows/build_lint.yml +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/.github/workflows/release.yml +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/.gitignore +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/.pre-commit-config.yaml +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/.readthedocs.yml +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/CITATION.bib +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/CODE_OF_CONDUCT.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/CONTRIBUTING.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/Dockerfile +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/LICENSE +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/NOTICE +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/README.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/benchmarks/compare_timings.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/benchmarks/configurations.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/benchmarks/global_benchmark.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/binder/environment.yml +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/codecov.yaml +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docker-compose.yml +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/Makefile +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/README.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/_static/switcher.json +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/apis/agent.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/apis/api_main.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/apis/batchrunner.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/apis/datacollection.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/apis/experimental.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/apis/model.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/apis/space.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/apis/time.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/apis/visualization.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/best-practices.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/conf.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/example_template.txt +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/examples_overview_template.txt +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/getting_started.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/images/mesa_logo.ico +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/images/mesa_logo.png +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/images/tutorial/br_ginis.png +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/images/tutorial/dc_endwealth.png +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/images/tutorial/dc_gini.png +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/images/tutorial/dc_oneagent.png +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/images/tutorial/first_hist.png +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/images/tutorial/multirun_hist.png +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/images/tutorial/numpy_grid.png +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/images/tutorial/viz_chart.png +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/images/tutorial/viz_empty.png +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/images/tutorial/viz_greycircles.png +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/images/tutorial/viz_histogram.png +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/images/tutorial/viz_redcircles.png +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/images/wolf_sheep.png +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/index.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/make.bat +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/mesa.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/migration_guide.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/tutorials/MoneyModel.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/tutorials/files/viz_chart.png +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/tutorials/files/viz_empty.png +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/tutorials/files/viz_greycircles.png +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/tutorials/files/viz_histogram.png +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/tutorials/files/viz_redcircles.png +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/tutorials/files/viz_slider.png +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/tutorials/intro_tutorial.ipynb +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/docs/tutorials/visualization_tutorial.ipynb +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/maintenance/fetch_unlabeled_prs.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/agent.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/batchrunner.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/datacollection.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/README.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/__init__.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/__init__.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/epstein_civil_violence/Epstein Civil Violence.ipynb +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/epstein_civil_violence/__init__.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/epstein_civil_violence/agents.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/epstein_civil_violence/app.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/epstein_civil_violence/model.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/pd_grid/Readme.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/pd_grid/__init__.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/pd_grid/agents.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/pd_grid/analysis.ipynb +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/pd_grid/app.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/pd_grid/model.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/sugarscape_g1mt/Readme.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/sugarscape_g1mt/__init__.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/sugarscape_g1mt/agents.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/sugarscape_g1mt/model.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/sugarscape_g1mt/sugar-map.txt +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/sugarscape_g1mt/tests.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/wolf_sheep/Readme.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/wolf_sheep/__init__.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/wolf_sheep/agents.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/wolf_sheep/model.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/__init__.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/boid_flockers/Readme.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/boid_flockers/__init__.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/boid_flockers/model.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/boltzmann_wealth_model/Readme.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/boltzmann_wealth_model/__init__.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/boltzmann_wealth_model/agents.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/boltzmann_wealth_model/app.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/boltzmann_wealth_model/model.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/boltzmann_wealth_model/st_app.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/conways_game_of_life/Readme.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/conways_game_of_life/__init__.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/conways_game_of_life/agents.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/conways_game_of_life/st_app.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/schelling/Readme.md +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/schelling/__init__.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/schelling/agents.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/schelling/analysis.ipynb +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/schelling/model.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/virus_on_network/__init__.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/virus_on_network/agents.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/examples/basic/virus_on_network/model.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/experimental/UserParam.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/experimental/__init__.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/experimental/cell_space/__init__.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/experimental/cell_space/cell.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/experimental/cell_space/cell_agent.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/experimental/cell_space/discrete_space.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/experimental/cell_space/grid.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/experimental/cell_space/network.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/experimental/cell_space/voronoi.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/experimental/components/altair.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/experimental/components/matplotlib.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/experimental/devs/__init__.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/experimental/devs/eventlist.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/experimental/devs/examples/epstein_civil_violence.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/experimental/devs/examples/wolf_sheep.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/experimental/devs/simulator.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/experimental/solara_viz.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/model.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/space.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/time.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/visualization/__init__.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/visualization/components/__init__.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/visualization/components/altair_components.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/visualization/components/matplotlib_components.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/visualization/mpl_space_drawing.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/visualization/user_param.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mesa/visualization/utils.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/mypy.ini +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/pyproject.toml +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/tests/__init__.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/tests/read_requirements.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/tests/test_agent.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/tests/test_batch_run.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/tests/test_components_matplotlib.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/tests/test_datacollector.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/tests/test_devs.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/tests/test_end_to_end_viz.sh +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/tests/test_grid.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/tests/test_import_namespace.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/tests/test_lifespan.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/tests/test_model.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/tests/test_solara_viz.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/tests/test_space.py +0 -0
- {mesa-3.0.1 → mesa-3.0.3}/tests/test_time.py +0 -0
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Release History
|
|
3
3
|
---
|
|
4
|
+
# 3.0.2 (2024-11-11)
|
|
5
|
+
## Highlighst
|
|
6
|
+
Mesa 3.0.2 is a small follow-up patch release, in which we fixed a lot of small bugs in the example models their visualisation, and improved their testing.
|
|
7
|
+
|
|
8
|
+
## What's Changed
|
|
9
|
+
### 🐛 Bugs fixed
|
|
10
|
+
* allow components as a positional argument again by @Corvince in https://github.com/projectmesa/mesa/pull/2488
|
|
11
|
+
### 🔍 Examples updated
|
|
12
|
+
* examples: Add required components keyword by @EwoutH in https://github.com/projectmesa/mesa/pull/2485
|
|
13
|
+
* examples: Fix boid_flockers viz by @EwoutH in https://github.com/projectmesa/mesa/pull/2492
|
|
14
|
+
* examples: Fix schelling viz by @EwoutH in https://github.com/projectmesa/mesa/pull/2490
|
|
15
|
+
* example: Add input sliders to Sugerscape viz by @EwoutH in https://github.com/projectmesa/mesa/pull/2487
|
|
16
|
+
* examples/gol: Add initial fraction alive, add sliders to viz by @EwoutH in https://github.com/projectmesa/mesa/pull/2489
|
|
17
|
+
### 🔧 Maintenance
|
|
18
|
+
* test app init of examples by @Corvince in https://github.com/projectmesa/mesa/pull/2491
|
|
19
|
+
|
|
20
|
+
**Full Changelog**: https://github.com/projectmesa/mesa/compare/v3.0.1...v3.0.2
|
|
21
|
+
|
|
4
22
|
# 3.0.1 (2024-11-11)
|
|
5
23
|
## Highlights
|
|
6
24
|
After our huge [3.0.0 release](https://github.com/projectmesa/mesa/releases/tag/v3.0.0), Mesa 3.0.1 follows up with two improvements to experimental features, examples and docs.
|
|
@@ -24,7 +24,7 @@ __all__ = [
|
|
|
24
24
|
]
|
|
25
25
|
|
|
26
26
|
__title__ = "mesa"
|
|
27
|
-
__version__ = "3.0.
|
|
27
|
+
__version__ = "3.0.3"
|
|
28
28
|
__license__ = "Apache 2.0"
|
|
29
29
|
_this_year = datetime.datetime.now(tz=datetime.timezone.utc).date().year
|
|
30
30
|
__copyright__ = f"Copyright {_this_year} Project Mesa Team"
|
|
@@ -8,14 +8,12 @@ The model generates mass uprising as self-reinforcing processes: if enough agent
|
|
|
8
8
|
|
|
9
9
|
## How to Run
|
|
10
10
|
|
|
11
|
-
To run the model interactively,
|
|
11
|
+
To run the model interactively, in this directory, run the following command
|
|
12
12
|
|
|
13
13
|
```
|
|
14
|
-
$
|
|
14
|
+
$ solara run app.py
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
Then open your browser to [http://127.0.0.1:8521/](http://127.0.0.1:8521/) and press Reset, then Run.
|
|
18
|
-
|
|
19
17
|
## Files
|
|
20
18
|
|
|
21
19
|
* ``model.py``: Core model code.
|
|
@@ -4,7 +4,7 @@ from matplotlib.figure import Figure
|
|
|
4
4
|
|
|
5
5
|
from mesa.examples.advanced.sugarscape_g1mt.agents import Trader
|
|
6
6
|
from mesa.examples.advanced.sugarscape_g1mt.model import SugarscapeG1mt
|
|
7
|
-
from mesa.visualization import SolaraViz, make_plot_component
|
|
7
|
+
from mesa.visualization import Slider, SolaraViz, make_plot_component
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
def SpaceDrawer(model):
|
|
@@ -49,13 +49,29 @@ def SpaceDrawer(model):
|
|
|
49
49
|
model_params = {
|
|
50
50
|
"width": 50,
|
|
51
51
|
"height": 50,
|
|
52
|
+
# Population parameters
|
|
53
|
+
"initial_population": Slider(
|
|
54
|
+
"Initial Population", value=200, min=50, max=500, step=10
|
|
55
|
+
),
|
|
56
|
+
# Agent endowment parameters
|
|
57
|
+
"endowment_min": Slider("Min Initial Endowment", value=25, min=5, max=30, step=1),
|
|
58
|
+
"endowment_max": Slider("Max Initial Endowment", value=50, min=30, max=100, step=1),
|
|
59
|
+
# Metabolism parameters
|
|
60
|
+
"metabolism_min": Slider("Min Metabolism", value=1, min=1, max=3, step=1),
|
|
61
|
+
"metabolism_max": Slider("Max Metabolism", value=5, min=3, max=8, step=1),
|
|
62
|
+
# Vision parameters
|
|
63
|
+
"vision_min": Slider("Min Vision", value=1, min=1, max=3, step=1),
|
|
64
|
+
"vision_max": Slider("Max Vision", value=5, min=3, max=8, step=1),
|
|
65
|
+
# Trade parameter
|
|
66
|
+
"enable_trade": {"type": "Checkbox", "value": True, "label": "Enable Trading"},
|
|
52
67
|
}
|
|
53
68
|
|
|
54
|
-
model1 = SugarscapeG1mt(
|
|
69
|
+
model1 = SugarscapeG1mt()
|
|
55
70
|
|
|
56
71
|
page = SolaraViz(
|
|
57
72
|
model1,
|
|
58
73
|
components=[SpaceDrawer, make_plot_component(["Trader", "Price"])],
|
|
74
|
+
model_params=model_params,
|
|
59
75
|
name="Sugarscape {G1, M, T}",
|
|
60
76
|
play_interval=150,
|
|
61
77
|
)
|
|
@@ -54,13 +54,14 @@ class Boid(Agent):
|
|
|
54
54
|
self.cohere_factor = cohere
|
|
55
55
|
self.separate_factor = separate
|
|
56
56
|
self.match_factor = match
|
|
57
|
+
self.neighbors = []
|
|
57
58
|
|
|
58
59
|
def step(self):
|
|
59
60
|
"""Get the Boid's neighbors, compute the new vector, and move accordingly."""
|
|
60
|
-
neighbors = self.model.space.get_neighbors(self.pos, self.vision, False)
|
|
61
|
+
self.neighbors = self.model.space.get_neighbors(self.pos, self.vision, False)
|
|
61
62
|
|
|
62
63
|
# If no neighbors, maintain current direction
|
|
63
|
-
if not neighbors:
|
|
64
|
+
if not self.neighbors:
|
|
64
65
|
new_pos = self.pos + self.direction * self.speed
|
|
65
66
|
self.model.space.move_agent(self, new_pos)
|
|
66
67
|
return
|
|
@@ -71,7 +72,7 @@ class Boid(Agent):
|
|
|
71
72
|
separation_vector = np.zeros(2) # Separation vector
|
|
72
73
|
|
|
73
74
|
# Calculate the contribution of each neighbor to the three behaviors
|
|
74
|
-
for neighbor in neighbors:
|
|
75
|
+
for neighbor in self.neighbors:
|
|
75
76
|
heading = self.model.space.get_heading(self.pos, neighbor.pos)
|
|
76
77
|
distance = self.model.space.get_distance(self.pos, neighbor.pos)
|
|
77
78
|
|
|
@@ -86,7 +87,7 @@ class Boid(Agent):
|
|
|
86
87
|
match_vector += neighbor.direction
|
|
87
88
|
|
|
88
89
|
# Weight each behavior by its factor and normalize by number of neighbors
|
|
89
|
-
n = len(neighbors)
|
|
90
|
+
n = len(self.neighbors)
|
|
90
91
|
cohere = cohere * self.cohere_factor
|
|
91
92
|
separation_vector = separation_vector * self.separate_factor
|
|
92
93
|
match_vector = match_vector * self.match_factor
|
|
@@ -3,10 +3,7 @@ from mesa.visualization import Slider, SolaraViz, make_space_component
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
def boid_draw(agent):
|
|
6
|
-
|
|
7
|
-
neighbors = len(agent.model.space.get_neighbors(agent.pos, agent.vision, False))
|
|
8
|
-
else:
|
|
9
|
-
neighbors = len(agent.neighbors)
|
|
6
|
+
neighbors = len(agent.neighbors)
|
|
10
7
|
|
|
11
8
|
if neighbors <= 1:
|
|
12
9
|
return {"color": "red", "size": 20}
|
|
@@ -51,7 +48,7 @@ model = BoidFlockers()
|
|
|
51
48
|
|
|
52
49
|
page = SolaraViz(
|
|
53
50
|
model,
|
|
54
|
-
[make_space_component(agent_portrayal=boid_draw, backend="matplotlib")],
|
|
51
|
+
components=[make_space_component(agent_portrayal=boid_draw, backend="matplotlib")],
|
|
55
52
|
model_params=model_params,
|
|
56
53
|
name="Boid Flocking Model",
|
|
57
54
|
)
|
|
@@ -20,12 +20,34 @@ def post_process(ax):
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
model_params = {
|
|
23
|
-
"width":
|
|
24
|
-
|
|
23
|
+
"width": {
|
|
24
|
+
"type": "SliderInt",
|
|
25
|
+
"value": 50,
|
|
26
|
+
"label": "Width",
|
|
27
|
+
"min": 5,
|
|
28
|
+
"max": 60,
|
|
29
|
+
"step": 1,
|
|
30
|
+
},
|
|
31
|
+
"height": {
|
|
32
|
+
"type": "SliderInt",
|
|
33
|
+
"value": 50,
|
|
34
|
+
"label": "Height",
|
|
35
|
+
"min": 5,
|
|
36
|
+
"max": 60,
|
|
37
|
+
"step": 1,
|
|
38
|
+
},
|
|
39
|
+
"initial_fraction_alive": {
|
|
40
|
+
"type": "SliderFloat",
|
|
41
|
+
"value": 0.2,
|
|
42
|
+
"label": "Cells initially alive",
|
|
43
|
+
"min": 0,
|
|
44
|
+
"max": 1,
|
|
45
|
+
"step": 0.01,
|
|
46
|
+
},
|
|
25
47
|
}
|
|
26
48
|
|
|
27
49
|
# Create initial model instance
|
|
28
|
-
model1 = ConwaysGameOfLife(
|
|
50
|
+
model1 = ConwaysGameOfLife()
|
|
29
51
|
|
|
30
52
|
# Create visualization elements. The visualization elements are solara components
|
|
31
53
|
# that receive the model instance as a "prop" and display it in a certain way.
|
|
@@ -6,7 +6,7 @@ from mesa.space import SingleGrid
|
|
|
6
6
|
class ConwaysGameOfLife(Model):
|
|
7
7
|
"""Represents the 2-dimensional array of cells in Conway's Game of Life."""
|
|
8
8
|
|
|
9
|
-
def __init__(self, width=50, height=50, seed=None):
|
|
9
|
+
def __init__(self, width=50, height=50, initial_fraction_alive=0.2, seed=None):
|
|
10
10
|
"""Create a new playing area of (width, height) cells."""
|
|
11
11
|
super().__init__(seed=seed)
|
|
12
12
|
# Use a simple grid, where edges wrap around.
|
|
@@ -16,7 +16,7 @@ class ConwaysGameOfLife(Model):
|
|
|
16
16
|
# ALIVE and some to DEAD.
|
|
17
17
|
for _contents, (x, y) in self.grid.coord_iter():
|
|
18
18
|
cell = Cell((x, y), self)
|
|
19
|
-
if self.random.random() <
|
|
19
|
+
if self.random.random() < initial_fraction_alive:
|
|
20
20
|
cell.state = cell.ALIVE
|
|
21
21
|
self.grid.place_agent(cell, (x, y))
|
|
22
22
|
|
|
@@ -24,23 +24,12 @@ To install the dependencies use pip and the requirements.txt in this directory.
|
|
|
24
24
|
|
|
25
25
|
## How to Run
|
|
26
26
|
|
|
27
|
-
To run the model interactively,
|
|
27
|
+
To run the model interactively, in this directory, run the following command
|
|
28
28
|
|
|
29
29
|
```
|
|
30
|
-
$
|
|
30
|
+
$ solara run app.py
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
Then open your browser to [http://127.0.0.1:8521/](http://127.0.0.1:8521/) and press Reset, then Run.
|
|
34
|
-
|
|
35
|
-
or
|
|
36
|
-
|
|
37
|
-
Directly run the file ``run.py`` in the terminal. e.g.
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
$ python run.py
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
|
|
44
33
|
## Files
|
|
45
34
|
|
|
46
35
|
* ``model.py``: Contains the agent class, and the overall model class.
|
|
@@ -48,8 +48,10 @@ class CellCollection(Generic[T]):
|
|
|
48
48
|
else:
|
|
49
49
|
self._cells = {cell: cell.agents for cell in cells}
|
|
50
50
|
|
|
51
|
-
#
|
|
52
|
-
self._capacity: int =
|
|
51
|
+
# Get capacity from first cell if collection is not empty
|
|
52
|
+
self._capacity: int | None = (
|
|
53
|
+
next(iter(self._cells.keys())).capacity if self._cells else None
|
|
54
|
+
)
|
|
53
55
|
|
|
54
56
|
if random is None:
|
|
55
57
|
warnings.warn(
|
|
@@ -43,10 +43,10 @@ if TYPE_CHECKING:
|
|
|
43
43
|
@solara.component
|
|
44
44
|
def SolaraViz(
|
|
45
45
|
model: Model | solara.Reactive[Model],
|
|
46
|
-
*,
|
|
47
46
|
components: list[reacton.core.Component]
|
|
48
47
|
| list[Callable[[Model], reacton.core.Component]]
|
|
49
48
|
| Literal["default"] = "default",
|
|
49
|
+
*,
|
|
50
50
|
play_interval: int = 100,
|
|
51
51
|
simulator: Simulator | None = None,
|
|
52
52
|
model_params=None,
|
|
@@ -276,7 +276,7 @@ def SimulatorController(
|
|
|
276
276
|
running.value = True
|
|
277
277
|
simulator.reset()
|
|
278
278
|
model.value = model.value = model.value.__class__(
|
|
279
|
-
simulator, **model_parameters.value
|
|
279
|
+
simulator=simulator, **model_parameters.value
|
|
280
280
|
)
|
|
281
281
|
|
|
282
282
|
def do_play_pause():
|
|
@@ -382,11 +382,17 @@ def ModelCreator(
|
|
|
382
382
|
)
|
|
383
383
|
user_params, fixed_params = split_model_params(user_params)
|
|
384
384
|
|
|
385
|
-
#
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
385
|
+
# Use solara.use_effect to run the initialization code only once
|
|
386
|
+
solara.use_effect(
|
|
387
|
+
# set model_parameters to the default values for all parameters
|
|
388
|
+
lambda: model_parameters.set(
|
|
389
|
+
{
|
|
390
|
+
**fixed_params,
|
|
391
|
+
**{k: v.get("value") for k, v in user_params.items()},
|
|
392
|
+
}
|
|
393
|
+
),
|
|
394
|
+
[],
|
|
395
|
+
)
|
|
390
396
|
|
|
391
397
|
def on_change(name, value):
|
|
392
398
|
model_parameters.value = {**model_parameters.value, name: value}
|
|
@@ -583,6 +583,40 @@ def test_cell_collection():
|
|
|
583
583
|
assert len(cells) == len(collection)
|
|
584
584
|
|
|
585
585
|
|
|
586
|
+
def test_empty_cell_collection():
|
|
587
|
+
"""Test that CellCollection properly handles empty collections."""
|
|
588
|
+
rng = random.Random(42)
|
|
589
|
+
|
|
590
|
+
# Test initializing with empty collection
|
|
591
|
+
collection = CellCollection([], random=rng)
|
|
592
|
+
assert len(collection) == 0
|
|
593
|
+
assert collection._capacity is None
|
|
594
|
+
assert list(collection.cells) == []
|
|
595
|
+
assert list(collection.agents) == []
|
|
596
|
+
|
|
597
|
+
# Test selecting from empty collection
|
|
598
|
+
selected = collection.select(lambda cell: True)
|
|
599
|
+
assert len(selected) == 0
|
|
600
|
+
assert selected._capacity is None
|
|
601
|
+
|
|
602
|
+
# Test filtering to empty collection
|
|
603
|
+
n = 10
|
|
604
|
+
full_collection = CellCollection(
|
|
605
|
+
[Cell((i,), random=rng) for i in range(n)], random=rng
|
|
606
|
+
)
|
|
607
|
+
assert len(full_collection) == n
|
|
608
|
+
|
|
609
|
+
# Filter to empty collection
|
|
610
|
+
empty_result = full_collection.select(lambda cell: False)
|
|
611
|
+
assert len(empty_result) == 0
|
|
612
|
+
assert empty_result._capacity is None
|
|
613
|
+
|
|
614
|
+
# Test at_most with empty collection
|
|
615
|
+
at_most_result = full_collection.select(lambda cell: False, at_most=5)
|
|
616
|
+
assert len(at_most_result) == 0
|
|
617
|
+
assert at_most_result._capacity is None
|
|
618
|
+
|
|
619
|
+
|
|
586
620
|
### PropertyLayer tests
|
|
587
621
|
def test_property_layer_integration():
|
|
588
622
|
"""Test integration of PropertyLayer with DiscrateSpace and Cell."""
|
|
@@ -13,6 +13,10 @@ from mesa.examples import (
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
def test_boltzmann_model(): # noqa: D103
|
|
16
|
+
from mesa.examples.basic.boltzmann_wealth_model import app
|
|
17
|
+
|
|
18
|
+
app.page # noqa: B018
|
|
19
|
+
|
|
16
20
|
model = BoltzmannWealth(seed=42)
|
|
17
21
|
|
|
18
22
|
for _i in range(10):
|
|
@@ -20,24 +24,40 @@ def test_boltzmann_model(): # noqa: D103
|
|
|
20
24
|
|
|
21
25
|
|
|
22
26
|
def test_conways_game_model(): # noqa: D103
|
|
27
|
+
from mesa.examples.basic.conways_game_of_life import app
|
|
28
|
+
|
|
29
|
+
app.page # noqa: B018
|
|
30
|
+
|
|
23
31
|
model = ConwaysGameOfLife(seed=42)
|
|
24
32
|
for _i in range(10):
|
|
25
33
|
model.step()
|
|
26
34
|
|
|
27
35
|
|
|
28
36
|
def test_schelling_model(): # noqa: D103
|
|
37
|
+
from mesa.examples.basic.schelling import app
|
|
38
|
+
|
|
39
|
+
app.page # noqa: B018
|
|
40
|
+
|
|
29
41
|
model = Schelling(seed=42)
|
|
30
42
|
for _i in range(10):
|
|
31
43
|
model.step()
|
|
32
44
|
|
|
33
45
|
|
|
34
46
|
def test_virus_on_network(): # noqa: D103
|
|
47
|
+
from mesa.examples.basic.virus_on_network import app
|
|
48
|
+
|
|
49
|
+
app.page # noqa: B018
|
|
50
|
+
|
|
35
51
|
model = VirusOnNetwork(seed=42)
|
|
36
52
|
for _i in range(10):
|
|
37
53
|
model.step()
|
|
38
54
|
|
|
39
55
|
|
|
40
56
|
def test_boid_flockers(): # noqa: D103
|
|
57
|
+
from mesa.examples.basic.boid_flockers import app
|
|
58
|
+
|
|
59
|
+
app.page # noqa: B018
|
|
60
|
+
|
|
41
61
|
model = BoidFlockers(seed=42)
|
|
42
62
|
|
|
43
63
|
for _i in range(10):
|
|
@@ -45,6 +65,10 @@ def test_boid_flockers(): # noqa: D103
|
|
|
45
65
|
|
|
46
66
|
|
|
47
67
|
def test_epstein(): # noqa: D103
|
|
68
|
+
from mesa.examples.advanced.epstein_civil_violence import app
|
|
69
|
+
|
|
70
|
+
app.page # noqa: B018
|
|
71
|
+
|
|
48
72
|
model = EpsteinCivilViolence(seed=42)
|
|
49
73
|
|
|
50
74
|
for _i in range(10):
|
|
@@ -52,6 +76,10 @@ def test_epstein(): # noqa: D103
|
|
|
52
76
|
|
|
53
77
|
|
|
54
78
|
def test_pd_grid(): # noqa: D103
|
|
79
|
+
from mesa.examples.advanced.pd_grid import app
|
|
80
|
+
|
|
81
|
+
app.page # noqa: B018
|
|
82
|
+
|
|
55
83
|
model = PdGrid(seed=42)
|
|
56
84
|
|
|
57
85
|
for _i in range(10):
|
|
@@ -59,6 +87,10 @@ def test_pd_grid(): # noqa: D103
|
|
|
59
87
|
|
|
60
88
|
|
|
61
89
|
def test_sugarscape_g1mt(): # noqa: D103
|
|
90
|
+
from mesa.examples.advanced.sugarscape_g1mt import app
|
|
91
|
+
|
|
92
|
+
app.page # noqa: B018
|
|
93
|
+
|
|
62
94
|
model = SugarscapeG1mt(seed=42)
|
|
63
95
|
|
|
64
96
|
for _i in range(10):
|
|
@@ -66,8 +98,11 @@ def test_sugarscape_g1mt(): # noqa: D103
|
|
|
66
98
|
|
|
67
99
|
|
|
68
100
|
def test_wolf_sheep(): # noqa: D103
|
|
101
|
+
from mesa.examples.advanced.wolf_sheep import app
|
|
69
102
|
from mesa.experimental.devs import ABMSimulator
|
|
70
103
|
|
|
104
|
+
app.page # noqa: B018
|
|
105
|
+
|
|
71
106
|
simulator = ABMSimulator()
|
|
72
107
|
WolfSheep(seed=42, simulator=simulator)
|
|
73
108
|
simulator.run_for(10)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mesa-3.0.1 → mesa-3.0.3}/NOTICE
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mesa-3.0.1 → mesa-3.0.3}/mesa/examples/advanced/epstein_civil_violence/Epstein Civil Violence.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|