Mesa 3.0.1__tar.gz → 3.0.2__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.

Files changed (185) hide show
  1. {mesa-3.0.1 → mesa-3.0.2}/HISTORY.md +18 -0
  2. {mesa-3.0.1 → mesa-3.0.2}/PKG-INFO +1 -1
  3. {mesa-3.0.1 → mesa-3.0.2}/mesa/__init__.py +1 -1
  4. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/epstein_civil_violence/Readme.md +2 -4
  5. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/sugarscape_g1mt/app.py +18 -2
  6. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/wolf_sheep/app.py +1 -1
  7. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/boid_flockers/agents.py +5 -4
  8. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/boid_flockers/app.py +2 -5
  9. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/conways_game_of_life/app.py +25 -3
  10. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/conways_game_of_life/model.py +2 -2
  11. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/schelling/app.py +1 -1
  12. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/virus_on_network/Readme.md +2 -13
  13. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/virus_on_network/app.py +1 -1
  14. {mesa-3.0.1 → mesa-3.0.2}/mesa/visualization/solara_viz.py +2 -2
  15. {mesa-3.0.1 → mesa-3.0.2}/tests/test_examples.py +35 -0
  16. {mesa-3.0.1 → mesa-3.0.2}/.codespellignore +0 -0
  17. {mesa-3.0.1 → mesa-3.0.2}/.coveragerc +0 -0
  18. {mesa-3.0.1 → mesa-3.0.2}/.github/ISSUE_TEMPLATE/bug-report.md +0 -0
  19. {mesa-3.0.1 → mesa-3.0.2}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  20. {mesa-3.0.1 → mesa-3.0.2}/.github/ISSUE_TEMPLATE/feature-request.md +0 -0
  21. {mesa-3.0.1 → mesa-3.0.2}/.github/PULL_REQUEST_TEMPLATE/bug.md +0 -0
  22. {mesa-3.0.1 → mesa-3.0.2}/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -0
  23. {mesa-3.0.1 → mesa-3.0.2}/.github/dependabot.yml +0 -0
  24. {mesa-3.0.1 → mesa-3.0.2}/.github/pull_request_template.md +0 -0
  25. {mesa-3.0.1 → mesa-3.0.2}/.github/release.yml +0 -0
  26. {mesa-3.0.1 → mesa-3.0.2}/.github/workflows/benchmarks.yml +0 -0
  27. {mesa-3.0.1 → mesa-3.0.2}/.github/workflows/build_lint.yml +0 -0
  28. {mesa-3.0.1 → mesa-3.0.2}/.github/workflows/release.yml +0 -0
  29. {mesa-3.0.1 → mesa-3.0.2}/.gitignore +0 -0
  30. {mesa-3.0.1 → mesa-3.0.2}/.pre-commit-config.yaml +0 -0
  31. {mesa-3.0.1 → mesa-3.0.2}/.readthedocs.yml +0 -0
  32. {mesa-3.0.1 → mesa-3.0.2}/CITATION.bib +0 -0
  33. {mesa-3.0.1 → mesa-3.0.2}/CODE_OF_CONDUCT.md +0 -0
  34. {mesa-3.0.1 → mesa-3.0.2}/CONTRIBUTING.md +0 -0
  35. {mesa-3.0.1 → mesa-3.0.2}/Dockerfile +0 -0
  36. {mesa-3.0.1 → mesa-3.0.2}/LICENSE +0 -0
  37. {mesa-3.0.1 → mesa-3.0.2}/NOTICE +0 -0
  38. {mesa-3.0.1 → mesa-3.0.2}/README.md +0 -0
  39. {mesa-3.0.1 → mesa-3.0.2}/benchmarks/compare_timings.py +0 -0
  40. {mesa-3.0.1 → mesa-3.0.2}/benchmarks/configurations.py +0 -0
  41. {mesa-3.0.1 → mesa-3.0.2}/benchmarks/global_benchmark.py +0 -0
  42. {mesa-3.0.1 → mesa-3.0.2}/binder/environment.yml +0 -0
  43. {mesa-3.0.1 → mesa-3.0.2}/codecov.yaml +0 -0
  44. {mesa-3.0.1 → mesa-3.0.2}/docker-compose.yml +0 -0
  45. {mesa-3.0.1 → mesa-3.0.2}/docs/Makefile +0 -0
  46. {mesa-3.0.1 → mesa-3.0.2}/docs/README.md +0 -0
  47. {mesa-3.0.1 → mesa-3.0.2}/docs/_static/switcher.json +0 -0
  48. {mesa-3.0.1 → mesa-3.0.2}/docs/apis/agent.md +0 -0
  49. {mesa-3.0.1 → mesa-3.0.2}/docs/apis/api_main.md +0 -0
  50. {mesa-3.0.1 → mesa-3.0.2}/docs/apis/batchrunner.md +0 -0
  51. {mesa-3.0.1 → mesa-3.0.2}/docs/apis/datacollection.md +0 -0
  52. {mesa-3.0.1 → mesa-3.0.2}/docs/apis/experimental.md +0 -0
  53. {mesa-3.0.1 → mesa-3.0.2}/docs/apis/model.md +0 -0
  54. {mesa-3.0.1 → mesa-3.0.2}/docs/apis/space.md +0 -0
  55. {mesa-3.0.1 → mesa-3.0.2}/docs/apis/time.md +0 -0
  56. {mesa-3.0.1 → mesa-3.0.2}/docs/apis/visualization.md +0 -0
  57. {mesa-3.0.1 → mesa-3.0.2}/docs/best-practices.md +0 -0
  58. {mesa-3.0.1 → mesa-3.0.2}/docs/conf.py +0 -0
  59. {mesa-3.0.1 → mesa-3.0.2}/docs/example_template.txt +0 -0
  60. {mesa-3.0.1 → mesa-3.0.2}/docs/examples_overview_template.txt +0 -0
  61. {mesa-3.0.1 → mesa-3.0.2}/docs/getting_started.md +0 -0
  62. {mesa-3.0.1 → mesa-3.0.2}/docs/images/mesa_logo.ico +0 -0
  63. {mesa-3.0.1 → mesa-3.0.2}/docs/images/mesa_logo.png +0 -0
  64. {mesa-3.0.1 → mesa-3.0.2}/docs/images/tutorial/br_ginis.png +0 -0
  65. {mesa-3.0.1 → mesa-3.0.2}/docs/images/tutorial/dc_endwealth.png +0 -0
  66. {mesa-3.0.1 → mesa-3.0.2}/docs/images/tutorial/dc_gini.png +0 -0
  67. {mesa-3.0.1 → mesa-3.0.2}/docs/images/tutorial/dc_oneagent.png +0 -0
  68. {mesa-3.0.1 → mesa-3.0.2}/docs/images/tutorial/first_hist.png +0 -0
  69. {mesa-3.0.1 → mesa-3.0.2}/docs/images/tutorial/multirun_hist.png +0 -0
  70. {mesa-3.0.1 → mesa-3.0.2}/docs/images/tutorial/numpy_grid.png +0 -0
  71. {mesa-3.0.1 → mesa-3.0.2}/docs/images/tutorial/viz_chart.png +0 -0
  72. {mesa-3.0.1 → mesa-3.0.2}/docs/images/tutorial/viz_empty.png +0 -0
  73. {mesa-3.0.1 → mesa-3.0.2}/docs/images/tutorial/viz_greycircles.png +0 -0
  74. {mesa-3.0.1 → mesa-3.0.2}/docs/images/tutorial/viz_histogram.png +0 -0
  75. {mesa-3.0.1 → mesa-3.0.2}/docs/images/tutorial/viz_redcircles.png +0 -0
  76. {mesa-3.0.1 → mesa-3.0.2}/docs/images/wolf_sheep.png +0 -0
  77. {mesa-3.0.1 → mesa-3.0.2}/docs/index.md +0 -0
  78. {mesa-3.0.1 → mesa-3.0.2}/docs/make.bat +0 -0
  79. {mesa-3.0.1 → mesa-3.0.2}/docs/mesa.md +0 -0
  80. {mesa-3.0.1 → mesa-3.0.2}/docs/migration_guide.md +0 -0
  81. {mesa-3.0.1 → mesa-3.0.2}/docs/tutorials/MoneyModel.py +0 -0
  82. {mesa-3.0.1 → mesa-3.0.2}/docs/tutorials/files/viz_chart.png +0 -0
  83. {mesa-3.0.1 → mesa-3.0.2}/docs/tutorials/files/viz_empty.png +0 -0
  84. {mesa-3.0.1 → mesa-3.0.2}/docs/tutorials/files/viz_greycircles.png +0 -0
  85. {mesa-3.0.1 → mesa-3.0.2}/docs/tutorials/files/viz_histogram.png +0 -0
  86. {mesa-3.0.1 → mesa-3.0.2}/docs/tutorials/files/viz_redcircles.png +0 -0
  87. {mesa-3.0.1 → mesa-3.0.2}/docs/tutorials/files/viz_slider.png +0 -0
  88. {mesa-3.0.1 → mesa-3.0.2}/docs/tutorials/intro_tutorial.ipynb +0 -0
  89. {mesa-3.0.1 → mesa-3.0.2}/docs/tutorials/visualization_tutorial.ipynb +0 -0
  90. {mesa-3.0.1 → mesa-3.0.2}/maintenance/fetch_unlabeled_prs.py +0 -0
  91. {mesa-3.0.1 → mesa-3.0.2}/mesa/agent.py +0 -0
  92. {mesa-3.0.1 → mesa-3.0.2}/mesa/batchrunner.py +0 -0
  93. {mesa-3.0.1 → mesa-3.0.2}/mesa/datacollection.py +0 -0
  94. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/README.md +0 -0
  95. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/__init__.py +0 -0
  96. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/__init__.py +0 -0
  97. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/epstein_civil_violence/Epstein Civil Violence.ipynb +0 -0
  98. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/epstein_civil_violence/__init__.py +0 -0
  99. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/epstein_civil_violence/agents.py +0 -0
  100. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/epstein_civil_violence/app.py +0 -0
  101. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/epstein_civil_violence/model.py +0 -0
  102. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/pd_grid/Readme.md +0 -0
  103. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/pd_grid/__init__.py +0 -0
  104. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/pd_grid/agents.py +0 -0
  105. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/pd_grid/analysis.ipynb +0 -0
  106. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/pd_grid/app.py +0 -0
  107. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/pd_grid/model.py +0 -0
  108. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/sugarscape_g1mt/Readme.md +0 -0
  109. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/sugarscape_g1mt/__init__.py +0 -0
  110. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/sugarscape_g1mt/agents.py +0 -0
  111. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/sugarscape_g1mt/model.py +0 -0
  112. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/sugarscape_g1mt/sugar-map.txt +0 -0
  113. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/sugarscape_g1mt/tests.py +0 -0
  114. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/wolf_sheep/Readme.md +0 -0
  115. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/wolf_sheep/__init__.py +0 -0
  116. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/wolf_sheep/agents.py +0 -0
  117. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/advanced/wolf_sheep/model.py +0 -0
  118. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/__init__.py +0 -0
  119. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/boid_flockers/Readme.md +0 -0
  120. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/boid_flockers/__init__.py +0 -0
  121. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/boid_flockers/model.py +0 -0
  122. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/boltzmann_wealth_model/Readme.md +0 -0
  123. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/boltzmann_wealth_model/__init__.py +0 -0
  124. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/boltzmann_wealth_model/agents.py +0 -0
  125. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/boltzmann_wealth_model/app.py +0 -0
  126. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/boltzmann_wealth_model/model.py +0 -0
  127. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/boltzmann_wealth_model/st_app.py +0 -0
  128. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/conways_game_of_life/Readme.md +0 -0
  129. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/conways_game_of_life/__init__.py +0 -0
  130. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/conways_game_of_life/agents.py +0 -0
  131. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/conways_game_of_life/st_app.py +0 -0
  132. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/schelling/Readme.md +0 -0
  133. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/schelling/__init__.py +0 -0
  134. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/schelling/agents.py +0 -0
  135. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/schelling/analysis.ipynb +0 -0
  136. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/schelling/model.py +0 -0
  137. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/virus_on_network/__init__.py +0 -0
  138. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/virus_on_network/agents.py +0 -0
  139. {mesa-3.0.1 → mesa-3.0.2}/mesa/examples/basic/virus_on_network/model.py +0 -0
  140. {mesa-3.0.1 → mesa-3.0.2}/mesa/experimental/UserParam.py +0 -0
  141. {mesa-3.0.1 → mesa-3.0.2}/mesa/experimental/__init__.py +0 -0
  142. {mesa-3.0.1 → mesa-3.0.2}/mesa/experimental/cell_space/__init__.py +0 -0
  143. {mesa-3.0.1 → mesa-3.0.2}/mesa/experimental/cell_space/cell.py +0 -0
  144. {mesa-3.0.1 → mesa-3.0.2}/mesa/experimental/cell_space/cell_agent.py +0 -0
  145. {mesa-3.0.1 → mesa-3.0.2}/mesa/experimental/cell_space/cell_collection.py +0 -0
  146. {mesa-3.0.1 → mesa-3.0.2}/mesa/experimental/cell_space/discrete_space.py +0 -0
  147. {mesa-3.0.1 → mesa-3.0.2}/mesa/experimental/cell_space/grid.py +0 -0
  148. {mesa-3.0.1 → mesa-3.0.2}/mesa/experimental/cell_space/network.py +0 -0
  149. {mesa-3.0.1 → mesa-3.0.2}/mesa/experimental/cell_space/voronoi.py +0 -0
  150. {mesa-3.0.1 → mesa-3.0.2}/mesa/experimental/components/altair.py +0 -0
  151. {mesa-3.0.1 → mesa-3.0.2}/mesa/experimental/components/matplotlib.py +0 -0
  152. {mesa-3.0.1 → mesa-3.0.2}/mesa/experimental/devs/__init__.py +0 -0
  153. {mesa-3.0.1 → mesa-3.0.2}/mesa/experimental/devs/eventlist.py +0 -0
  154. {mesa-3.0.1 → mesa-3.0.2}/mesa/experimental/devs/examples/epstein_civil_violence.py +0 -0
  155. {mesa-3.0.1 → mesa-3.0.2}/mesa/experimental/devs/examples/wolf_sheep.py +0 -0
  156. {mesa-3.0.1 → mesa-3.0.2}/mesa/experimental/devs/simulator.py +0 -0
  157. {mesa-3.0.1 → mesa-3.0.2}/mesa/experimental/solara_viz.py +0 -0
  158. {mesa-3.0.1 → mesa-3.0.2}/mesa/model.py +0 -0
  159. {mesa-3.0.1 → mesa-3.0.2}/mesa/space.py +0 -0
  160. {mesa-3.0.1 → mesa-3.0.2}/mesa/time.py +0 -0
  161. {mesa-3.0.1 → mesa-3.0.2}/mesa/visualization/__init__.py +0 -0
  162. {mesa-3.0.1 → mesa-3.0.2}/mesa/visualization/components/__init__.py +0 -0
  163. {mesa-3.0.1 → mesa-3.0.2}/mesa/visualization/components/altair_components.py +0 -0
  164. {mesa-3.0.1 → mesa-3.0.2}/mesa/visualization/components/matplotlib_components.py +0 -0
  165. {mesa-3.0.1 → mesa-3.0.2}/mesa/visualization/mpl_space_drawing.py +0 -0
  166. {mesa-3.0.1 → mesa-3.0.2}/mesa/visualization/user_param.py +0 -0
  167. {mesa-3.0.1 → mesa-3.0.2}/mesa/visualization/utils.py +0 -0
  168. {mesa-3.0.1 → mesa-3.0.2}/mypy.ini +0 -0
  169. {mesa-3.0.1 → mesa-3.0.2}/pyproject.toml +0 -0
  170. {mesa-3.0.1 → mesa-3.0.2}/tests/__init__.py +0 -0
  171. {mesa-3.0.1 → mesa-3.0.2}/tests/read_requirements.py +0 -0
  172. {mesa-3.0.1 → mesa-3.0.2}/tests/test_agent.py +0 -0
  173. {mesa-3.0.1 → mesa-3.0.2}/tests/test_batch_run.py +0 -0
  174. {mesa-3.0.1 → mesa-3.0.2}/tests/test_cell_space.py +0 -0
  175. {mesa-3.0.1 → mesa-3.0.2}/tests/test_components_matplotlib.py +0 -0
  176. {mesa-3.0.1 → mesa-3.0.2}/tests/test_datacollector.py +0 -0
  177. {mesa-3.0.1 → mesa-3.0.2}/tests/test_devs.py +0 -0
  178. {mesa-3.0.1 → mesa-3.0.2}/tests/test_end_to_end_viz.sh +0 -0
  179. {mesa-3.0.1 → mesa-3.0.2}/tests/test_grid.py +0 -0
  180. {mesa-3.0.1 → mesa-3.0.2}/tests/test_import_namespace.py +0 -0
  181. {mesa-3.0.1 → mesa-3.0.2}/tests/test_lifespan.py +0 -0
  182. {mesa-3.0.1 → mesa-3.0.2}/tests/test_model.py +0 -0
  183. {mesa-3.0.1 → mesa-3.0.2}/tests/test_solara_viz.py +0 -0
  184. {mesa-3.0.1 → mesa-3.0.2}/tests/test_space.py +0 -0
  185. {mesa-3.0.1 → mesa-3.0.2}/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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: Mesa
3
- Version: 3.0.1
3
+ Version: 3.0.2
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
@@ -24,7 +24,7 @@ __all__ = [
24
24
  ]
25
25
 
26
26
  __title__ = "mesa"
27
- __version__ = "3.0.1"
27
+ __version__ = "3.0.2"
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, run ``EpsteinCivilViolenceServer.py`` in this directory. e.g.
11
+ To run the model interactively, in this directory, run the following command
12
12
 
13
13
  ```
14
- $ python EpsteinCivilViolenceServer.py
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(50, 50)
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
  )
@@ -83,7 +83,7 @@ lineplot_component = make_plot_component(
83
83
  )
84
84
 
85
85
  simulator = ABMSimulator()
86
- model = WolfSheep(simulator, grass=True)
86
+ model = WolfSheep(simulator=simulator, grass=True)
87
87
 
88
88
  page = SolaraViz(
89
89
  model,
@@ -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
- if not agent.neighbors: # Only for the first Frame
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": 50,
24
- "height": 50,
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, 50)
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() < 0.1:
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
 
@@ -26,7 +26,7 @@ model_params = {
26
26
  "height": 20,
27
27
  }
28
28
 
29
- model1 = Schelling(20, 20, 0.8, 0.2, 3)
29
+ model1 = Schelling()
30
30
 
31
31
  HappyPlot = make_plot_component({"happy": "tab:green"})
32
32
 
@@ -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, run ``mesa runserver`` in this directory. e.g.
27
+ To run the model interactively, in this directory, run the following command
28
28
 
29
29
  ```
30
- $ mesa runserver
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.
@@ -103,7 +103,7 @@ model1 = VirusOnNetwork()
103
103
 
104
104
  page = SolaraViz(
105
105
  model1,
106
- [
106
+ components=[
107
107
  SpacePlot,
108
108
  StatePlot,
109
109
  get_resistant_susceptible_ratio,
@@ -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():
@@ -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
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