You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix sugarscape_g1mt running options, requirements and changes to README (#109)
* fix sugarscape_g1mt running options, requirements and changes to README
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fixes to README and run.py check
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Federico <federico.serratorevr@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Copy file name to clipboardExpand all lines: examples/sugarscape_g1mt/Readme.md
+12-16Lines changed: 12 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,21 +3,17 @@
3
3
## Summary
4
4
5
5
This is Epstein & Axtell's Sugarscape model with Traders, a detailed description is in Chapter four of
6
-
*Growing Artificial Societies: Social Science from the Bottom Up.* (1996) The model shows an emergent price equilibrium can happen via a decentralized dynamics.
6
+
*Growing Artificial Societies: Social Science from the Bottom Up (1996)*. The model shows an emergent price equilibrium can happen via a decentralized dynamics.
7
7
8
8
This code generally matches the code in the Complexity Explorer Tutorial, but in `.py` instead of `.ipynb` format.
9
9
10
10
### Agents:
11
11
12
-
-**Sugar**: Sugar agents grow back at one unit per time step and can be harvested and traded by the trader agents. Sugar
13
-
is unequally distributed across the landscape with sugar hills in the upper left and lower right of the space.
14
-
(green if you do the interactive run)
15
-
-**Spice**: Spice agents grow back at one unit per time step and can be harvested and traded by the trader agents. Spice
16
-
is unequally distributed across the landscape with spice hills in the upper right and lower left of the space.
17
-
(yellow if you do the interactive run)
12
+
-**Resource**: Resource agents grow back at one unit of sugar and spice per time step up to a specified max amount and can be harvested and traded by the trader agents.
13
+
(if you do the interactive run, the color will be green if the resource agent has a bigger amount of sugar, or yellow if it has a bigger amount of spice)
18
14
-**Traders**: Trader agents have the following attributes: (1) metabolism for sugar, (2) metabolism for spice, (3) vision,
19
15
(4) initial sugar endowment and (5) initial spice endowment. The traverse the landscape harvesting sugar and spice and
20
-
trading with other agents. If they run out of sugar or spice then they are removed from the model.
16
+
trading with other agents. If they run out of sugar or spice then they are removed from the model. (red circle if you do the interactive run)
21
17
22
18
The trader agents traverse the landscape according to rule **M**:
23
19
- Look out as far as vision permits in the four principal lattice directions and identify the unoccupied site(s).
@@ -49,7 +45,7 @@ The model demonstrates several Mesa concepts and features:
49
45
To install the dependencies use pip and the requirements.txt in this directory. e.g.
50
46
51
47
```
52
-
$ pip install -r requirements.txt
48
+
$ pip install -r requirements.txt
53
49
```
54
50
55
51
## How to Run
@@ -69,19 +65,19 @@ To run the model with BatchRunner:
69
65
To run the model interactively:
70
66
71
67
```
72
-
$ mesa runserver
68
+
$ mesa runserver
73
69
```
74
70
75
71
Then open your browser to [http://127.0.0.1:8521/](http://127.0.0.1:8521/) and press Reset, then Run.
76
72
77
73
## Files
78
74
79
-
*``sugarscape_g1mt/trader_agents.py``: Defines the Trader agent class.
80
-
*``sugarscape_g1mt/resource_agents.py``: Defines the Sugar and Spice agent classes.
81
-
*``sugarscape_g1mt/model.py``: Manages the Sugarscape Constant Growback with Traders model.
82
-
*``sugarscape_g1mt/sugar_map.txt``: Provides sugar and spice landscape in raster type format.
83
-
*``server.py``: Sets up and launches and interactive visualization server.
84
-
*``run.py``: Runs Server, Single Run or Batch Run with data collection and basic analysis.
75
+
*`sugarscape_g1mt/trader_agents.py`: Defines the Trader agent class.
76
+
*`sugarscape_g1mt/resource_agents.py`: Defines the Resource agent class which contains an amount of sugar and spice.
77
+
*`sugarscape_g1mt/model.py`: Manages the Sugarscape Constant Growback with Traders model.
78
+
*`sugarscape_g1mt/sugar_map.txt`: Provides sugar and spice landscape in raster type format.
79
+
*`server.py`: Sets up an interactive visualization server.
80
+
*`run.py`: Runs Server, Single Run or Batch Run with data collection and basic analysis.
85
81
*`app.py`: Runs a visualization server via Solara (`solara run app.py`).
86
82
*`tests.py`: Has tests to ensure that the model reproduces the results in shown in Growing Artificial Societies.
0 commit comments