This repository demonstrates various applications of reinforcement learning (RL) using the Mesa agent-based modeling framework.
Given the number of dependencies required, we recommend starting by creating a Conda environment or a Python virtual environment.
- Install Mesa Models Begin by installing the Mesa models:
#TODO: Update this -- do release?
pip install -U -e git+https://github.com/projectmesa/mesa-examples@mesa-2.x#egg=mesa-models
-
Install RLlib for Multi-Agent Training Next, install RLlib along with TensorFlow and PyTorch to support multi-agent training algorithms:
pip install "ray[rllib]" tensorflow torch
#TODO Update requirements to mesa[rec] >3.0
-
Install Additional Dependencies Finally, install any remaining dependencies:
pip install -r requirements.txt
-
Download Pre-Trained Weights Download pre-trained weights from hugging face:
git clone https://huggingface.co/projectmesa/rl_models/
To test the code, simply execute example.py
:
python example.py
Note: Pre-trained models might not work in some cases because of differnce in versions of libraries used to train and test.
To learn about individual implementations, please refer to the README files of specific environments.
For detailed tutorials on how to use these implementations and guidance on starting your own projects, please refer to Tutorials.md.
Here's a refined version of your contribution guide:
We welcome contributions to our project! A great way to get started is by implementing the remaining examples listed in the Mesa-Examples repository with reinforcement learning (RL).
Additionally, if you have your own Mesa environments that you think would benefit from RL integration, we encourage you to share them with us. Simply start an issue on our GitHub repository with your suggestion, and we can collaborate on bringing it to life!