This project demonstrates the implementation of the Proximal Policy Optimization (PPO) algorithm on PettingZoo's Pistonball environment with multi-agent reinforcement learning, focusing on emergent behaviors through the addition of a second ball.
This project explores the fascinating dynamics of emergent behaviors in multi-agent reinforcement learning. By introducing a second ball into the Pistonball environment, we observe how agents self-organize to demonstrate:
- Division of labor: Agents prioritize tasks dynamically.
- Dynamic balance: Coordinated actions to maintain control over both balls.
- Adaptive behaviors: Strategies evolve in real-time based on challenges.
👉 Read the detailed analysis and insights on my Medium article:
Exciting Discovery: AI Pistonball Games and Emergent Collective Behaviors
pyenv
(Python version manager)pipenv
(Python dependency manager)- Homebrew (for macOS users)
-
Create and navigate to the project directory:
mkdir pettingzoo_pistonball cd pettingzoo_pistonball
-
Check available Python versions:
pyenv versions
-
Install Python 3.11.10 if not available:
pyenv install 3.11.10
-
Set up a virtual environment:
pipenv --python 3.11.10 pipenv shell
-
Install required packages:
# PettingZoo with necessary environments pip install 'pettingzoo[butterfly,atari,testing]>=1.24.0' pip install 'pettingzoo[all]' # Additional dependencies brew install cmake pipenv install SuperSuit>=3.9.0 pipenv install tensorboard>=2.11.2 pipenv install torch>=1.13.1
-
Verify the installation:
pip show pettingzoo
test1.py
: PPO training implementationtest2.py
: Evaluation and visualizationpistonball.py
: Modified environment with two balls
- Implementation of PPO algorithm: Training intelligent agents.
- Multi-agent reinforcement learning: Observing interactions in a dynamic system.
- Modified Pistonball environment: Introduction of two balls to study emergent phenomena.
- Visualization: Heatmaps and trajectories highlight emergent behaviors.
- Analysis: In-depth exploration of adaptive strategies and cooperative behaviors.
-
Train the model:
python test1.py
-
Evaluate and visualize the results:
python test2.py
Feel free to submit issues and enhancement requests.
To dive deeper into the concept of emergent behaviors and their profound implications for AI research, check out my Medium post:
Exciting Discovery: AI Pistonball Games and Emergent Collective Behaviors