Skip to content

Commit

Permalink
Update outdated readme to be more accurate + clean up requirements.tx…
Browse files Browse the repository at this point in the history
…t of unnecessary dependencies
  • Loading branch information
houssam-kensho authored and rht committed May 18, 2023
1 parent 651e14f commit 50b422b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
22 changes: 14 additions & 8 deletions examples/boltzmann_wealth_model/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,36 @@

## Summary

A simple model of agents exchanging wealth. All agents start with the same amount of money. Every step, each agent with one unit of money or more gives one unit of wealth to another random agent. This is the model described in the [Intro Tutorial](https://mesa.readthedocs.io/en/latest/tutorials/intro_tutorial.html).
A simple model of agents exchanging wealth. All agents start with the same amount of money. Every step, each agent with one unit of money or more gives one unit of wealth to another random agent. This is the model described in the [Intro Tutorial](https://mesa.readthedocs.io/en/latest/tutorials/intro_tutorial.html), with the completed code.

If you want to go over the step-by-step tutorial, please go and run the [Jupyter Notebook](https://github.com/projectmesa/mesa/blob/main/docs/tutorials/intro_tutorial.ipynb). The code here runs the finalized code in the last cells directly.

As the model runs, the distribution of wealth among agents goes from being perfectly uniform (all agents have the same starting wealth), to highly skewed -- a small number have high wealth, more have none at all.

## How to Run

To follow the tutorial examples, launch the Jupyter Notebook and run the code in ``Introduction to Mesa Tutorial Code.ipynb``.
To follow the tutorial example, launch the Jupyter Notebook and run the code in ``Introduction to Mesa Tutorial Code.ipynb`` which you can find in the main mesa repo [here](https://github.com/projectmesa/mesa/blob/main/docs/tutorials/intro_tutorial.ipynb)

To launch the interactive server, as described in the [last section of the tutorial](https://mesa.readthedocs.io/en/latest/tutorials/intro_tutorial.html#adding-visualization), run:

```
$ python viz_money_model.py
$ python server.py
```

Make sure to install the requirements first:

```
pip install -r requirements.txt
```

If your browser doesn't open automatically, point it to [http://127.0.0.1:8521/](http://127.0.0.1:8521/). When the visualization loads, press Reset, then Run.


## Files

* ``Introduction to Mesa Tutorial Code.ipynb``: Jupyter Notebook with all the steps as described in the tutorial.
* ``money_model.py``: Final version of the model.
* ``viz_money_model.py``: Creates and launches interactive visualization.
* ``boltzmann_wealth_model/model.py``: Final version of the model.
* ``boltzmann_wealth_model/server.py``: Code for the interactive visualization.
* ``run.py``: Launches the server.

## Further Reading

Expand All @@ -35,5 +43,3 @@ This model is drawn from econophysics and presents a statistical mechanics appro
[Milakovic, M. A Statistical Equilibrium Model of Wealth Distribution. February, 2001.](https://editorialexpress.com/cgi-bin/conference/download.cgi?db_name=SCE2001&paper_id=214)

[Dragulescu, A and Yakovenko, V. Statistical Mechanics of Money, Income, and Wealth: A Short Survey. November, 2002](http://arxiv.org/pdf/cond-mat/0211175v1.pdf)
____
You will need to open the file as a Jupyter (aka iPython) notebook with an iPython 3 kernel. Required dependencies are listed in the provided `requirements.txt` file which can be installed by running `pip install -r requirements.txt`
3 changes: 0 additions & 3 deletions examples/boltzmann_wealth_model/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
jupyter
matplotlib
mesa~=1.1
numpy

0 comments on commit 50b422b

Please sign in to comment.