Mesa 3.0.0a2__tar.gz → 3.0.0a4__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 (142) hide show
  1. {mesa-3.0.0a2 → mesa-3.0.0a4}/.github/ISSUE_TEMPLATE/bug-report.md +2 -1
  2. mesa-3.0.0a4/.github/ISSUE_TEMPLATE/config.yml +5 -0
  3. mesa-3.0.0a4/.github/PULL_REQUEST_TEMPLATE/bug.md +16 -0
  4. mesa-3.0.0a4/.github/PULL_REQUEST_TEMPLATE/feature.md +16 -0
  5. {mesa-3.0.0a2 → mesa-3.0.0a4}/.github/workflows/build_lint.yml +10 -4
  6. {mesa-3.0.0a2 → mesa-3.0.0a4}/.pre-commit-config.yaml +1 -1
  7. {mesa-3.0.0a2 → mesa-3.0.0a4}/CONTRIBUTING.md +34 -0
  8. {mesa-3.0.0a2 → mesa-3.0.0a4}/HISTORY.md +101 -0
  9. {mesa-3.0.0a2 → mesa-3.0.0a4}/PKG-INFO +8 -1
  10. {mesa-3.0.0a2 → mesa-3.0.0a4}/README.md +3 -0
  11. mesa-3.0.0a4/benchmarks/BoltzmannWealth/boltzmann_wealth.py +77 -0
  12. {mesa-3.0.0a2 → mesa-3.0.0a4}/benchmarks/Flocking/flocking.py +2 -5
  13. {mesa-3.0.0a2 → mesa-3.0.0a4}/benchmarks/Schelling/schelling.py +3 -6
  14. {mesa-3.0.0a2 → mesa-3.0.0a4}/benchmarks/WolfSheep/wolf_sheep.py +7 -12
  15. {mesa-3.0.0a2 → mesa-3.0.0a4}/benchmarks/configurations.py +25 -1
  16. {mesa-3.0.0a2 → mesa-3.0.0a4}/benchmarks/global_benchmark.py +11 -7
  17. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/conf.py +2 -0
  18. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/index.md +3 -2
  19. mesa-3.0.0a4/docs/migration_guide.md +67 -0
  20. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/overview.md +5 -5
  21. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/tutorials/MoneyModel.py +2 -2
  22. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/tutorials/visualization_tutorial.ipynb +42 -23
  23. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/__init__.py +1 -1
  24. mesa-3.0.0a4/mesa/agent.py +613 -0
  25. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/batchrunner.py +7 -4
  26. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/datacollection.py +2 -2
  27. mesa-3.0.0a4/mesa/experimental/__init__.py +5 -0
  28. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/experimental/cell_space/__init__.py +2 -0
  29. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/experimental/cell_space/cell_agent.py +2 -2
  30. mesa-3.0.0a4/mesa/experimental/cell_space/voronoi.py +264 -0
  31. {mesa-3.0.0a2/mesa/visualization → mesa-3.0.0a4/mesa/experimental}/components/matplotlib.py +53 -0
  32. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/experimental/devs/examples/epstein_civil_violence.py +6 -10
  33. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/experimental/devs/examples/wolf_sheep.py +7 -12
  34. {mesa-3.0.0a2/mesa/visualization → mesa-3.0.0a4/mesa/experimental}/solara_viz.py +9 -5
  35. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/model.py +108 -38
  36. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/space.py +9 -3
  37. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/time.py +0 -7
  38. mesa-3.0.0a4/mesa/visualization/UserParam.py +56 -0
  39. mesa-3.0.0a4/mesa/visualization/__init__.py +14 -0
  40. mesa-3.0.0a4/mesa/visualization/components/altair.py +86 -0
  41. mesa-3.0.0a4/mesa/visualization/components/matplotlib.py +246 -0
  42. mesa-3.0.0a4/mesa/visualization/solara_viz.py +394 -0
  43. mesa-3.0.0a4/mesa/visualization/utils.py +7 -0
  44. {mesa-3.0.0a2 → mesa-3.0.0a4}/pyproject.toml +5 -0
  45. mesa-3.0.0a4/tests/__init__.py +0 -0
  46. {mesa-3.0.0a2 → mesa-3.0.0a4}/tests/test_agent.py +216 -30
  47. {mesa-3.0.0a2 → mesa-3.0.0a4}/tests/test_batch_run.py +19 -20
  48. {mesa-3.0.0a2 → mesa-3.0.0a4}/tests/test_cell_space.py +30 -7
  49. {mesa-3.0.0a2 → mesa-3.0.0a4}/tests/test_datacollector.py +4 -12
  50. {mesa-3.0.0a2 → mesa-3.0.0a4}/tests/test_examples.py +1 -0
  51. {mesa-3.0.0a2 → mesa-3.0.0a4}/tests/test_lifespan.py +4 -8
  52. {mesa-3.0.0a2 → mesa-3.0.0a4}/tests/test_model.py +21 -6
  53. {mesa-3.0.0a2 → mesa-3.0.0a4}/tests/test_solara_viz.py +17 -35
  54. {mesa-3.0.0a2 → mesa-3.0.0a4}/tests/test_space.py +17 -0
  55. {mesa-3.0.0a2 → mesa-3.0.0a4}/tests/test_time.py +12 -12
  56. mesa-3.0.0a2/.github/ISSUE_TEMPLATE/asking-help.md +0 -9
  57. mesa-3.0.0a2/mesa/agent.py +0 -363
  58. mesa-3.0.0a2/mesa/experimental/__init__.py +0 -3
  59. mesa-3.0.0a2/mesa/visualization/__init__.py +0 -3
  60. {mesa-3.0.0a2 → mesa-3.0.0a4}/.codespellignore +0 -0
  61. {mesa-3.0.0a2 → mesa-3.0.0a4}/.coveragerc +0 -0
  62. {mesa-3.0.0a2 → mesa-3.0.0a4}/.github/ISSUE_TEMPLATE/feature-request.md +0 -0
  63. {mesa-3.0.0a2 → mesa-3.0.0a4}/.github/dependabot.yml +0 -0
  64. {mesa-3.0.0a2 → mesa-3.0.0a4}/.github/release.yml +0 -0
  65. {mesa-3.0.0a2 → mesa-3.0.0a4}/.github/workflows/benchmarks.yml +0 -0
  66. {mesa-3.0.0a2 → mesa-3.0.0a4}/.github/workflows/release.yml +0 -0
  67. {mesa-3.0.0a2 → mesa-3.0.0a4}/.gitignore +0 -0
  68. {mesa-3.0.0a2 → mesa-3.0.0a4}/.readthedocs.yml +0 -0
  69. {mesa-3.0.0a2 → mesa-3.0.0a4}/CITATION.bib +0 -0
  70. {mesa-3.0.0a2 → mesa-3.0.0a4}/CODE_OF_CONDUCT.md +0 -0
  71. {mesa-3.0.0a2 → mesa-3.0.0a4}/Dockerfile +0 -0
  72. {mesa-3.0.0a2 → mesa-3.0.0a4}/LICENSE +0 -0
  73. {mesa-3.0.0a2/benchmarks/Flocking → mesa-3.0.0a4/benchmarks/BoltzmannWealth}/__init__.py +0 -0
  74. {mesa-3.0.0a2/benchmarks/Schelling → mesa-3.0.0a4/benchmarks/Flocking}/__init__.py +0 -0
  75. {mesa-3.0.0a2/benchmarks/WolfSheep → mesa-3.0.0a4/benchmarks/Schelling}/__init__.py +0 -0
  76. {mesa-3.0.0a2/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}} → mesa-3.0.0a4/benchmarks/WolfSheep}/__init__.py +0 -0
  77. {mesa-3.0.0a2 → mesa-3.0.0a4}/benchmarks/compare_timings.py +0 -0
  78. {mesa-3.0.0a2 → mesa-3.0.0a4}/codecov.yaml +0 -0
  79. {mesa-3.0.0a2 → mesa-3.0.0a4}/docker-compose.yml +0 -0
  80. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/Makefile +0 -0
  81. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/README.md +0 -0
  82. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/apis/api_main.md +0 -0
  83. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/apis/batchrunner.md +0 -0
  84. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/apis/datacollection.md +0 -0
  85. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/apis/experimental.md +0 -0
  86. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/apis/init.md +0 -0
  87. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/apis/space.md +0 -0
  88. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/apis/time.md +0 -0
  89. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/apis/visualization.md +0 -0
  90. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/best-practices.md +0 -0
  91. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/howto.md +0 -0
  92. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/images/Mesa_Screenshot.png +0 -0
  93. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/images/mesa_logo.ico +0 -0
  94. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/images/mesa_logo.png +0 -0
  95. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/images/tutorial/br_ginis.png +0 -0
  96. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/images/tutorial/dc_endwealth.png +0 -0
  97. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/images/tutorial/dc_gini.png +0 -0
  98. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/images/tutorial/dc_oneagent.png +0 -0
  99. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/images/tutorial/first_hist.png +0 -0
  100. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/images/tutorial/multirun_hist.png +0 -0
  101. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/images/tutorial/numpy_grid.png +0 -0
  102. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/images/tutorial/viz_chart.png +0 -0
  103. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/images/tutorial/viz_empty.png +0 -0
  104. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/images/tutorial/viz_greycircles.png +0 -0
  105. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/images/tutorial/viz_histogram.png +0 -0
  106. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/images/tutorial/viz_redcircles.png +0 -0
  107. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/make.bat +0 -0
  108. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/mesa.md +0 -0
  109. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/packages.md +0 -0
  110. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/tutorials/files/viz_chart.png +0 -0
  111. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/tutorials/files/viz_empty.png +0 -0
  112. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/tutorials/files/viz_greycircles.png +0 -0
  113. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/tutorials/files/viz_histogram.png +0 -0
  114. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/tutorials/files/viz_redcircles.png +0 -0
  115. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/tutorials/files/viz_slider.png +0 -0
  116. {mesa-3.0.0a2 → mesa-3.0.0a4}/docs/tutorials/intro_tutorial.ipynb +0 -0
  117. {mesa-3.0.0a2 → mesa-3.0.0a4}/maintenance/fetch_unlabeled_prs.py +0 -0
  118. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/cookiecutter-mesa/cookiecutter.json +0 -0
  119. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/cookiecutter-mesa/hooks/post_gen_project.py +0 -0
  120. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/README.md +0 -0
  121. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/app.pytemplate +0 -0
  122. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/setup.pytemplate +0 -0
  123. {mesa-3.0.0a2/tests → mesa-3.0.0a4/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}}/__init__.py +0 -0
  124. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}/model.pytemplate +0 -0
  125. {mesa-3.0.0a2/mesa/visualization → mesa-3.0.0a4/mesa/experimental}/UserParam.py +0 -0
  126. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/experimental/cell_space/cell.py +0 -0
  127. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/experimental/cell_space/cell_collection.py +0 -0
  128. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/experimental/cell_space/discrete_space.py +0 -0
  129. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/experimental/cell_space/grid.py +0 -0
  130. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/experimental/cell_space/network.py +0 -0
  131. {mesa-3.0.0a2/mesa/visualization → mesa-3.0.0a4/mesa/experimental}/components/altair.py +0 -0
  132. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/experimental/devs/__init__.py +0 -0
  133. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/experimental/devs/eventlist.py +0 -0
  134. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/experimental/devs/simulator.py +0 -0
  135. {mesa-3.0.0a2 → mesa-3.0.0a4}/mesa/main.py +0 -0
  136. {mesa-3.0.0a2 → mesa-3.0.0a4}/mypy.ini +0 -0
  137. {mesa-3.0.0a2 → mesa-3.0.0a4}/tests/read_requirements.py +0 -0
  138. {mesa-3.0.0a2 → mesa-3.0.0a4}/tests/test_devs.py +0 -0
  139. {mesa-3.0.0a2 → mesa-3.0.0a4}/tests/test_end_to_end_viz.sh +0 -0
  140. {mesa-3.0.0a2 → mesa-3.0.0a4}/tests/test_grid.py +0 -0
  141. {mesa-3.0.0a2 → mesa-3.0.0a4}/tests/test_import_namespace.py +0 -0
  142. {mesa-3.0.0a2 → mesa-3.0.0a4}/tests/test_scaffold.py +0 -0
@@ -11,7 +11,8 @@ about: Let us know if something is broken on Mesa
11
11
  <!-- A clear and concise description of what you expected to happen -->
12
12
 
13
13
  **To Reproduce**
14
- <!-- Steps to reproduce the bug, or a link to a project where the bug is visible -->
14
+ <!-- Steps to reproduce the bug, or a link to a project where the bug is visible
15
+ Include a Minimal reproducible example: https://stackoverflow.com/help/minimal-reproducible-example -->
15
16
 
16
17
  **Additional context**
17
18
  <!--
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: true
2
+ contact_links:
3
+ - name: Questions, ideas, showcases and more
4
+ url: https://github.com/projectmesa/mesa/discussions
5
+ about: Discuss Mesa, ask questions, share ideas, and showcase your projects
@@ -0,0 +1,16 @@
1
+ ## Summary
2
+ <!-- Provide a brief summary of the bug and its impact. -->
3
+
4
+ ## Bug / Issue
5
+ <!-- Link to the related issue(s) and describe the bug. Include details like the context, what was expected, and what actually happened. -->
6
+
7
+ ## Implementation
8
+ <!-- Describe the changes made to resolve the issue. Highlight any important parts of the code that were modified. -->
9
+
10
+ ## Testing
11
+ <!-- Detail the testing performed to verify the fix. Include information on test cases, steps taken, and any relevant results.
12
+
13
+ If you're fixing the visualisation, add before/after screenshots. -->
14
+
15
+ ## Additional Notes
16
+ <!-- Add any additional information that may be relevant for the reviewers, such as potential side effects, dependencies, or related work.
@@ -0,0 +1,16 @@
1
+ ## Summary
2
+ <!-- Provide a concise summary of the feature and its purpose. -->
3
+
4
+ ## Motive
5
+ <!-- Explain the reasoning behind this feature. Include details on the problem it addresses or the enhancement it provides. -->
6
+
7
+ ## Implementation
8
+ <!-- Describe how the feature was implemented. Include details on the approach taken, important decisions made, and code changes. -->
9
+
10
+ ## Usage Examples
11
+ <!-- Provide code snippets or examples demonstrating how to use the new feature. Highlight key scenarios where this feature will be beneficial.
12
+
13
+ If you're modifying the visualisation, add before/after screenshots. -->
14
+
15
+ ## Additional Notes
16
+ <!-- Add any additional information that may be relevant for the reviewers, such as potential side effects, dependencies, or related work. -->
@@ -33,6 +33,8 @@ jobs:
33
33
  os: [windows, ubuntu, macos]
34
34
  python-version: ["3.12"]
35
35
  include:
36
+ - os: ubuntu
37
+ python-version: "3.13"
36
38
  - os: ubuntu
37
39
  python-version: "3.11"
38
40
  - os: ubuntu
@@ -47,12 +49,16 @@ jobs:
47
49
  uses: actions/setup-python@v5
48
50
  with:
49
51
  python-version: ${{ matrix.python-version }}
52
+ allow-prereleases: true
50
53
  cache: 'pip'
51
54
  - name: Install uv
52
55
  run: pip install uv
53
- - name: Install Mesa
54
- # See https://github.com/astral-sh/uv/issues/1945
56
+ - name: Install Mesa with uv pip
55
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'
56
62
  - name: Test with pytest
57
63
  run: pytest --durations=10 --cov=mesa tests/ --cov-report=xml
58
64
  - if: matrix.os == 'ubuntu'
@@ -71,7 +77,7 @@ jobs:
71
77
  - name: Install uv
72
78
  run: pip install uv
73
79
  - name: Install Mesa
74
- run: uv pip install --system .[dev]
80
+ run: uv pip install --system .[examples]
75
81
  - name: Checkout mesa-examples
76
82
  uses: actions/checkout@v4
77
83
  with:
@@ -80,4 +86,4 @@ jobs:
80
86
  - name: Test examples
81
87
  run: |
82
88
  cd mesa-examples
83
- pytest -rA -Werror test_examples.py
89
+ pytest -rA -Werror -Wdefault::FutureWarning test_examples.py
@@ -4,7 +4,7 @@ ci:
4
4
  repos:
5
5
  - repo: https://github.com/astral-sh/ruff-pre-commit
6
6
  # Ruff version.
7
- rev: v0.5.6
7
+ rev: v0.6.3
8
8
  hooks:
9
9
  # Run the linter.
10
10
  - id: ruff
@@ -36,6 +36,40 @@ discuss via [Matrix] OR via [an issue].
36
36
  - Describe the change w/ ticket number(s) that the code fixes.
37
37
  - Format your commit message as per [Tim Pope's guideline].
38
38
 
39
+ ## I have no idea where to start
40
+ That's fine! Here's a rough outline where you could start, depending on your experience:
41
+
42
+ ### I'm a modeller (but not an experienced developer)
43
+ You already know how to build Mesa models (if not skip below), and probably have found things Mesa can't do (elegantly). You want to improve that. Awesome!
44
+
45
+ First step is to install some proper tools, if you haven't already.
46
+ - A good IDE helps for code development, testing and formatting. [PyCharm](https://www.jetbrains.com/pycharm/) or [VSCode](https://code.visualstudio.com/) for example.
47
+ - Dive into Git and GitHub. Watch some videos, this takes some time to click. [GitHub Desktop](https://desktop.github.com/) is great.
48
+ - [`https://github.dev/projectmesa/mesa`](https://github.dev/projectmesa/mesa) is great for small changes (to docs).
49
+
50
+ Learn the tools, talk to us about what you want to change, and open a small PR. Or update an [example model](https://github.com/projectmesa/mesa-examples) (check open [issues](https://github.com/projectmesa/mesa-examples/issues))!
51
+
52
+ ### I'm a developer (but not a modeller)
53
+ Awesome! You have the basics of open-source software development (if not check above), but not much modelling experience.
54
+
55
+ First step is to start thinking like a modeller. To understand the fine details about our library and contribute meaningfully, get some modelling experience:
56
+ - Go though our [Introductory Tutorial](https://mesa.readthedocs.io/en/latest/tutorials/intro_tutorial.html) and [Visualization Tutorial](https://mesa.readthedocs.io/en/latest/tutorials/visualization_tutorial.html). While going through them, dive into the source code to really see what everything does.
57
+ - Follow an ABM course (if possible). They might be a bit outdated programming language wise, but conceptual they're sound.
58
+ - This MOOC on ABM concepts: [Agent Based Modeling](https://ocw.tudelft.nl/course-lectures/agent-based-modeling/)
59
+ - This MOOC on practical ABM modelling: [Agent-Based Models with Python: An Introduction to Mesa](https://www.complexityexplorer.org/courses/172-agent-based-models-with-python-an-introduction-to-mesa)
60
+ - Go though multiple of our [examples](https://github.com/projectmesa/mesa-examples). Play with them, modify things and get a feel for Mesa and ABMs.
61
+ - Check our open [issues](https://github.com/projectmesa/mesa-examples/issues) for the examples.
62
+ - If you see anything you want to improve, feel free to open a (small) PR!
63
+ - If you have a feel for Mesa, check our [discussions](https://github.com/projectmesa/mesa/discussions) and [issues](https://github.com/projectmesa/mesa/issues).
64
+ - Also go thought our [release notes](https://github.com/projectmesa/mesa/releases) to see what we recently have been working on, and see some examples of successful PRs.
65
+ - Once you found or thought of a nice idea, comment on the issue/discussion (or open a new one) and get to work!
66
+
67
+ ### I'm both
68
+ That's great! You can just start working on things, reach out to us. Skim to the list above if you feel you're missing anything. Start small but don't be afraid to dream big!
69
+
70
+ ### I'm neither
71
+ Start with creating your own models, for fun. Once you have some experience, move to the topics above.
72
+
39
73
  ## Testing and Code Standards
40
74
 
41
75
  ```{image} https://codecov.io/gh/projectmesa/mesa/branch/main/graph/badge.svg
@@ -1,6 +1,107 @@
1
1
  ---
2
2
  title: Release History
3
3
  ---
4
+ # 3.0.0a4 (2024-09-09)
5
+ ## Highlights
6
+ Mesa 3.0.0a4 contains two major breaking changes:
7
+ 1. The Agent's `unique_id` is now automatically assigned, so doesn't need to be passed to the Agent class anymore. In a subclassed custom Agent, like normally used, this now looks like this:
8
+ ```diff
9
+ class Wolf(Agent):
10
+ - def __init__(self, unique_id, model, energy=None):
11
+ + def __init__(self, model, energy=None):
12
+ # When initializing the super class (Agent), passing unique_id isn't needed anymore
13
+ - super().__init__(unique_id, model)
14
+ + super().__init__(model)
15
+
16
+ - wolf = Wolf(unique_id, model)
17
+ + wolf = Wolf(model)
18
+ ```
19
+ 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
+
21
+ 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/en/latest/tutorials/visualization_tutorial.html).
23
+ - 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
+ - The old SolaraViz API is still available at `mesa.experimental`, but might be removed in future releases.
25
+
26
+ Furthermore, the AgentSet has a new `agg` method to quickly get an aggerate value (for example `min_energy = model.agents.agg("energy", min)`) ([#2266](https://github.com/projectmesa/mesa/pull/2266)), The Model `get_agents_of_type` function is replaced by directly exposing the `agents_by_type` property (which can be accessed as a dict) ([#2267](https://github.com/projectmesa/mesa/pull/2267), [mesa-examples#190](https://github.com/projectmesa/mesa-examples/pull/190)) and the AgentSet get() methods can now handle missing values by replacing it with a default value ([#2279](https://github.com/projectmesa/mesa/pull/2279)).
27
+
28
+ Finally, it fixes a bug in which the Grid's `move_agent_to_one_of` method with `selection="closest"` selected a location deterministically, instead of randomly ([#2118](https://github.com/projectmesa/mesa/pull/2118)).
29
+
30
+ ## What's Changed
31
+ ### ⚠️ Breaking changes
32
+ * move solara_viz back to experimental by @Corvince in https://github.com/projectmesa/mesa/pull/2278
33
+ * track unique_id automatically by @quaquel in https://github.com/projectmesa/mesa/pull/2260
34
+ ### 🎉 New features added
35
+ * AgentSet: Add `agg` method by @EwoutH in https://github.com/projectmesa/mesa/pull/2266
36
+ * Implement new SolaraViz API by @Corvince in https://github.com/projectmesa/mesa/pull/2263
37
+ ### 🛠 Enhancements made
38
+ * Model: Replace `get_agents_of_type` method with `agents_by_type` property by @EwoutH in https://github.com/projectmesa/mesa/pull/2267
39
+ * add default SolaraViz by @Corvince in https://github.com/projectmesa/mesa/pull/2280
40
+ * Simplify ModelController by @Corvince in https://github.com/projectmesa/mesa/pull/2282
41
+ * Add default values and missing value handling to `agentset.get` by @quaquel in https://github.com/projectmesa/mesa/pull/2279
42
+ ### 🐛 Bugs fixed
43
+ * Fix deterministic behavior in `move_agent_to_one_of` with `selection="closest"` by @OrenBochman in https://github.com/projectmesa/mesa/pull/2118
44
+ ### 📜 Documentation improvements
45
+ * docs: Fix Visualization Tutorial (main branch) by @EwoutH in https://github.com/projectmesa/mesa/pull/2271
46
+ * Docs: Fix broken relative links by removing `.html` suffix by @EwoutH in https://github.com/projectmesa/mesa/pull/2274
47
+ * Readthedocs: Don't let notebook failures pass silently by @EwoutH in https://github.com/projectmesa/mesa/pull/2276
48
+ * Update viz tutorial to the new API by @Corvince in https://github.com/projectmesa/mesa/pull/2289
49
+ ### 🔧 Maintenance
50
+ * Resolve multiprocessing warning, state Python 3.13 support by @rht in https://github.com/projectmesa/mesa/pull/2246
51
+
52
+ ## New Contributors
53
+ * @OrenBochman made their first contribution in https://github.com/projectmesa/mesa/pull/2118
54
+
55
+ **Full Changelog**: https://github.com/projectmesa/mesa/compare/v3.0.0a3...v3.0.0a4
56
+
57
+ # 3.0.0a3 (2024-08-30)
58
+ ## Highlights
59
+ Developments toward Mesa 3.0 are steaming ahead, and our fourth alpha release is packed with features and updates - only 8 days after our third.
60
+
61
+ Mesa 3.0.0a3 contains one breaking change: We now automatically increase the `steps` counter by one at the beginning of each `Model.steps()` call. That means increasing `steps` by hand isn't necessary anymore.
62
+
63
+ The big new features is the experimental Voronoi grid that @vitorfrois implemented in #2084. It allows creating cells in a [Voronoi](https://en.wikipedia.org/wiki/Voronoi_diagram) layout as part of the experimental cell space. An example using it to model Cholera spread can be [found here](https://github.com/projectmesa/mesa-examples/pull/118).
64
+
65
+ The AgentSet got a lot of love with two brand new methods: `.groupby()` to split in groups (#2220) and `.set()` to easily assign variables to all agents in that set (#2254). The `select()` method is improved by allowing to select at most a fraction of the agents (#2253), and we split the `do()` method in `do()` and `map()` to make a distinction between the return types (#2237).
66
+
67
+ Furthermore, we improved the performance of accessing `Model.agents`, squashed a bug in SolaraViz, started testing on Python 3.13 and added a new benchmark model.
68
+
69
+ Our example models also got more love: We removed the `RandomActivation` scheduler in 14 models and removed SimultaneousActivation in 3 models ([examples#183](https://github.com/projectmesa/mesa-examples/pull/183)). They now use the automatic step increase and AgentSet functionality. We started testing our GIS model in CI ([examples#171](https://github.com/projectmesa/mesa-examples/pull/171)) and resolved a lot of bugs in them ([examples#172](https://github.com/projectmesa/mesa-examples/issues/172), help appreciated!).
70
+
71
+ 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
+
73
+ To help the transition to Mesa 3.0, we started writing a [migration guide](https://mesa.readthedocs.io/en/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
+
75
+ This pre-release can be installed as always with `pip install --pre mesa`
76
+
77
+ ## What's Changed
78
+ ### ⚠️ Breaking changes
79
+ * model: Automatically increase `steps` counter by @EwoutH in https://github.com/projectmesa/mesa/pull/2223
80
+ ### 🧪 Experimental features
81
+ * Voronoi Tessellation based Discrete Space by @vitorfrois in https://github.com/projectmesa/mesa/pull/2084
82
+ ### 🎉 New features added
83
+ * Add AgentSet.groupby by @quaquel in https://github.com/projectmesa/mesa/pull/2220
84
+ * AgentSet: Add `set` method by @EwoutH in https://github.com/projectmesa/mesa/pull/2254
85
+ ### 🛠 Enhancements made
86
+ * Split AgentSet into map and do to separate return types by @quaquel in https://github.com/projectmesa/mesa/pull/2237
87
+ * Performance enhancements for Model.agents by @quaquel in https://github.com/projectmesa/mesa/pull/2251
88
+ * AgentSet: Allow selecting a fraction of agents in the AgentSet by @EwoutH in https://github.com/projectmesa/mesa/pull/2253
89
+ ### 🐛 Bugs fixed
90
+ * SolaraViz: Reset components when params are changed by @rht in https://github.com/projectmesa/mesa/pull/2240
91
+ ### 📜 Documentation improvements
92
+ * Contribution: Add "I have no idea where to start" section by @EwoutH in https://github.com/projectmesa/mesa/pull/2258
93
+ * Write initial Mesa Migration guide by @EwoutH in https://github.com/projectmesa/mesa/pull/2257
94
+ ### 🔧 Maintenance
95
+ * CI: Add test job for Python 3.13 by @EwoutH in https://github.com/projectmesa/mesa/pull/2173
96
+ * Add pull request templates by @EwoutH in https://github.com/projectmesa/mesa/pull/2217
97
+ * benchmarks: Add BoltzmannWealth model by @EwoutH in https://github.com/projectmesa/mesa/pull/2252
98
+ * CI: Add optional dependency for examples by @EwoutH in https://github.com/projectmesa/mesa/pull/2261
99
+
100
+ ## New Contributors
101
+ * @vitorfrois made their first contribution in https://github.com/projectmesa/mesa/pull/2084
102
+
103
+ **Full Changelog**: https://github.com/projectmesa/mesa/compare/v3.0.0a2...v3.0.0a3
104
+
4
105
  # 3.0.0a2 (2024-08-21)
5
106
  ## Highlights
6
107
  In Mesa 3.0 alpha 2 (`v3.0.0a2`) we've done more clean-up in preparation for Mesa 3.0. We now [require](https://github.com/projectmesa/mesa/pull/2218) `super().__init__()` to run on initializing a Mesa model subclass, `Model.agents` is now fully reserved for the Model's internal AgentSet and we fixed a bug in our Solara space_drawer.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: Mesa
3
- Version: 3.0.0a2
3
+ Version: 3.0.0a4
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
@@ -17,6 +17,7 @@ Classifier: Programming Language :: Python :: 3 :: Only
17
17
  Classifier: Programming Language :: Python :: 3.10
18
18
  Classifier: Programming Language :: Python :: 3.11
19
19
  Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
20
21
  Classifier: Topic :: Scientific/Engineering
21
22
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
23
  Classifier: Topic :: Scientific/Engineering :: Artificial Life
@@ -42,6 +43,9 @@ Requires-Dist: myst-parser; extra == 'docs'
42
43
  Requires-Dist: pydata-sphinx-theme; extra == 'docs'
43
44
  Requires-Dist: seaborn; extra == 'docs'
44
45
  Requires-Dist: sphinx; extra == 'docs'
46
+ Provides-Extra: examples
47
+ Requires-Dist: pytest>=4.6; extra == 'examples'
48
+ Requires-Dist: scipy; extra == 'examples'
45
49
  Description-Content-Type: text/markdown
46
50
 
47
51
  # Mesa: Agent-based modeling in Python
@@ -98,15 +102,18 @@ Or any other (development) branch on this repo or your own fork:
98
102
  pip install -U -e git+https://github.com/YOUR_FORK/mesa@YOUR_BRANCH#egg=mesa
99
103
  ```
100
104
 
105
+ ## Resources
101
106
  For resources or help on using Mesa, check out the following:
102
107
 
103
108
  - [Intro to Mesa Tutorial](http://mesa.readthedocs.org/en/stable/tutorials/intro_tutorial.html) (An introductory model, the Boltzmann
104
109
  Wealth Model, for beginners or those new to Mesa.)
110
+ - [Visualization Tutorial](https://mesa.readthedocs.io/en/stable/tutorials/visualization_tutorial.html) (An introduction into our Solara visualization)
105
111
  - [Complexity Explorer Tutorial](https://www.complexityexplorer.org/courses/172-agent-based-models-with-python-an-introduction-to-mesa) (An advanced-beginner model,
106
112
  SugarScape with Traders, with instructional videos)
107
113
  - [Mesa Examples](https://github.com/projectmesa/mesa-examples/tree/main/examples) (A repository of seminal ABMs using Mesa and
108
114
  examples of employing specific Mesa Features)
109
115
  - [Docs](http://mesa.readthedocs.org/) (Mesa's documentation, API and useful snippets)
116
+ - [Development version docs](https://mesa.readthedocs.io/en/latest/) (the latest version docs if you're using a pre-release Mesa version)
110
117
  - [Discussions](https://github.com/projectmesa/mesa/discussions) (GitHub threaded discussions about Mesa)
111
118
  - [Matrix Chat](https://matrix.to/#/#project-mesa:matrix.org) (Chat Forum via Matrix to talk about Mesa)
112
119
 
@@ -52,15 +52,18 @@ Or any other (development) branch on this repo or your own fork:
52
52
  pip install -U -e git+https://github.com/YOUR_FORK/mesa@YOUR_BRANCH#egg=mesa
53
53
  ```
54
54
 
55
+ ## Resources
55
56
  For resources or help on using Mesa, check out the following:
56
57
 
57
58
  - [Intro to Mesa Tutorial](http://mesa.readthedocs.org/en/stable/tutorials/intro_tutorial.html) (An introductory model, the Boltzmann
58
59
  Wealth Model, for beginners or those new to Mesa.)
60
+ - [Visualization Tutorial](https://mesa.readthedocs.io/en/stable/tutorials/visualization_tutorial.html) (An introduction into our Solara visualization)
59
61
  - [Complexity Explorer Tutorial](https://www.complexityexplorer.org/courses/172-agent-based-models-with-python-an-introduction-to-mesa) (An advanced-beginner model,
60
62
  SugarScape with Traders, with instructional videos)
61
63
  - [Mesa Examples](https://github.com/projectmesa/mesa-examples/tree/main/examples) (A repository of seminal ABMs using Mesa and
62
64
  examples of employing specific Mesa Features)
63
65
  - [Docs](http://mesa.readthedocs.org/) (Mesa's documentation, API and useful snippets)
66
+ - [Development version docs](https://mesa.readthedocs.io/en/latest/) (the latest version docs if you're using a pre-release Mesa version)
64
67
  - [Discussions](https://github.com/projectmesa/mesa/discussions) (GitHub threaded discussions about Mesa)
65
68
  - [Matrix Chat](https://matrix.to/#/#project-mesa:matrix.org) (Chat Forum via Matrix to talk about Mesa)
66
69
 
@@ -0,0 +1,77 @@
1
+ # https://github.com/projectmesa/mesa-examples/blob/main/examples/boltzmann_wealth_model_experimental/model.py
2
+ import mesa
3
+
4
+
5
+ def compute_gini(model):
6
+ agent_wealths = [agent.wealth for agent in model.agents]
7
+ x = sorted(agent_wealths)
8
+ n = model.num_agents
9
+ b = sum(xi * (n - i) for i, xi in enumerate(x)) / (n * sum(x))
10
+ return 1 + (1 / n) - 2 * b
11
+
12
+
13
+ class BoltzmannWealth(mesa.Model):
14
+ """A simple model of an economy where agents exchange currency at random.
15
+
16
+ All the agents begin with one unit of currency, and each time step can give
17
+ a unit of currency to another agent. Note how, over time, this produces a
18
+ highly skewed distribution of wealth.
19
+ """
20
+
21
+ def __init__(self, seed=None, n=100, width=10, height=10):
22
+ super().__init__()
23
+ self.num_agents = n
24
+ self.grid = mesa.space.MultiGrid(width, height, True)
25
+ self.schedule = mesa.time.RandomActivation(self)
26
+ self.datacollector = mesa.DataCollector(
27
+ model_reporters={"Gini": compute_gini}, agent_reporters={"Wealth": "wealth"}
28
+ )
29
+ # Create agents
30
+ for _ in range(self.num_agents):
31
+ a = MoneyAgent(self)
32
+ # Add the agent to a random grid cell
33
+ x = self.random.randrange(self.grid.width)
34
+ y = self.random.randrange(self.grid.height)
35
+ self.grid.place_agent(a, (x, y))
36
+
37
+ self.running = True
38
+ self.datacollector.collect(self)
39
+
40
+ def step(self):
41
+ self.agents.shuffle().do("step")
42
+ # collect data
43
+ self.datacollector.collect(self)
44
+
45
+ def run_model(self, n):
46
+ for _i in range(n):
47
+ self.step()
48
+
49
+
50
+ class MoneyAgent(mesa.Agent):
51
+ """An agent with fixed initial wealth."""
52
+
53
+ def __init__(self, model):
54
+ super().__init__(model)
55
+ self.wealth = 1
56
+
57
+ def move(self):
58
+ possible_steps = self.model.grid.get_neighborhood(
59
+ self.pos, moore=True, include_center=False
60
+ )
61
+ new_position = self.random.choice(possible_steps)
62
+ self.model.grid.move_agent(self, new_position)
63
+
64
+ def give_money(self):
65
+ cellmates = self.model.grid.get_cell_list_contents([self.pos])
66
+ cellmates.pop(
67
+ cellmates.index(self)
68
+ ) # Ensure agent is not giving money to itself
69
+ if len(cellmates) > 0:
70
+ other = self.random.choice(cellmates)
71
+ other.wealth += 1
72
+ self.wealth -= 1
73
+
74
+ def step(self):
75
+ self.move()
76
+ if self.wealth > 0:
77
+ self.give_money()
@@ -27,7 +27,6 @@ class Boid(mesa.Agent):
27
27
 
28
28
  def __init__(
29
29
  self,
30
- unique_id,
31
30
  model,
32
31
  speed,
33
32
  direction,
@@ -41,7 +40,6 @@ class Boid(mesa.Agent):
41
40
  Create a new Boid flocker agent.
42
41
 
43
42
  Args:
44
- unique_id: Unique agent identifier.
45
43
  speed: Distance to move per step.
46
44
  direction: numpy vector for the Boid's direction of movement.
47
45
  vision: Radius to look around for nearby Boids.
@@ -51,7 +49,7 @@ class Boid(mesa.Agent):
51
49
  match: the relative importance of matching neighbors' directions
52
50
 
53
51
  """
54
- super().__init__(unique_id, model)
52
+ super().__init__(model)
55
53
  self.speed = speed
56
54
  self.direction = direction
57
55
  self.vision = vision
@@ -131,13 +129,12 @@ class BoidFlockers(mesa.Model):
131
129
  "match": match,
132
130
  }
133
131
 
134
- for i in range(self.population):
132
+ for _ in range(self.population):
135
133
  x = self.random.random() * self.space.x_max
136
134
  y = self.random.random() * self.space.y_max
137
135
  pos = np.array((x, y))
138
136
  direction = np.random.random(2) * 2 - 1
139
137
  boid = Boid(
140
- unique_id=i,
141
138
  model=self,
142
139
  speed=speed,
143
140
  direction=direction,
@@ -8,15 +8,14 @@ class SchellingAgent(CellAgent):
8
8
  Schelling segregation agent
9
9
  """
10
10
 
11
- def __init__(self, unique_id, model, agent_type, radius, homophily):
11
+ def __init__(self, model, agent_type, radius, homophily):
12
12
  """
13
13
  Create a new Schelling agent.
14
14
  Args:
15
- unique_id: Unique identifier for the agent.
16
15
  x, y: Agent initial location.
17
16
  agent_type: Indicator for the agent's type (minority=1, majority=0)
18
17
  """
19
- super().__init__(unique_id, model)
18
+ super().__init__(model)
20
19
  self.type = agent_type
21
20
  self.radius = radius
22
21
  self.homophily = homophily
@@ -81,9 +80,7 @@ class Schelling(Model):
81
80
  for cell in self.grid:
82
81
  if self.random.random() < density:
83
82
  agent_type = 1 if self.random.random() < self.minority_pc else 0
84
- agent = SchellingAgent(
85
- self.next_id(), self, agent_type, radius, homophily
86
- )
83
+ agent = SchellingAgent(self, agent_type, radius, homophily)
87
84
  agent.move_to(cell)
88
85
  self.schedule.add(agent)
89
86
 
@@ -17,8 +17,8 @@ from mesa.experimental.devs import ABMSimulator
17
17
 
18
18
 
19
19
  class Animal(CellAgent):
20
- def __init__(self, unique_id, model, energy, p_reproduce, energy_from_food):
21
- super().__init__(unique_id, model)
20
+ def __init__(self, model, energy, p_reproduce, energy_from_food):
21
+ super().__init__(model)
22
22
  self.energy = energy
23
23
  self.p_reproduce = p_reproduce
24
24
  self.energy_from_food = energy_from_food
@@ -29,7 +29,6 @@ class Animal(CellAgent):
29
29
  def spawn_offspring(self):
30
30
  self.energy /= 2
31
31
  offspring = self.__class__(
32
- self.model.next_id(),
33
32
  self.model,
34
33
  self.energy,
35
34
  self.p_reproduce,
@@ -107,7 +106,7 @@ class GrassPatch(CellAgent):
107
106
  function_args=[self, "fully_grown", True],
108
107
  )
109
108
 
110
- def __init__(self, unique_id, model, fully_grown, countdown, grass_regrowth_time):
109
+ def __init__(self, model, fully_grown, countdown, grass_regrowth_time):
111
110
  """
112
111
  TODO:: fully grown can just be an int --> so one less param (i.e. countdown)
113
112
 
@@ -119,7 +118,7 @@ class GrassPatch(CellAgent):
119
118
  grass_regrowth_time : time to fully regrow grass
120
119
  countdown : Time for the patch of grass to be fully regrown if fully grown is False
121
120
  """
122
- super().__init__(unique_id, model)
121
+ super().__init__(model)
123
122
  self._fully_grown = fully_grown
124
123
  self.grass_regrowth_time = grass_regrowth_time
125
124
 
@@ -189,7 +188,6 @@ class WolfSheep(Model):
189
188
  )
190
189
  energy = self.random.randrange(2 * sheep_gain_from_food)
191
190
  sheep = Sheep(
192
- self.next_id(),
193
191
  self,
194
192
  energy,
195
193
  sheep_reproduce,
@@ -205,7 +203,6 @@ class WolfSheep(Model):
205
203
  )
206
204
  energy = self.random.randrange(2 * wolf_gain_from_food)
207
205
  wolf = Wolf(
208
- self.next_id(),
209
206
  self,
210
207
  energy,
211
208
  wolf_reproduce,
@@ -221,14 +218,12 @@ class WolfSheep(Model):
221
218
  countdown = grass_regrowth_time
222
219
  else:
223
220
  countdown = self.random.randrange(grass_regrowth_time)
224
- patch = GrassPatch(
225
- self.next_id(), self, fully_grown, countdown, grass_regrowth_time
226
- )
221
+ patch = GrassPatch(self, fully_grown, countdown, grass_regrowth_time)
227
222
  patch.move_to(cell)
228
223
 
229
224
  def step(self):
230
- self.get_agents_of_type(Sheep).shuffle(inplace=True).do("step")
231
- self.get_agents_of_type(Wolf).shuffle(inplace=True).do("step")
225
+ self.agents_by_type[Sheep].shuffle(inplace=True).do("step")
226
+ self.agents_by_type[Wolf].shuffle(inplace=True).do("step")
232
227
 
233
228
 
234
229
  if __name__ == "__main__":
@@ -1,8 +1,32 @@
1
+ from BoltzmannWealth.boltzmann_wealth import BoltzmannWealth
1
2
  from Flocking.flocking import BoidFlockers
2
3
  from Schelling.schelling import Schelling
3
4
  from WolfSheep.wolf_sheep import WolfSheep
4
5
 
5
6
  configurations = {
7
+ # Schelling Model Configurations
8
+ BoltzmannWealth: {
9
+ "small": {
10
+ "seeds": 50,
11
+ "replications": 5,
12
+ "steps": 125,
13
+ "parameters": {
14
+ "n": 100,
15
+ "width": 10,
16
+ "height": 10,
17
+ },
18
+ },
19
+ "large": {
20
+ "seeds": 10,
21
+ "replications": 3,
22
+ "steps": 10,
23
+ "parameters": {
24
+ "n": 10000,
25
+ "width": 100,
26
+ "height": 100,
27
+ },
28
+ },
29
+ },
6
30
  # Schelling Model Configurations
7
31
  Schelling: {
8
32
  "small": {
@@ -35,7 +59,7 @@ configurations = {
35
59
  "small": {
36
60
  "seeds": 50,
37
61
  "replications": 5,
38
- "steps": 40,
62
+ "steps": 80,
39
63
  "parameters": {
40
64
  "height": 25,
41
65
  "width": 25,
@@ -16,18 +16,22 @@ sys.path.insert(0, os.path.abspath(".."))
16
16
 
17
17
  # Generic function to initialize and run a model
18
18
  def run_model(model_class, seed, parameters):
19
+ no_simulator = ["BoltzmannWealth"]
19
20
  start_init = timeit.default_timer()
20
- simulator = ABMSimulator()
21
- model = model_class(simulator=simulator, seed=seed, **parameters)
22
- simulator.setup(model)
21
+ if model_class.__name__ in no_simulator:
22
+ model = model_class(seed=seed, **parameters)
23
+ else:
24
+ simulator = ABMSimulator()
25
+ model = model_class(simulator=simulator, seed=seed, **parameters)
26
+ simulator.setup(model)
23
27
 
24
28
  end_init_start_run = timeit.default_timer()
25
29
 
26
- simulator.run_for(config["steps"])
30
+ if model_class.__name__ in no_simulator:
31
+ model.run_model(config["steps"])
32
+ else:
33
+ simulator.run_for(config["steps"])
27
34
 
28
- # for _ in range(config["steps"]):
29
- # model.step()
30
- # time.sleep(0.0001)
31
35
  end_run = timeit.default_timer()
32
36
 
33
37
  return (end_init_start_run - start_init), (end_run - end_init_start_run)
@@ -113,6 +113,8 @@ pygments_style = "gruvbox-dark"
113
113
 
114
114
  nb_execution_timeout = 60
115
115
  nb_execution_mode = "cache"
116
+ nb_execution_allow_errors = False
117
+ nb_execution_raise_on_error = True
116
118
 
117
119
  # -- Options for HTML output ----------------------------------------------
118
120
 
@@ -81,6 +81,7 @@ ABM features users have shared that you may want to use in your model
81
81
  Mesa Overview <overview>
82
82
  tutorials/intro_tutorial
83
83
  tutorials/visualization_tutorial
84
+ Migration guide <migration_guide>
84
85
  Best Practices <best-practices>
85
86
  How-to Guide <howto>
86
87
  API Documentation <apis/api_main>
@@ -98,7 +99,7 @@ Mesa Packages <packages>
98
99
  [github issue tracker]: https://github.com/projectmesa/mesa/issues
99
100
  [matrix chat room]: https://matrix.to/#/#project-mesa:matrix.org
100
101
  [mesa]: https://github.com/projectmesa/mesa/
101
- [mesa introductory tutorial]: tutorials/intro_tutorial.html
102
- [mesa visualization tutorial]: tutorials/visualization_tutorial.html
102
+ [mesa introductory tutorial]: tutorials/intro_tutorial
103
+ [mesa visualization tutorial]: tutorials/visualization_tutorial
103
104
  [pypi]: https://pypi.python.org/pypi/Mesa/
104
105
  [ticket]: https://github.com/projectmesa/mesa/issues