https://github.com/levitation-opensource/zoo_to_gym_multiagent_adapter
Enables you to convert a PettingZoo environment to a Gym environment while supporting multiple agents. Gym's default setup doesn't easily support multi-agent environments, but this wrapper resolves that by running each agent in its own process and sharing the environment across those processes.
https://github.com/levitation-opensource/zoo_to_gym_multiagent_adapter
adapter ai artificial-intelligence gridworld gym gymnasium marl multi-agent multi-agent-reinforcement-learning multi-processing pettingzoo reinforement-learning rl wrapper
Last synced: 8 months ago
JSON representation
Enables you to convert a PettingZoo environment to a Gym environment while supporting multiple agents. Gym's default setup doesn't easily support multi-agent environments, but this wrapper resolves that by running each agent in its own process and sharing the environment across those processes.
- Host: GitHub
- URL: https://github.com/levitation-opensource/zoo_to_gym_multiagent_adapter
- Owner: levitation-opensource
- License: mpl-2.0
- Created: 2025-02-23T20:53:59.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-02-23T22:50:40.000Z (8 months ago)
- Last Synced: 2025-02-23T23:24:49.124Z (8 months ago)
- Topics: adapter, ai, artificial-intelligence, gridworld, gym, gymnasium, marl, multi-agent, multi-agent-reinforcement-learning, multi-processing, pettingzoo, reinforement-learning, rl, wrapper
- Language: Python
- Homepage: https://www.simplify.ee/
- Size: 16.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Authors: AUTHORS.txt
Awesome Lists containing this project
README
# Zoo to Gym Multi-Agent Adapter
## Overview
This wrapper allows you to convert a **PettingZoo** environment to a **Gym** environment while supporting multiple agents. Gym's default setup doesn't easily support multi-agent environments, but this wrapper resolves that by running each agent in its own process and sharing the environment across those processes.
## Features
* Converts a **PettingZoo** environment to a **Gym**-compatible environment.
* **Multi-agent** support by running agents in separate processes.
* Thus enables using Gym-based RL algorithms with **PettingZoo** environments.
* There are two adapters:
* Single-agent adapter - Runs in the same process.
* Multi-agent adapter - Runs each agents in a separate subprocess.## Installation
Currently you can install the wrapper from the source:
### From Source:
```
pip install git+https://github.com/levitation-opensource/zoo_to_gym_multiagent_adapter@main#egg=zoo_to_gym_multiagent_adapter
```## Usage
TODO
For an example, see
https://github.com/aintelope/biological-compatibility-benchmarks/tree/main/aintelope/agents/dqn_agent.py
and
https://github.com/aintelope/biological-compatibility-benchmarks/tree/main/aintelope/agents/sb3_base_agent.py## How It Works
* The wrapper handles the conversion of the PettingZoo environment API into a Gym-compatible API.
* When there are multiple agents, each agent runs in its own process, and the wrapper ensures synchronization and data sharing between them, allowing you to train multi-agent RL scenarios using Gym.
* This solves the issue of Gym's default lack of native support for multiple agents in a single environment.## Contributions
Contributions are welcome! Feel free to fork the repository, open issues, and submit pull requests.
## License
This project is licensed under the Mozilla Public License Version 2.0 - see the [LICENSE.txt](LICENSE.txt) file for details.