Metadata-Version: 2.1
Name: ai-economist
Version: 1.0
Summary: Foundation: An Economics Simulation Framework
Home-page: https://github.com/salesforce/ai-economist
Author: Stephan Zheng, Alex Trott, Sunil Srinivasa
Author-email: stephan.zheng@salesforce.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: appdirs (==1.4.4)
Requires-Dist: appnope (==0.1.0)
Requires-Dist: astroid (==2.4.2)
Requires-Dist: attrs (==19.3.0)
Requires-Dist: backcall (==0.2.0)
Requires-Dist: black (==19.10b0)
Requires-Dist: bleach (==3.1.5)
Requires-Dist: certifi (==2020.4.5.1)
Requires-Dist: chardet (==3.0.4)
Requires-Dist: click (==7.1.2)
Requires-Dist: cycler (==0.10.0)
Requires-Dist: decorator (==4.4.2)
Requires-Dist: defusedxml (==0.6.0)
Requires-Dist: docutils (==0.16)
Requires-Dist: entrypoints (==0.3)
Requires-Dist: flake8 (==3.8.3)
Requires-Dist: idna (==2.9)
Requires-Dist: importlib-metadata (==1.6.1)
Requires-Dist: ipykernel (==5.3.0)
Requires-Dist: ipython (==7.15.0)
Requires-Dist: ipython-genutils (==0.2.0)
Requires-Dist: ipywidgets (==7.5.1)
Requires-Dist: isort (==4.3.21)
Requires-Dist: jedi (==0.17.0)
Requires-Dist: Jinja2 (==2.11.2)
Requires-Dist: jsonschema (==3.2.0)
Requires-Dist: jupyter (==1.0.0)
Requires-Dist: jupyter-client (==6.1.3)
Requires-Dist: jupyter-console (==6.1.0)
Requires-Dist: jupyter-core (==4.6.3)
Requires-Dist: keyring (==21.2.1)
Requires-Dist: kiwisolver (==1.2.0)
Requires-Dist: lazy-object-proxy (==1.4.3)
Requires-Dist: lz4 (==3.1.0)
Requires-Dist: MarkupSafe (==1.1.1)
Requires-Dist: matplotlib (==3.2.1)
Requires-Dist: mccabe (==0.6.1)
Requires-Dist: mistune (==0.8.4)
Requires-Dist: more-itertools (==8.3.0)
Requires-Dist: nbconvert (==5.6.1)
Requires-Dist: nbformat (==5.0.7)
Requires-Dist: notebook (==6.0.3)
Requires-Dist: numpy (==1.18.5)
Requires-Dist: packaging (==20.4)
Requires-Dist: pandocfilters (==1.4.2)
Requires-Dist: parso (==0.7.0)
Requires-Dist: pathspec (==0.8.0)
Requires-Dist: pexpect (==4.8.0)
Requires-Dist: pickleshare (==0.7.5)
Requires-Dist: pkginfo (==1.5.0.1)
Requires-Dist: pluggy (==0.13.1)
Requires-Dist: prometheus-client (==0.8.0)
Requires-Dist: prompt-toolkit (==3.0.5)
Requires-Dist: ptyprocess (==0.6.0)
Requires-Dist: py (==1.8.1)
Requires-Dist: pycodestyle (==2.6.0)
Requires-Dist: pyflakes (==2.2.0)
Requires-Dist: Pygments (==2.6.1)
Requires-Dist: pylint (==2.5.3)
Requires-Dist: pyparsing (==2.4.7)
Requires-Dist: pyrsistent (==0.16.0)
Requires-Dist: pytest (==5.4.3)
Requires-Dist: python-dateutil (==2.8.1)
Requires-Dist: pyzmq (==19.0.1)
Requires-Dist: qtconsole (==4.7.4)
Requires-Dist: QtPy (==1.9.0)
Requires-Dist: readme-renderer (==26.0)
Requires-Dist: regex (==2020.6.8)
Requires-Dist: requests (==2.23.0)
Requires-Dist: requests-toolbelt (==0.9.1)
Requires-Dist: scipy (==1.4.1)
Requires-Dist: Send2Trash (==1.5.0)
Requires-Dist: six (==1.15.0)
Requires-Dist: terminado (==0.8.3)
Requires-Dist: testpath (==0.4.4)
Requires-Dist: toml (==0.10.1)
Requires-Dist: tornado (==6.0.4)
Requires-Dist: tqdm (==4.46.1)
Requires-Dist: traitlets (==4.3.3)
Requires-Dist: twine (==3.1.1)
Requires-Dist: typed-ast (==1.4.1)
Requires-Dist: urllib3 (==1.25.9)
Requires-Dist: wcwidth (==0.2.4)
Requires-Dist: webencodings (==0.5.1)
Requires-Dist: widgetsnbextension (==3.5.1)
Requires-Dist: wrapt (==1.12.1)
Requires-Dist: zipp (==3.1.0)

# Foundation: An Economic Simulation Framework

This repo contains an implementation of Foundation, a framework for flexible, modular, and composable environments that **model socio-economic behaviors and dynamics in a society with both agents and governments**.

Foundation provides a [Gym](https://gym.openai.com/)-style API:

- `reset`: resets the environment's state and returns the observation.
- `step`: advances the environment by one timestep, and returns the tuple *(observation, reward, done, info)*.

This simulation can be used in conjunction with reinforcement learning to learn optimal economic policies, as detailed in:

**[The AI Economist: Improving Equality and Productivity with AI-Driven Tax Policies](https://arxiv.org/abs/2004.13332)**,
*Stephan Zheng, Alexander Trott, Sunil Srinivasa, Nikhil Naik, Melvin Gruesbeck, David C. Parkes, Richard Socher.*

If you use this code in your research, please cite us using this BibTeX entry:

```
@misc{2004.13332,
  Author = {Stephan Zheng, Alexander Trott, Sunil Srinivasa, Nikhil Naik, Melvin Gruesbeck, David C. Parkes, Richard Socher},
  Title = {The AI Economist: Improving Equality and Productivity with AI-Driven Tax Policies},
  Year = {2020},
  Eprint = {arXiv:2004.13332},
}
```

For more information and context, check out:

- [The AI Economist website](https://www.einstein.ai/the-ai-economist)
- [Blog: The AI Economist: Improving Equality and Productivity with AI-Driven Tax Policies](https://blog.einstein.ai/the-ai-economist/)
- [Blog: The AI Economist moonshot](https://blog.einstein.ai/the-ai-economist-moonshot/)

## Join us on Slack

If you're interested in extending this framework, discussing machine learning for economics, and collaborating on research project:

- join our Slack channel [aieconomist.slack.com](https://aieconomist.slack.com) using this [invite link](https://join.slack.com/t/aieconomist/shared_invite/zt-g71ajic7-XaMygwNIup~CCzaR1T0wgA), or
- email us @ ai.economist@salesforce.com.

## Installation Instructions

To get started, you'll need to have Python 3.7+ installed.

### Using pip

Simply use the Python package manager:

```python
pip install ai-economist
```

### Installing from Source

1. Clone this repository to your local machine:

    ```
    git clone www.github.com/salesforce/ai-economist
    ```

2. Create a new conda environment (named "ai-economist" below - replace with anything else) and activate it

    ```pyfunctiontypecomment
    conda create --name ai-economist python=3.7
    conda activate ai-economist
    ```

3. Either

    a) Edit the PYTHONPATH to include the ai-economist directory
    ```
    export PYTHONPATH=<local path to ai-economist>:$PYTHONPATH
    ```

    OR

    b) Install as an editable Python package
    ```pyfunctiontypecomment
    cd ai-economist
    pip install -e .
    ```

Useful tip: for quick access, add the following to your ~/.bashrc or ~/.bash_profile:

```pyfunctiontypecomment
alias aiecon="conda activate ai-economist; cd <local path to ai-economist>"
```

You can then simply run `aiecon` once to activate the conda environment.

### Testing your Install

To test your installation, try running:

```
conda activate ai-economist
python -c "import ai_economist"
```

## Getting Started

### Tutorials

To familiarize yourself with Foundation, check out the tutorials in the `tutorials` folder. You can run these notebooks interactively in your browser on Google Colab.

- [tutorials/economic_simulation_basic.ipynb](https://www.github.com/salesforce/ai-economist/blob/master/tutorials/economic_simulation_basic.ipynb) ([Try this on Colab!](http://colab.research.google.com/github/salesforce/ai-economist/blob/master/tutorials/economic_simulation_basic.ipynb)!): Shows how to interact with and visualize the simulation.
- [tutorials/economic_simulation_advanced.ipynb](https://www.github.com/salesforce/ai-economist/blob/master/tutorials/economic_simulation_advanced.ipynb) ([Try this on Colab!](http://colab.research.google.com/github/salesforce/ai-economist/blob/master/tutorials/economic_simulation_advanced.ipynb)!): Explains how Foundation is built up using composable and flexible building blocks.

To run these notebooks *locally*, you need [Jupyter](https://jupyter.org). See [https://jupyter.readthedocs.io/en/latest/install.html](https://jupyter.readthedocs.io/en/latest/install.html) for installation instructions and [(https://jupyter-notebook.readthedocs.io/en/stable/](https://jupyter-notebook.readthedocs.io/en/stable/) for examples of how to work with Jupyter.

## Structure of the Code

The simulation is located in the `ai_economist/foundation` folder.

The code repository is organized into the following components:

| Component | Description |
| --- | --- |
| [base](https://www.github.com/salesforce/ai-economist/blob/master/ai_economist/foundation/base) | Contains base classes to can be extended to define Agents, Components and Scenarios. |
| [agents](https://www.github.com/salesforce/ai-economist/blob/master/ai_economist/foundation/agents) | Agents represent economic actors in the environment. Currently, we have mobile Agents (representing workers) and a social planner (representing a government). |
| [entities](https://www.github.com/salesforce/ai-economist/blob/master/ai_economist/foundation/entities) | Endogenous and exogenous components of the environment. Endogenous entities include labor, while exogenous entity includes landmarks (such as Water and Grass) and collectible Resources (such as Wood and Stone). |
| [components](https://www.github.com/salesforce/ai-economist/blob/master/ai_economist/foundation/components) | Components are used to add some particular dynamics to an environment. They also add action spaces that define how Agents can interact with the environment via the Component. |
| [scenarios](https://www.github.com/salesforce/ai-economist/blob/master/ai_economist/foundation/scenarios) | Scenarios compose Components to define the dynamics of the world. It also computes rewards and exposes state for visualization. |

## Releases and Contributing

- Please let us know if you encounter any bugs by filing a Github issue.
- We appreciate all your contributions. If you plan to contribute new Components, Scenarios Entities, or anything else, please see our [contribution guidelines](https://www.github.com/salesforce/ai-economist/blob/master/CONTRIBUTING.md).

## Changelog

Current version: v1.0: initial release.

For the complete release history, see [CHANGELOG.md](https://www.github.com/salesforce/ai-economist/blob/master/CHANGELOG.md).

## License

Foundation and the AI Economist are released under the [BSD-3 License](LICENSE.txt).


