Mesa 3.0.0__py3-none-any.whl → 3.0.0a0__py3-none-any.whl
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/__init__.py +3 -3
- mesa/agent.py +114 -406
- mesa/batchrunner.py +27 -54
- mesa/cookiecutter-mesa/cookiecutter.json +8 -0
- mesa/cookiecutter-mesa/hooks/post_gen_project.py +11 -0
- mesa/cookiecutter-mesa/{{cookiecutter.snake}}/README.md +4 -0
- mesa/cookiecutter-mesa/{{cookiecutter.snake}}/app.pytemplate +27 -0
- mesa/cookiecutter-mesa/{{cookiecutter.snake}}/setup.pytemplate +11 -0
- mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}/model.pytemplate +60 -0
- mesa/datacollection.py +29 -140
- mesa/experimental/__init__.py +1 -11
- mesa/experimental/cell_space/__init__.py +1 -16
- mesa/experimental/cell_space/cell.py +23 -93
- mesa/experimental/cell_space/cell_agent.py +21 -117
- mesa/experimental/cell_space/cell_collection.py +17 -54
- mesa/experimental/cell_space/discrete_space.py +8 -92
- mesa/experimental/cell_space/grid.py +8 -32
- mesa/experimental/cell_space/network.py +7 -12
- mesa/experimental/devs/__init__.py +0 -2
- mesa/experimental/devs/eventlist.py +14 -52
- mesa/experimental/devs/examples/epstein_civil_violence.py +39 -71
- mesa/experimental/devs/examples/wolf_sheep.py +45 -45
- mesa/experimental/devs/simulator.py +15 -55
- mesa/main.py +63 -0
- mesa/model.py +83 -211
- mesa/space.py +149 -215
- mesa/time.py +77 -62
- mesa/{experimental → visualization}/UserParam.py +6 -17
- mesa/visualization/__init__.py +2 -25
- mesa/{experimental → visualization}/components/altair.py +0 -10
- mesa/visualization/components/matplotlib.py +134 -0
- mesa/{experimental/solara_viz.py → visualization/jupyter_viz.py} +110 -65
- {mesa-3.0.0.dist-info → mesa-3.0.0a0.dist-info}/METADATA +13 -65
- mesa-3.0.0a0.dist-info/RECORD +38 -0
- mesa-3.0.0.dist-info/licenses/NOTICE → mesa-3.0.0a0.dist-info/licenses/LICENSE +2 -2
- mesa/examples/README.md +0 -37
- mesa/examples/__init__.py +0 -21
- mesa/examples/advanced/epstein_civil_violence/Epstein Civil Violence.ipynb +0 -116
- mesa/examples/advanced/epstein_civil_violence/Readme.md +0 -34
- mesa/examples/advanced/epstein_civil_violence/__init__.py +0 -0
- mesa/examples/advanced/epstein_civil_violence/agents.py +0 -164
- mesa/examples/advanced/epstein_civil_violence/app.py +0 -73
- mesa/examples/advanced/epstein_civil_violence/model.py +0 -114
- mesa/examples/advanced/pd_grid/Readme.md +0 -43
- mesa/examples/advanced/pd_grid/__init__.py +0 -0
- mesa/examples/advanced/pd_grid/agents.py +0 -50
- mesa/examples/advanced/pd_grid/analysis.ipynb +0 -228
- mesa/examples/advanced/pd_grid/app.py +0 -54
- mesa/examples/advanced/pd_grid/model.py +0 -71
- mesa/examples/advanced/sugarscape_g1mt/Readme.md +0 -64
- mesa/examples/advanced/sugarscape_g1mt/__init__.py +0 -0
- mesa/examples/advanced/sugarscape_g1mt/agents.py +0 -344
- mesa/examples/advanced/sugarscape_g1mt/app.py +0 -62
- mesa/examples/advanced/sugarscape_g1mt/model.py +0 -180
- mesa/examples/advanced/sugarscape_g1mt/sugar-map.txt +0 -50
- mesa/examples/advanced/sugarscape_g1mt/tests.py +0 -69
- mesa/examples/advanced/wolf_sheep/Readme.md +0 -57
- mesa/examples/advanced/wolf_sheep/__init__.py +0 -0
- mesa/examples/advanced/wolf_sheep/agents.py +0 -102
- mesa/examples/advanced/wolf_sheep/app.py +0 -84
- mesa/examples/advanced/wolf_sheep/model.py +0 -137
- mesa/examples/basic/__init__.py +0 -0
- mesa/examples/basic/boid_flockers/Readme.md +0 -22
- mesa/examples/basic/boid_flockers/__init__.py +0 -0
- mesa/examples/basic/boid_flockers/agents.py +0 -71
- mesa/examples/basic/boid_flockers/app.py +0 -58
- mesa/examples/basic/boid_flockers/model.py +0 -69
- mesa/examples/basic/boltzmann_wealth_model/Readme.md +0 -56
- mesa/examples/basic/boltzmann_wealth_model/__init__.py +0 -0
- mesa/examples/basic/boltzmann_wealth_model/agents.py +0 -31
- mesa/examples/basic/boltzmann_wealth_model/app.py +0 -74
- mesa/examples/basic/boltzmann_wealth_model/model.py +0 -43
- mesa/examples/basic/boltzmann_wealth_model/st_app.py +0 -115
- mesa/examples/basic/conways_game_of_life/Readme.md +0 -39
- mesa/examples/basic/conways_game_of_life/__init__.py +0 -0
- mesa/examples/basic/conways_game_of_life/agents.py +0 -47
- mesa/examples/basic/conways_game_of_life/app.py +0 -51
- mesa/examples/basic/conways_game_of_life/model.py +0 -31
- mesa/examples/basic/conways_game_of_life/st_app.py +0 -72
- mesa/examples/basic/schelling/Readme.md +0 -40
- mesa/examples/basic/schelling/__init__.py +0 -0
- mesa/examples/basic/schelling/agents.py +0 -26
- mesa/examples/basic/schelling/analysis.ipynb +0 -205
- mesa/examples/basic/schelling/app.py +0 -42
- mesa/examples/basic/schelling/model.py +0 -59
- mesa/examples/basic/virus_on_network/Readme.md +0 -61
- mesa/examples/basic/virus_on_network/__init__.py +0 -0
- mesa/examples/basic/virus_on_network/agents.py +0 -69
- mesa/examples/basic/virus_on_network/app.py +0 -114
- mesa/examples/basic/virus_on_network/model.py +0 -96
- mesa/experimental/cell_space/voronoi.py +0 -257
- mesa/experimental/components/matplotlib.py +0 -242
- mesa/visualization/components/__init__.py +0 -83
- mesa/visualization/components/altair_components.py +0 -188
- mesa/visualization/components/matplotlib_components.py +0 -175
- mesa/visualization/mpl_space_drawing.py +0 -593
- mesa/visualization/solara_viz.py +0 -458
- mesa/visualization/user_param.py +0 -69
- mesa/visualization/utils.py +0 -9
- mesa-3.0.0.dist-info/RECORD +0 -95
- mesa-3.0.0.dist-info/licenses/LICENSE +0 -202
- /mesa/{examples/advanced → cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}}/__init__.py +0 -0
- {mesa-3.0.0.dist-info → mesa-3.0.0a0.dist-info}/WHEEL +0 -0
- {mesa-3.0.0.dist-info → mesa-3.0.0a0.dist-info}/entry_points.txt +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Mesa visualization module for creating interactive model visualizations.
|
|
2
3
|
|
|
3
4
|
This module provides components to create browser- and Jupyter notebook-based visualizations of
|
|
4
5
|
Mesa models, allowing users to watch models run step-by-step and interact with model parameters.
|
|
5
6
|
|
|
6
7
|
Key features:
|
|
7
|
-
-
|
|
8
|
+
- JupyterViz: Main component for creating visualizations, supporting grid displays and plots
|
|
8
9
|
- ModelController: Handles model execution controls (step, play, pause, reset)
|
|
9
10
|
- UserInputs: Generates UI elements for adjusting model parameters
|
|
10
11
|
- Card: Renders individual visualization elements (space, measures)
|
|
@@ -16,21 +17,22 @@ custom visualization components.
|
|
|
16
17
|
Usage:
|
|
17
18
|
1. Define an agent_portrayal function to specify how agents should be displayed
|
|
18
19
|
2. Set up model_params to define adjustable parameters
|
|
19
|
-
3. Create a
|
|
20
|
+
3. Create a JupyterViz instance with your model, parameters, and desired measures
|
|
20
21
|
4. Display the visualization in a Jupyter notebook or run as a Solara app
|
|
21
22
|
|
|
22
23
|
See the Visualization Tutorial and example models for more details.
|
|
23
24
|
"""
|
|
24
25
|
|
|
26
|
+
import sys
|
|
25
27
|
import threading
|
|
26
28
|
|
|
27
29
|
import reacton.ipywidgets as widgets
|
|
28
30
|
import solara
|
|
29
31
|
from solara.alias import rv
|
|
30
32
|
|
|
31
|
-
import mesa.
|
|
32
|
-
import mesa.
|
|
33
|
-
from mesa.
|
|
33
|
+
import mesa.visualization.components.altair as components_altair
|
|
34
|
+
import mesa.visualization.components.matplotlib as components_matplotlib
|
|
35
|
+
from mesa.visualization.UserParam import Slider
|
|
34
36
|
|
|
35
37
|
|
|
36
38
|
# TODO: Turn this function into a Solara component once the current_step.value
|
|
@@ -38,7 +40,8 @@ from mesa.experimental.UserParam import Slider
|
|
|
38
40
|
def Card(
|
|
39
41
|
model, measures, agent_portrayal, space_drawer, dependencies, color, layout_type
|
|
40
42
|
):
|
|
41
|
-
"""
|
|
43
|
+
"""
|
|
44
|
+
Create a card component for visualizing model space or measures.
|
|
42
45
|
|
|
43
46
|
Args:
|
|
44
47
|
model: The Mesa model instance
|
|
@@ -68,7 +71,7 @@ def Card(
|
|
|
68
71
|
)
|
|
69
72
|
elif space_drawer:
|
|
70
73
|
# if specified, draw agent space with an alternate renderer
|
|
71
|
-
space_drawer(model, agent_portrayal
|
|
74
|
+
space_drawer(model, agent_portrayal)
|
|
72
75
|
elif "Measure" in layout_type:
|
|
73
76
|
rv.CardTitle(children=["Measure"])
|
|
74
77
|
measure = measures[layout_type["Measure"]]
|
|
@@ -83,7 +86,7 @@ def Card(
|
|
|
83
86
|
|
|
84
87
|
|
|
85
88
|
@solara.component
|
|
86
|
-
def
|
|
89
|
+
def JupyterViz(
|
|
87
90
|
model_class,
|
|
88
91
|
model_params,
|
|
89
92
|
measures=None,
|
|
@@ -93,15 +96,15 @@ def SolaraViz(
|
|
|
93
96
|
play_interval=150,
|
|
94
97
|
seed=None,
|
|
95
98
|
):
|
|
96
|
-
"""
|
|
99
|
+
"""
|
|
100
|
+
Initialize a component to visualize a model.
|
|
97
101
|
|
|
98
102
|
Args:
|
|
99
103
|
model_class: Class of the model to instantiate
|
|
100
104
|
model_params: Parameters for initializing the model
|
|
101
105
|
measures: List of callables or data attributes to plot
|
|
102
106
|
name: Name for display
|
|
103
|
-
agent_portrayal: Options for rendering agents (dictionary)
|
|
104
|
-
Default drawer supports custom `"size"`, `"color"`, and `"shape"`.
|
|
107
|
+
agent_portrayal: Options for rendering agents (dictionary)
|
|
105
108
|
space_drawer: Method to render the agent space for
|
|
106
109
|
the model; default implementation is the `SpaceMatplotlib` component;
|
|
107
110
|
simulations with no space to visualize should
|
|
@@ -155,61 +158,98 @@ def SolaraViz(
|
|
|
155
158
|
"""Update the random seed for the model."""
|
|
156
159
|
reactive_seed.value = model.random.random()
|
|
157
160
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
current_step.value,
|
|
161
|
-
reactive_seed.value,
|
|
162
|
-
]
|
|
163
|
-
|
|
164
|
-
# if space drawer is disabled, do not include it
|
|
165
|
-
layout_types = [{"Space": "default"}] if space_drawer else []
|
|
161
|
+
# jupyter
|
|
162
|
+
dependencies = [current_step.value, reactive_seed.value]
|
|
166
163
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
grid_layout_initial = make_initial_grid_layout(layout_types=layout_types)
|
|
171
|
-
grid_layout, set_grid_layout = solara.use_state(grid_layout_initial)
|
|
172
|
-
|
|
173
|
-
with solara.Sidebar():
|
|
174
|
-
with solara.Card("Controls", margin=1, elevation=2):
|
|
175
|
-
solara.InputText(
|
|
176
|
-
label="Seed",
|
|
177
|
-
value=reactive_seed,
|
|
178
|
-
continuous_update=True,
|
|
179
|
-
)
|
|
164
|
+
def render_in_jupyter():
|
|
165
|
+
"""Render the visualization components in Jupyter notebook."""
|
|
166
|
+
with solara.GridFixed(columns=2):
|
|
180
167
|
UserInputs(user_params, on_change=handle_change_model_params)
|
|
181
168
|
ModelController(model, play_interval, current_step, reset_counter)
|
|
182
|
-
solara.
|
|
183
|
-
with solara.Card("Information", margin=1, elevation=2):
|
|
184
|
-
solara.Markdown(md_text=f"Step - {current_step}")
|
|
185
|
-
|
|
186
|
-
items = [
|
|
187
|
-
Card(
|
|
188
|
-
model,
|
|
189
|
-
measures,
|
|
190
|
-
agent_portrayal,
|
|
191
|
-
space_drawer,
|
|
192
|
-
dependencies,
|
|
193
|
-
color="white",
|
|
194
|
-
layout_type=layout_types[i],
|
|
195
|
-
)
|
|
196
|
-
for i in range(len(layout_types))
|
|
197
|
-
]
|
|
198
|
-
solara.GridDraggable(
|
|
199
|
-
items=items,
|
|
200
|
-
grid_layout=grid_layout,
|
|
201
|
-
resizable=True,
|
|
202
|
-
draggable=True,
|
|
203
|
-
on_grid_layout=set_grid_layout,
|
|
204
|
-
)
|
|
169
|
+
solara.Markdown(md_text=f"###Step - {current_step}")
|
|
205
170
|
|
|
171
|
+
with solara.GridFixed(columns=2):
|
|
172
|
+
# 4. Space
|
|
173
|
+
if space_drawer == "default":
|
|
174
|
+
# draw with the default implementation
|
|
175
|
+
components_matplotlib.SpaceMatplotlib(
|
|
176
|
+
model, agent_portrayal, dependencies=dependencies
|
|
177
|
+
)
|
|
178
|
+
elif space_drawer == "altair":
|
|
179
|
+
components_altair.SpaceAltair(
|
|
180
|
+
model, agent_portrayal, dependencies=dependencies
|
|
181
|
+
)
|
|
182
|
+
elif space_drawer:
|
|
183
|
+
# if specified, draw agent space with an alternate renderer
|
|
184
|
+
space_drawer(model, agent_portrayal)
|
|
185
|
+
# otherwise, do nothing (do not draw space)
|
|
186
|
+
|
|
187
|
+
# 5. Plots
|
|
188
|
+
if measures:
|
|
189
|
+
for measure in measures:
|
|
190
|
+
if callable(measure):
|
|
191
|
+
# Is a custom object
|
|
192
|
+
measure(model)
|
|
193
|
+
else:
|
|
194
|
+
components_matplotlib.PlotMatplotlib(
|
|
195
|
+
model, measure, dependencies=dependencies
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
def render_in_browser():
|
|
199
|
+
"""Render the visualization components in a web browser."""
|
|
200
|
+
# if space drawer is disabled, do not include it
|
|
201
|
+
layout_types = [{"Space": "default"}] if space_drawer else []
|
|
202
|
+
|
|
203
|
+
if measures:
|
|
204
|
+
layout_types += [{"Measure": elem} for elem in range(len(measures))]
|
|
205
|
+
|
|
206
|
+
grid_layout_initial = make_initial_grid_layout(layout_types=layout_types)
|
|
207
|
+
grid_layout, set_grid_layout = solara.use_state(grid_layout_initial)
|
|
208
|
+
|
|
209
|
+
with solara.Sidebar():
|
|
210
|
+
with solara.Card("Controls", margin=1, elevation=2):
|
|
211
|
+
solara.InputText(
|
|
212
|
+
label="Seed",
|
|
213
|
+
value=reactive_seed,
|
|
214
|
+
continuous_update=True,
|
|
215
|
+
)
|
|
216
|
+
UserInputs(user_params, on_change=handle_change_model_params)
|
|
217
|
+
ModelController(model, play_interval, current_step, reset_counter)
|
|
218
|
+
solara.Button(label="Reseed", color="primary", on_click=do_reseed)
|
|
219
|
+
with solara.Card("Information", margin=1, elevation=2):
|
|
220
|
+
solara.Markdown(md_text=f"Step - {current_step}")
|
|
221
|
+
|
|
222
|
+
items = [
|
|
223
|
+
Card(
|
|
224
|
+
model,
|
|
225
|
+
measures,
|
|
226
|
+
agent_portrayal,
|
|
227
|
+
space_drawer,
|
|
228
|
+
dependencies,
|
|
229
|
+
color="white",
|
|
230
|
+
layout_type=layout_types[i],
|
|
231
|
+
)
|
|
232
|
+
for i in range(len(layout_types))
|
|
233
|
+
]
|
|
234
|
+
solara.GridDraggable(
|
|
235
|
+
items=items,
|
|
236
|
+
grid_layout=grid_layout,
|
|
237
|
+
resizable=True,
|
|
238
|
+
draggable=True,
|
|
239
|
+
on_grid_layout=set_grid_layout,
|
|
240
|
+
)
|
|
206
241
|
|
|
207
|
-
|
|
242
|
+
if ("ipykernel" in sys.argv[0]) or ("colab_kernel_launcher.py" in sys.argv[0]):
|
|
243
|
+
# When in Jupyter or Google Colab
|
|
244
|
+
render_in_jupyter()
|
|
245
|
+
else:
|
|
246
|
+
render_in_browser()
|
|
208
247
|
|
|
209
248
|
|
|
210
249
|
@solara.component
|
|
211
250
|
def ModelController(model, play_interval, current_step, reset_counter):
|
|
212
|
-
"""
|
|
251
|
+
"""
|
|
252
|
+
Create controls for model execution (step, play, pause, reset).
|
|
213
253
|
|
|
214
254
|
Args:
|
|
215
255
|
model: The model being visualized
|
|
@@ -240,7 +280,7 @@ def ModelController(model, play_interval, current_step, reset_counter):
|
|
|
240
280
|
"""Advance the model by one step."""
|
|
241
281
|
model.step()
|
|
242
282
|
previous_step.value = current_step.value
|
|
243
|
-
current_step.value = model.
|
|
283
|
+
current_step.value = model._steps
|
|
244
284
|
|
|
245
285
|
def do_play():
|
|
246
286
|
"""Run the model continuously."""
|
|
@@ -311,7 +351,8 @@ def ModelController(model, play_interval, current_step, reset_counter):
|
|
|
311
351
|
|
|
312
352
|
|
|
313
353
|
def split_model_params(model_params):
|
|
314
|
-
"""
|
|
354
|
+
"""
|
|
355
|
+
Split model parameters into user-adjustable and fixed parameters.
|
|
315
356
|
|
|
316
357
|
Args:
|
|
317
358
|
model_params: Dictionary of all model parameters
|
|
@@ -330,7 +371,8 @@ def split_model_params(model_params):
|
|
|
330
371
|
|
|
331
372
|
|
|
332
373
|
def check_param_is_fixed(param):
|
|
333
|
-
"""
|
|
374
|
+
"""
|
|
375
|
+
Check if a parameter is fixed (not user-adjustable).
|
|
334
376
|
|
|
335
377
|
Args:
|
|
336
378
|
param: Parameter to check
|
|
@@ -348,8 +390,8 @@ def check_param_is_fixed(param):
|
|
|
348
390
|
|
|
349
391
|
@solara.component
|
|
350
392
|
def UserInputs(user_params, on_change=None):
|
|
351
|
-
"""
|
|
352
|
-
|
|
393
|
+
"""
|
|
394
|
+
Initialize user inputs for configurable model parameters.
|
|
353
395
|
Currently supports :class:`solara.SliderInt`, :class:`solara.SliderFloat`,
|
|
354
396
|
:class:`solara.Select`, and :class:`solara.Checkbox`.
|
|
355
397
|
|
|
@@ -358,6 +400,7 @@ def UserInputs(user_params, on_change=None):
|
|
|
358
400
|
min and max values, and other fields specific to the input type.
|
|
359
401
|
on_change: Function to be called with (name, value) when the value of an input changes.
|
|
360
402
|
"""
|
|
403
|
+
|
|
361
404
|
for name, options in user_params.items():
|
|
362
405
|
|
|
363
406
|
def change_handler(value, name=name):
|
|
@@ -416,7 +459,8 @@ def UserInputs(user_params, on_change=None):
|
|
|
416
459
|
|
|
417
460
|
|
|
418
461
|
def make_text(renderer):
|
|
419
|
-
"""
|
|
462
|
+
"""
|
|
463
|
+
Create a function that renders text using Markdown.
|
|
420
464
|
|
|
421
465
|
Args:
|
|
422
466
|
renderer: Function that takes a model and returns a string
|
|
@@ -432,7 +476,8 @@ def make_text(renderer):
|
|
|
432
476
|
|
|
433
477
|
|
|
434
478
|
def make_initial_grid_layout(layout_types):
|
|
435
|
-
"""
|
|
479
|
+
"""
|
|
480
|
+
Create an initial grid layout for visualization components.
|
|
436
481
|
|
|
437
482
|
Args:
|
|
438
483
|
layout_types: List of layout types (Space or Measure)
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: Mesa
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.0a0
|
|
4
4
|
Summary: Agent-based modeling (ABM) in Python
|
|
5
5
|
Project-URL: homepage, https://github.com/projectmesa/mesa
|
|
6
6
|
Project-URL: repository, https://github.com/projectmesa/mesa
|
|
7
7
|
Author-email: Project Mesa Team <projectmesa@googlegroups.com>
|
|
8
8
|
License: Apache 2.0
|
|
9
9
|
License-File: LICENSE
|
|
10
|
-
License-File: NOTICE
|
|
11
10
|
Keywords: ABM,agent,based,model,modeling,multi-agent,simulation
|
|
12
11
|
Classifier: Development Status :: 3 - Alpha
|
|
13
12
|
Classifier: Intended Audience :: Science/Research
|
|
@@ -18,63 +17,32 @@ Classifier: Programming Language :: Python :: 3 :: Only
|
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
22
20
|
Classifier: Topic :: Scientific/Engineering
|
|
23
21
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
24
22
|
Classifier: Topic :: Scientific/Engineering :: Artificial Life
|
|
25
23
|
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: click
|
|
25
|
+
Requires-Dist: cookiecutter
|
|
26
|
+
Requires-Dist: matplotlib
|
|
27
|
+
Requires-Dist: networkx
|
|
26
28
|
Requires-Dist: numpy
|
|
27
29
|
Requires-Dist: pandas
|
|
30
|
+
Requires-Dist: solara
|
|
28
31
|
Requires-Dist: tqdm
|
|
29
|
-
Provides-Extra: all
|
|
30
|
-
Requires-Dist: ipython; extra == 'all'
|
|
31
|
-
Requires-Dist: matplotlib; extra == 'all'
|
|
32
|
-
Requires-Dist: myst-nb; extra == 'all'
|
|
33
|
-
Requires-Dist: myst-parser; extra == 'all'
|
|
34
|
-
Requires-Dist: networkx; extra == 'all'
|
|
35
|
-
Requires-Dist: pydata-sphinx-theme; extra == 'all'
|
|
36
|
-
Requires-Dist: pytest; extra == 'all'
|
|
37
|
-
Requires-Dist: pytest-cov; extra == 'all'
|
|
38
|
-
Requires-Dist: pytest-mock; extra == 'all'
|
|
39
|
-
Requires-Dist: ruff; extra == 'all'
|
|
40
|
-
Requires-Dist: scipy; extra == 'all'
|
|
41
|
-
Requires-Dist: seaborn; extra == 'all'
|
|
42
|
-
Requires-Dist: solara; extra == 'all'
|
|
43
|
-
Requires-Dist: sphinx; extra == 'all'
|
|
44
32
|
Provides-Extra: dev
|
|
45
|
-
Requires-Dist:
|
|
46
|
-
Requires-Dist: networkx; extra == 'dev'
|
|
47
|
-
Requires-Dist: pytest; extra == 'dev'
|
|
33
|
+
Requires-Dist: coverage; extra == 'dev'
|
|
48
34
|
Requires-Dist: pytest-cov; extra == 'dev'
|
|
49
35
|
Requires-Dist: pytest-mock; extra == 'dev'
|
|
50
|
-
Requires-Dist:
|
|
51
|
-
Requires-Dist:
|
|
36
|
+
Requires-Dist: pytest>=4.6; extra == 'dev'
|
|
37
|
+
Requires-Dist: ruff~=0.1.1; extra == 'dev'
|
|
52
38
|
Requires-Dist: sphinx; extra == 'dev'
|
|
53
39
|
Provides-Extra: docs
|
|
54
40
|
Requires-Dist: ipython; extra == 'docs'
|
|
55
|
-
Requires-Dist: matplotlib; extra == 'docs'
|
|
56
41
|
Requires-Dist: myst-nb; extra == 'docs'
|
|
57
42
|
Requires-Dist: myst-parser; extra == 'docs'
|
|
58
|
-
Requires-Dist: networkx; extra == 'docs'
|
|
59
43
|
Requires-Dist: pydata-sphinx-theme; extra == 'docs'
|
|
60
44
|
Requires-Dist: seaborn; extra == 'docs'
|
|
61
|
-
Requires-Dist: solara; extra == 'docs'
|
|
62
45
|
Requires-Dist: sphinx; extra == 'docs'
|
|
63
|
-
Provides-Extra: examples
|
|
64
|
-
Requires-Dist: matplotlib; extra == 'examples'
|
|
65
|
-
Requires-Dist: networkx; extra == 'examples'
|
|
66
|
-
Requires-Dist: pytest; extra == 'examples'
|
|
67
|
-
Requires-Dist: scipy; extra == 'examples'
|
|
68
|
-
Requires-Dist: solara; extra == 'examples'
|
|
69
|
-
Provides-Extra: network
|
|
70
|
-
Requires-Dist: networkx; extra == 'network'
|
|
71
|
-
Provides-Extra: rec
|
|
72
|
-
Requires-Dist: matplotlib; extra == 'rec'
|
|
73
|
-
Requires-Dist: networkx; extra == 'rec'
|
|
74
|
-
Requires-Dist: solara; extra == 'rec'
|
|
75
|
-
Provides-Extra: viz
|
|
76
|
-
Requires-Dist: matplotlib; extra == 'viz'
|
|
77
|
-
Requires-Dist: solara; extra == 'viz'
|
|
78
46
|
Description-Content-Type: text/markdown
|
|
79
47
|
|
|
80
48
|
# Mesa: Agent-based modeling in Python
|
|
@@ -107,30 +75,13 @@ can be displayed in browser windows or Jupyter.*
|
|
|
107
75
|
|
|
108
76
|
## Using Mesa
|
|
109
77
|
|
|
110
|
-
|
|
78
|
+
Getting started quickly:
|
|
111
79
|
|
|
112
80
|
``` bash
|
|
113
|
-
pip install
|
|
81
|
+
pip install mesa
|
|
114
82
|
```
|
|
115
83
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
``` bash
|
|
119
|
-
pip install -U --pre mesa
|
|
120
|
-
```
|
|
121
|
-
Starting with Mesa 3.0, we don't install all our dependencies anymore by default.
|
|
122
|
-
```bash
|
|
123
|
-
# You can customize the additional dependencies you need, if you want. Available are:
|
|
124
|
-
pip install -U --pre mesa[network,viz]
|
|
125
|
-
|
|
126
|
-
# This is equivalent to our recommended dependencies:
|
|
127
|
-
pip install -U --pre mesa[rec]
|
|
128
|
-
|
|
129
|
-
# To install all, including developer, dependencies:
|
|
130
|
-
pip install -U --pre mesa[all]
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
You can also use `pip` to install the latest GitHub version:
|
|
84
|
+
You can also use `pip` to install the github version:
|
|
134
85
|
|
|
135
86
|
``` bash
|
|
136
87
|
pip install -U -e git+https://github.com/projectmesa/mesa@main#egg=mesa
|
|
@@ -142,18 +93,15 @@ Or any other (development) branch on this repo or your own fork:
|
|
|
142
93
|
pip install -U -e git+https://github.com/YOUR_FORK/mesa@YOUR_BRANCH#egg=mesa
|
|
143
94
|
```
|
|
144
95
|
|
|
145
|
-
## Resources
|
|
146
96
|
For resources or help on using Mesa, check out the following:
|
|
147
97
|
|
|
148
98
|
- [Intro to Mesa Tutorial](http://mesa.readthedocs.org/en/stable/tutorials/intro_tutorial.html) (An introductory model, the Boltzmann
|
|
149
99
|
Wealth Model, for beginners or those new to Mesa.)
|
|
150
|
-
- [Visualization Tutorial](https://mesa.readthedocs.io/stable/tutorials/visualization_tutorial.html) (An introduction into our Solara visualization)
|
|
151
100
|
- [Complexity Explorer Tutorial](https://www.complexityexplorer.org/courses/172-agent-based-models-with-python-an-introduction-to-mesa) (An advanced-beginner model,
|
|
152
101
|
SugarScape with Traders, with instructional videos)
|
|
153
|
-
- [Mesa Examples](https://github.com/projectmesa/mesa-examples) (A repository of seminal ABMs using Mesa and
|
|
102
|
+
- [Mesa Examples](https://github.com/projectmesa/mesa-examples/tree/main/examples) (A repository of seminal ABMs using Mesa and
|
|
154
103
|
examples of employing specific Mesa Features)
|
|
155
104
|
- [Docs](http://mesa.readthedocs.org/) (Mesa's documentation, API and useful snippets)
|
|
156
|
-
- [Development version docs](https://mesa.readthedocs.io/latest/) (the latest version docs if you're using a pre-release Mesa version)
|
|
157
105
|
- [Discussions](https://github.com/projectmesa/mesa/discussions) (GitHub threaded discussions about Mesa)
|
|
158
106
|
- [Matrix Chat](https://matrix.to/#/#project-mesa:matrix.org) (Chat Forum via Matrix to talk about Mesa)
|
|
159
107
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
mesa/__init__.py,sha256=HulQ0a6D9eQCogbsJEKTSLOt9SGOlPwMq7-DDlbmtaU,618
|
|
2
|
+
mesa/agent.py,sha256=fx_h8RnX5DJCmfJtloIb_fprXXp8bFzC3_RnLOLlOvY,12902
|
|
3
|
+
mesa/batchrunner.py,sha256=Kxi0pe2Zeg40R-J07JhEllkpBmREWb7RHuoTenLYEw0,6055
|
|
4
|
+
mesa/datacollection.py,sha256=CQ2QsW-mkEVbDVTsOkLy8NAQEKeoILdLB0zWS2sxnyk,11444
|
|
5
|
+
mesa/main.py,sha256=7MovfNz88VWNnfXP0kcERB6C3GfkVOh0hb0o32hM9LU,1602
|
|
6
|
+
mesa/model.py,sha256=GqayRWhohSS96kMwHCNGI7XvEkwI8GHS2SRL6SZ9N5E,5810
|
|
7
|
+
mesa/space.py,sha256=9eDEUQBcck8QYWvRn3fDw2zS2bO1Yjc7VjvvrMikzPE,62447
|
|
8
|
+
mesa/time.py,sha256=9gNoyUqYkt_gUPFBMhm38pK87mcntwAZ1lJzxqW3BSA,15211
|
|
9
|
+
mesa/cookiecutter-mesa/cookiecutter.json,sha256=tBSWli39fOWUXGfiDCTKd92M7uKaBIswXbkOdbUufYY,337
|
|
10
|
+
mesa/cookiecutter-mesa/hooks/post_gen_project.py,sha256=8JoXZKIioRYEWJURC0udj8WS3rg0c4So62sOZSGbrMY,294
|
|
11
|
+
mesa/cookiecutter-mesa/{{cookiecutter.snake}}/README.md,sha256=Yji4lGY-NtQSnW-oBj0_Jhs-XhCfZA8R1mBBM_IllGs,80
|
|
12
|
+
mesa/cookiecutter-mesa/{{cookiecutter.snake}}/app.pytemplate,sha256=g0a-i2ihi4RJFGqVQSPqJ0Rbn3WXSh9s8dVwAfPIkCE,586
|
|
13
|
+
mesa/cookiecutter-mesa/{{cookiecutter.snake}}/setup.pytemplate,sha256=UtRpLM_CkeUZRec-Ef_LiO_x7SKaWN11fOiH9T1UmTw,214
|
|
14
|
+
mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
|
+
mesa/cookiecutter-mesa/{{cookiecutter.snake}}/{{cookiecutter.snake}}/model.pytemplate,sha256=Aml4Z6E1yj7E7DtHNSUqnKNRUdkxG9WWtJyW8fkxCng,1870
|
|
16
|
+
mesa/experimental/__init__.py,sha256=MaSRE9cTFIWwMZsbRKfnCiCBkhvtzJdgWlg3Dls7Unw,67
|
|
17
|
+
mesa/experimental/cell_space/__init__.py,sha256=trFVKf2l5RbkCUyxP09Kox_J3ak2YdM4o3t40Tsjjm4,628
|
|
18
|
+
mesa/experimental/cell_space/cell.py,sha256=AUnvVnXWhdgzr0bLKDRDO9c93v22Zkw6W-tWxhEhGdQ,4578
|
|
19
|
+
mesa/experimental/cell_space/cell_agent.py,sha256=G4u9ht4gW9ns1y2L7pFumF3K4HiP6ROuxwrxHZ-mL1M,1107
|
|
20
|
+
mesa/experimental/cell_space/cell_collection.py,sha256=4FmfDEg9LoFiJ0mF_nC8KUt9fCJ7Q21erjWPeBTQ_lw,2293
|
|
21
|
+
mesa/experimental/cell_space/discrete_space.py,sha256=ta__YojsrrhWL4DgMzUqZpSgbeexKMrA6bxlYPJGfK0,1921
|
|
22
|
+
mesa/experimental/cell_space/grid.py,sha256=gYDExuFBMF3OThUkhbXmolQFKBOqTukcibjfgXicP00,6948
|
|
23
|
+
mesa/experimental/cell_space/network.py,sha256=mAaFHBdd4s9kxUWHbViovLW2-pU2yXH0dtY_vF8sCJg,1179
|
|
24
|
+
mesa/experimental/devs/__init__.py,sha256=CWam15vCj-RD_biMyqv4sJfos1fsL823P7MDEGrbwW8,174
|
|
25
|
+
mesa/experimental/devs/eventlist.py,sha256=AM-gpivXQ889Ewt66T_ai6Yy6ldx0G69Unu1lasSNxI,4907
|
|
26
|
+
mesa/experimental/devs/simulator.py,sha256=0SMC7daIOyL2rYfoQOOTaTOYDos0gLeBUbU1Krd42HA,9557
|
|
27
|
+
mesa/experimental/devs/examples/epstein_civil_violence.py,sha256=KqH9KI-A_BYt7oWi9kaOhTzjrf2pETqzSpAQG8ewud0,9667
|
|
28
|
+
mesa/experimental/devs/examples/wolf_sheep.py,sha256=h5z-eDqMpYeOjrq293N2BcQbs_LDVsgtg9vblXJM7XQ,7697
|
|
29
|
+
mesa/visualization/UserParam.py,sha256=WgnY3Q0padtGqUCaezgYzd6cZ7LziuIQnGKP3DBuHZY,1641
|
|
30
|
+
mesa/visualization/__init__.py,sha256=0utc6SZqru1rhxhBxoFGeQNawLHen5RnILvon12Bd_8,104
|
|
31
|
+
mesa/visualization/jupyter_viz.py,sha256=GKlLADaloVwdl5OQr0bxoXLUHBEozr5tUtZHQLg_Z9c,16987
|
|
32
|
+
mesa/visualization/components/altair.py,sha256=V2CQ-Zr7PeijgWtYBNH3VklGVfrf1ee70XVh0DBBONQ,2366
|
|
33
|
+
mesa/visualization/components/matplotlib.py,sha256=cmW3D2ebDcOd6TiBr_kHcBjhh8NeNEMNsz8eJP8N9sU,4289
|
|
34
|
+
mesa-3.0.0a0.dist-info/METADATA,sha256=kyMeHZK6f-_eUgcMSoWoB-IGV6rWiShgrEvxkd9jCM8,7771
|
|
35
|
+
mesa-3.0.0a0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
36
|
+
mesa-3.0.0a0.dist-info/entry_points.txt,sha256=IOcQtetGF8l4wHpOs_hGb19Rz-FS__BMXOJR10IBPsA,39
|
|
37
|
+
mesa-3.0.0a0.dist-info/licenses/LICENSE,sha256=OGUgret9fRrm8J3pdsPXETIjf0H8puK_Nmy970ZzT78,572
|
|
38
|
+
mesa-3.0.0a0.dist-info/RECORD,,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
Copyright
|
|
1
|
+
Copyright 2023 Core Mesa Team and contributors
|
|
2
2
|
|
|
3
3
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
you may not use this file except in compliance with the License.
|
|
5
5
|
You may obtain a copy of the License at
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
8
|
|
|
9
9
|
Unless required by applicable law or agreed to in writing, software
|
|
10
10
|
distributed under the License is distributed on an "AS IS" BASIS,
|
mesa/examples/README.md
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# Mesa core examples
|
|
2
|
-
These examples are a collection of classic agent based models built using Mesa. These core examples are maintained by the Mesa team and are intended to demonstrate the capabilities of Mesa.
|
|
3
|
-
|
|
4
|
-
More user examples and showcases can be found in the [mesa-examples](https://github.com/projectmesa/mesa-examples) repository.
|
|
5
|
-
|
|
6
|
-
## Basic Examples
|
|
7
|
-
The basic examples are relatively simple and only use stable Mesa features. They are good starting points for learning how to use Mesa.
|
|
8
|
-
|
|
9
|
-
### [Boltzmann Wealth Model](examples/basic/boltzmann_wealth_model)
|
|
10
|
-
Completed code to go along with the [tutorial](https://mesa.readthedocs.io/latest/tutorials/intro_tutorial.html) on making a simple model of how a highly-skewed wealth distribution can emerge from simple rules.
|
|
11
|
-
|
|
12
|
-
### [Boids Flockers Model](examples/basic/boid_flockers)
|
|
13
|
-
[Boids](https://en.wikipedia.org/wiki/Boids)-style flocking model, demonstrating the use of agents moving through a continuous space following direction vectors.
|
|
14
|
-
|
|
15
|
-
### [Conway's Game of Life](examples/basic/conways_game_of_life)
|
|
16
|
-
Implementation of [Conway's Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life), a cellular automata where simple rules can give rise to complex patterns.
|
|
17
|
-
|
|
18
|
-
### [Schelling Segregation Model](examples/basic/schelling)
|
|
19
|
-
Mesa implementation of the classic [Schelling segregation](http://nifty.stanford.edu/2014/mccown-schelling-model-segregation/) model.
|
|
20
|
-
|
|
21
|
-
### [Virus on a Network Model](examples/basic/virus_on_network)
|
|
22
|
-
This model is based on the NetLogo [Virus on a Network](https://ccl.northwestern.edu/netlogo/models/VirusonaNetwork) model.
|
|
23
|
-
|
|
24
|
-
## Advanced Examples
|
|
25
|
-
The advanced examples are more complex and may use experimental Mesa features. They are good starting points for learning how to build more complex models.
|
|
26
|
-
|
|
27
|
-
### [Epstein Civil Violence Model](examples/advanced/epstein_civil_violence)
|
|
28
|
-
Joshua Epstein's [model](https://www.pnas.org/doi/10.1073/pnas.092080199) of how a decentralized uprising can be suppressed or reach a critical mass of support.
|
|
29
|
-
|
|
30
|
-
### [Demographic Prisoner's Dilemma on a Grid](examples/advanced/pd_grid)
|
|
31
|
-
Grid-based demographic prisoner's dilemma model, demonstrating how simple rules can lead to the emergence of widespread cooperation -- and how a model activation regime can change its outcome.
|
|
32
|
-
|
|
33
|
-
### [Sugarscape Model with Traders](examples/advanced/sugarscape_g1mt)
|
|
34
|
-
This is Epstein & Axtell's Sugarscape model with Traders, a detailed description is in Chapter four of *Growing Artificial Societies: Social Science from the Bottom Up (1996)*. The model shows how emergent price equilibrium can happen via decentralized dynamics.
|
|
35
|
-
|
|
36
|
-
### [Wolf-Sheep Predation Model](examples/advanced/wolf_sheep)
|
|
37
|
-
Implementation of an ecological model of predation and reproduction, based on the NetLogo [Wolf Sheep Predation](http://ccl.northwestern.edu/netlogo/models/WolfSheepPredation) model.
|
mesa/examples/__init__.py
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
from mesa.examples.advanced.epstein_civil_violence.model import EpsteinCivilViolence
|
|
2
|
-
from mesa.examples.advanced.pd_grid.model import PdGrid
|
|
3
|
-
from mesa.examples.advanced.sugarscape_g1mt.model import SugarscapeG1mt
|
|
4
|
-
from mesa.examples.advanced.wolf_sheep.model import WolfSheep
|
|
5
|
-
from mesa.examples.basic.boid_flockers.model import BoidFlockers
|
|
6
|
-
from mesa.examples.basic.boltzmann_wealth_model.model import BoltzmannWealthModel
|
|
7
|
-
from mesa.examples.basic.conways_game_of_life.model import ConwaysGameOfLife
|
|
8
|
-
from mesa.examples.basic.schelling.model import Schelling
|
|
9
|
-
from mesa.examples.basic.virus_on_network.model import VirusOnNetwork
|
|
10
|
-
|
|
11
|
-
__all__ = [
|
|
12
|
-
"BoidFlockers",
|
|
13
|
-
"BoltzmannWealthModel",
|
|
14
|
-
"ConwaysGameOfLife",
|
|
15
|
-
"Schelling",
|
|
16
|
-
"VirusOnNetwork",
|
|
17
|
-
"EpsteinCivilViolence",
|
|
18
|
-
"PdGrid",
|
|
19
|
-
"SugarscapeG1mt",
|
|
20
|
-
"WolfSheep",
|
|
21
|
-
]
|