Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chauncygu/safe-multi-agent-mujoco
Safe Multi-Agent MuJoCo benchmark for safe multi-agent reinforcement learning research.
https://github.com/chauncygu/safe-multi-agent-mujoco
benchmark reinforcement-learning robotics safe
Last synced: about 2 months ago
JSON representation
Safe Multi-Agent MuJoCo benchmark for safe multi-agent reinforcement learning research.
- Host: GitHub
- URL: https://github.com/chauncygu/safe-multi-agent-mujoco
- Owner: chauncygu
- License: mit
- Created: 2021-10-06T12:09:06.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-13T16:56:02.000Z (7 months ago)
- Last Synced: 2024-11-20T15:39:11.414Z (2 months ago)
- Topics: benchmark, reinforcement-learning, robotics, safe
- Language: Python
- Homepage:
- Size: 2.17 MB
- Stars: 51
- Watchers: 2
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Safe Multi-Agent Mujoco
We introduce a safe Multi-Agent Reinforcement Learning Benchmark, **Safe Multi-Agent MuJoCo (Safe MAMujoco)**, a safety-aware modification of [MAMuJoCo](https://github.com/schroederdewitt/multiagent_mujoco). Safe MAMuJoCo agents learn to not only skilfully manipulate a robot, but also to avoid dangerous obstacles and positions, Figure 1 shows example views of the environment. (This repository is under actively development. We appreciate any constructive comments and suggestions)
In particular, the background environment, agents, physics simulator, and the reward function are preserved. However, as oppose to its predecessor, Safe MAMuJoCo environments come with obstacles, like walls or bombs. Furthermore, with the increasing risk of an agent stumbling upon an obstacle, the environment emits cost.
Figure.1 Example views of robots in Safe MAMuJoCo. Body parts of different colours are controlled by differentagents. Agents jointly learn to manipulate the robot, while avoiding crashing into unsafe areas.
## Demos
**Ant Task**: the width of the corridor set by two walls is 10 m. The environment emits the cost of 1 for an agent, if the distance between the robot and the wall is less than 1.8 m, or when the robot topples over.
|![](https://github.com/chauncygu/Multi-Agent-Constrained-Policy-Optimisation/blob/main/figures/202111071600-unsafe-end%2000_00_00-00_00_30.gif)|![](https://github.com/chauncygu/Multi-Agent-Constrained-Policy-Optimisation/blob/main/figures/202111140948-safe-end1%2000_00_00-00_00_30.gif)|
| :---: | :---: |
| A demo denotes unsafe performance using HAPPO on Ant-2x4 task. | A demo denotes safe performance using MAPPO-Lagrangian on Ant-2x4 task. |**HalfCheetah Task**: In the task, the agents move inside a corridor (which constraints their movement, but does not induce costs). Together with them, there are bombs moving inside the corridor. If an agent finds itself too close to the bomb, the distance between an agent and the bomb is less than 9m, a cost of 1 will be emitted, at the same time, the bomb will turn blood red.
|![](https://github.com/chauncygu/Multi-Agent-Constrained-Policy-Optimisation/blob/main/figures/202111140948-halfcheetah-unsafe-end%2000_00_00-00_00_30.gif)|![](https://github.com/chauncygu/Multi-Agent-Constrained-Policy-Optimisation/blob/main/figures/202111140948-halfcheetah-safe-end%2000_00_00-00_00_30.gif)|
| :---: | :---: |
| A demo denotes unsafe performance using HAPPO on HalfCheetah-2x3 task. | A demo denotes safe performance using MAPPO-Lagrangian on HalfCheetah-2x3 task. |**ManyAgent Ant Task One**: In the ManyAgent Ant task, the width of the corridor set by two walls is 9m. The environment emits the cost of 1 for an agent, if the distance between the robot and the wall is less than 1.8 m, or when the robot topples over.
|![](https://github.com/chauncygu/Multi-Agent-Constrained-Policy-Optimisation/blob/main/figures/sadppo-manyagent-ant--unsafe-end-have-word%2000_00_00-00_00_30.gif)|![](https://github.com/chauncygu/Multi-Agent-Constrained-Policy-Optimisation/blob/main/figures/safe-mappo-manyagent-ant--safe-end-have-word-01%2000_00_00-00_00_30.gif)|
| :---: | :---: |
| A demo denotes unsafe performance using HAPPO on ManyAgent Ant-2x3 task. | A demo denotes safe performance using MAPPO-Lagrangian on ManyAgent Ant-2x3 task. |**ManyAgent Ant Task Two**: In the ManyAgent Ant task, the width of the corridor is 12 m; its walls fold at the angle of 30 degrees. The environment emits the cost of 1 for an agent, if the distance between the robot and the wall is less than 1.8 m, or when the robot topples over.
|![](https://github.com/chauncygu/Multi-Agent-Constrained-Policy-Optimisation/blob/main/figures/two-wall-sadppo-unsafe-end-have-word-manyagent-ant%2000_00_00-00_00_30.gif)|![](https://github.com/chauncygu/Multi-Agent-Constrained-Policy-Optimisation/blob/main/figures/two-wall-safe-mappo--manyagent-ant-safe-end-have-word-manyagent-ant%2000_00_00-00_00_30.gif)|![](https://github.com/chauncygu/Multi-Agent-Constrained-Policy-Optimisation/blob/main/figures/two-wall-macpo-manyagent-ant--safe-end-have-word%2000_00_00-00_00_30.gif)|
| :---: | :---: | :---: |
| A demo denotes unsafe performance using HAPPO on ManyAgent Ant-2x3 task. | A demo denotes unsafe performance using MAPPO-Lagrangian on ManyAgent Ant-2x3 task. | A demo denotes safe performance using MACPO on ManyAgent Ant-2x3 task. |## Installation
- Install mujoco accoring to [mujoco-py](https://github.com/openai/mujoco-py) and [MuJoCo website](https://www.roboti.us/license.html).
- clone safety multi-agent mujoco to the env path.
``` Bash
LD_LIBRARY_PATH=${HOME}/.mujoco/mujoco200/bin;
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so
pip install -r requirements.txt
```## Test
Run test.py``` Bash
python test.py
```## Tasks
``` Bash
ManyAgent Ant
env_args = {"scenario": "manyagent_ant",
"agent_conf": "3x2",
"agent_obsk": 1,
"episode_limit": 1000}env_args = {"scenario": "manyagent_ant",
"agent_conf": "2x3",
"agent_obsk": 1,
"episode_limit": 1000}
env_args = {"scenario": "manyagent_ant",
"agent_conf": "6x1",
"agent_obsk": 1,
"episode_limit": 1000}env_args = {"scenario": "manyagent_ant",
"agent_conf": "4x2",
"agent_obsk": 1,
"episode_limit": 1000}
env_args = {"scenario": "manyagent_ant",
"agent_conf": "2x4",
"agent_obsk": 1,
"episode_limit": 1000}
env_args = {"scenario": "manyagent_ant",
"agent_conf": "8x1",
"agent_obsk": 1,
"episode_limit": 1000}
HalfCheetah
env_args = {"scenario": "HalfCheetah-v2",
"agent_conf": "2x3",
"agent_obsk": 1,
"episode_limit": 1000}
env_args = {"scenario": "HalfCheetah-v2",
"agent_conf": "3x2",
"agent_obsk": 1,
"episode_limit": 1000}
env_args = {"scenario": "HalfCheetah-v2",
"agent_conf": "6x1",
"agent_obsk": 1,
"episode_limit": 1000}
Ant
env_args = {"scenario": "Ant-v2",
"agent_conf": "2x4",
"agent_obsk": 1,
"episode_limit": 1000}env_args = {"scenario": "Ant-v2",
"agent_conf": "8x1",
"agent_obsk": 1,
"episode_limit": 1000}env_args = {"scenario": "Ant-v2",
"agent_conf": "2x4d",
"agent_obsk": 1,
"episode_limit": 1000}env_args = {"scenario": "Ant-v2",
"agent_conf": "4x2",
"agent_obsk": 1,
"episode_limit": 1000}
Coupled_half_cheetah
env_args = {"scenario": "coupled_half_cheetah",
"agent_conf": "1p1",
"agent_obsk": 1,
"episode_limit": 1000}
Hopper
env_args = {"scenario": "Hopper-v2",
"agent_conf": "3x1",
"agent_obsk": 1,
"episode_limit": 1000}
```## Publication
If you find the repository useful, please cite the [paper](https://arxiv.org/abs/2110.02793):
```
@article{gu2023safe,
title={Safe Multi-Agent Reinforcement Learning for Multi-Robot Control},
author={Gu, Shangding and Kuba, Jakub Grudzien and Chen, Yuanpei and Du, Yali and Yang, Long and Knoll, Alois and Yang, Yaodong},
journal={Artificial Intelligence},
pages={103905},
year={2023},
publisher={Elsevier}
}```
# Acknowledgments
We thank the list of contributors from the following open source repositories: [MAMujoco](https://github.com/schroederdewitt/multiagent_mujoco), [safety-gym](https://github.com/openai/safety-gym), [CMBPO](https://github.com/anyboby/Constrained-Model-Based-Policy-Optimization).