Skip to content

Commit 69571b4

Browse files
authored
remove how-to guide and update docs in places (#2449)
1 parent ceb03c7 commit 69571b4

File tree

4 files changed

+28
-128
lines changed

4 files changed

+28
-128
lines changed

docs/howto.md

Lines changed: 0 additions & 122 deletions
This file was deleted.

docs/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ tutorials/visualization_tutorial
7878
Examples <examples>
7979
Migration guide <migration_guide>
8080
Best Practices <best-practices>
81-
How-to Guide <howto>
8281
API Documentation <apis/api_main>
8382
Mesa Packages <packages>
8483
```

docs/tutorials/intro_tutorial.ipynb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@
259259
"\n",
260260
"With the basics of the Agent class and Model class created we can no activate the agents to `do` things\n",
261261
"\n",
262-
"**Background:** Mesa's `do` function calls agent functions the grow your ABM. A step is the smallest unit of time in the model, and is often referred to as a tick. The `do` function and Python functionality can be configured to activate agents in different orders. This can be important as the order in which agents are activated can impact the results of the model [Comer2014]. At each step of the model, one or more of the agents -- usually all of them -- are activated and take their own step, changing internally and/or interacting with one another or the environment. A overview of different ways to employ the `do` function for different activation regimes can be found in the [\"How To\" Guide](https://mesa.readthedocs.io/latest/howto.html).\n",
262+
"**Background:** Mesa's `do` function calls agent functions the grow your ABM. A step is the smallest unit of time in the model, and is often referred to as a tick. The `do` function and Python functionality can be configured to activate agents in different orders. This can be important as the order in which agents are activated can impact the results of the model [Comer2014]. At each step of the model, one or more of the agents -- usually all of them -- are activated and take their own step, changing internally and/or interacting with one another or the environment.\n",
263263
"\n",
264264
"**Model-specific information:** For this section we will randomly reorder the Agent activation order using `mesa.Agent.shuffle_do` and have the agents `step` function print the agent unique id they are assigned during the agent creation process. \n",
265265
"\n",
@@ -1498,9 +1498,7 @@
14981498
{
14991499
"cell_type": "markdown",
15001500
"metadata": {},
1501-
"source": [
1502-
"**note for Windows OS users:** If you are running this tutorial in Jupyter, make sure that you set `number_processes = 1` (single process). If `number_processes` is greater than 1, it is less straightforward to set up. You can read [Mesa's how-to guide](https://github.com/projectmesa/mesa/blob/main/docs/howto.md), in 'Using multi-process `batch_run` on Windows' section for how to do it."
1503-
]
1501+
"source": "**note for Windows OS users:** If you are running this tutorial in Jupyter, make sure that you set `number_processes = 1` (single process). If `number_processes` is greater than 1, it is less straightforward to set up. For details on how to use multiprocessing on windows, see [multiprocessing's programming guidelines](https://docs.python.org/3/library/multiprocessing.html#multiprocessing-programming). "
15041502
},
15051503
{
15061504
"cell_type": "code",

mesa/batchrunner.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
1-
"""batchrunner for running a factorial experiment design over a model."""
1+
"""batchrunner for running a factorial experiment design over a model.
2+
3+
To take advantage of parallel execution of experiments, `batch_run` uses
4+
multiprocessing if ``number_processes`` is larger than 1. It is strongly advised
5+
to only run in parallel using a normal python file (so don't try to do it in a
6+
jupyter notebook). Moreover, best practice when using multiprocessing is to
7+
put the code inside an ``if __name__ == '__main__':`` code black as shown below::
8+
9+
from mesa.batchrunner import batch_run
10+
11+
params = {"width": 10, "height": 10, "N": range(10, 500, 10)}
12+
13+
if __name__ == '__main__':
14+
results = batch_run(
15+
MoneyModel,
16+
parameters=params,
17+
iterations=5,
18+
max_steps=100,
19+
number_processes=None,
20+
data_collection_period=1,
21+
display_progress=True,
22+
)
23+
24+
25+
26+
"""
227

328
import itertools
429
import multiprocessing

0 commit comments

Comments
 (0)