Please, cite as: FURTADO, Bernardo Alves. PolicySpace: agent-based modeling. IPEA: Brasília, 2018.
Available here in English: http://www.ipea.gov.br/portal/index.php?option=com_content&view=article&id=33132&Itemid=433
Also available in Portuguese: http://www.ipea.gov.br/portal/index.php?option=com_content&view=article&id=32743&Itemid=433
This is an open agent-based model with three markets and a tax scheme that empirically simulates 46 Brazilian metropolitan regions.
Developed by Bernardo Alves Furtado, funded by Institute of Applied Economic Research (IPEA). The author acknowledges receiving a grant of productivity by National Council of Research (CNPq). Isaque Daniel Rocha Eberhardt and Francis Tseng were fundamental contributors (see below for participation details).
This work is licensed under GNU General Public License v3.0
PolicySpace: a modeling platform. (accepted to) https://arxiv.org/abs/1801.00259 CAPS 2018: Complexity and Policy Studies UNCC - George Mason University - April 18 (but not presented).
Repository of produced texts
Bernardo Alves Furtado, Francis Tseng
Bernardo Alves Furtado, since beginning:(conception, design, coding - agents, markets, timeframe, general) Isaque Daniel Rocha Eberhardt, 16 months:(design, coding - 'controls', 'plottings', 'parameters') Alexandre Messa (some suggestions) [4 months] Davoud Taghawi-Nejad (early-on pontual suggestion)
How do I get set up?
We recommend using conda and creating an environment that includes all libraries simultaneously. Type on a terminal, after having downloaded and installed conda.
conda create -n e36 python=3.6 gdal fiona geopandas numpy mkl scikit-learn numba joblib click click-plugins cligj cycler descartes llvmlite munch numba pandas pyparsing pyproj python-dateutil pytz scipy shapely joblib Flask Flask-WTF WTForms psutil -c conda-forge
Using the above code will install the libraries.
Then, you have to activate the newly created environment with the command: activate <your_env>.
If any of the libraries were not available on conda-forge, use
pip install -U scikit-learn, for example.
Extract/Unzip file mun_ibge_2014_latlong_wgs1984_fixed.zip
How to run the model
To locally configure the simulation's parameters, create the following files as needed:
conf/run.pyfor run-specific options, e.g.
OUTPUT_PATHfor where sim results are saved
conf/params.pyfor simulation parameters, e.g.
The default options are in
conf/default/, refer to those for what values can be set.
Parallelization and multiple runs
These optional arguments are available for all the run commands:
--runsto specify how many times to run the simulation.
--cpusto specify number of CPUs to use when running multiple times. Use
-1for all cores (default).
python main.py run
python main.py -c 2 -n 10 run
Runs simulation over a range of values for a specific parameter. For continuous parameters, the syntax is
NAME:MIN:MAX:NUMBER_STEPS. For boolean parameters, just provide the parameter name.
python main.py sensitivity ALPHA:0:1:7
Will run the simulation once for each value
python main.py sensitivity WAGE_IGNORE_UNEMPLOYMENT
Will run the simulation once for each value
You can also set up multiple sensitivity runs at once.
python main.py sensitivity ALPHA:0:1:0.1 WAGE_IGNORE_UNEMPLOYMENT
is equivalent to running the previous two examples in sequence.
Runs simulation over a different distribution combinations:
ALTERNATIVE0: True/False, FPM_DISTRIBUTION: True/False.
python main.py -n 2 -c 2 distributions
Runs simulation over a different ACPs.
python main.py -n 2 -c 2 acps
You can regenerate plots for a set of runs by using:
python main.py make_plots /path/to/output
In Windows, make sure to use double quotes " " and backward slashes as in:
python main.py make_plots "..\run__2017-11-01T11_59_59.240250_bh"
Running the web interface
There is a preliminary web interface in development.
To run the server:
python main.py web
localhost:5000 in your browser.
Last written documentation
arxiv.org/1702.03226v2.pdf AAMAS/ABMUS text arxiv.org/1609.03996v1 SEAL operational manual
Major changes since then
- Firms no longer have FIXED salaries scheme. Really depends on sale. Major general improvements
- Five TAXES introduced: consumption, labor, firm, real estate transaction, property
- Also FOUR schemes of TAXES distribution among municipalities: multiple regional testing and modeling of taxes distribution (multi_ACP_alternate)
- Endogenous prices setting in a sticker manner
- Decision-making of the firm profits hire, otherwise fire
Next major move
TRANSPORT SYSTEMS or initial approach (such as BUS or CAR choices, related to income and time/productivity)
- Credit market
- Exogenous regional MIGRATION
- Housing rent market
- Sectors and products variety
- Based on Lengnick, 2013. Agent-based macroeconomics: A baseline model.
- Journal of Economic Behavior & Organization
Distinctions from Lengnick, 2013
- Households are FIXED, but families can move into other households
- We have either four or one government institution that collects taxes and improves quality of life index
- Wage is paid to the agent, not on the household. However, consumption is based on families' average money
- There is no fixed structure for the working-consumption network. Distance is used instead.
- Different wage mechanism
What is this repository for?
- Public Policy analysis