gym_ma_toy
gym_ma_toy copied to clipboard
:video_game: Toy environment set for multi-agent reinforcement learning and more
Toy Multi agent environment
This repo contains for the moment a first environment:
How to install ?
git clone https://github.com/MehdiZouitine/gym_ma_toy
cd gym_ma_toy
pip install -e .
How to use it ?
import gym
import gym_ma_toy
env = gym.make('team_catcher-v0')
obs = env.reset()
done = False
while not done:
env.render(mode='rgb_array')
action = env.action_space.sample()
obs, reward, done, info = env.step(action)
env.close()
Team catcher:
This is a map where targets are randomly placed. Some targets do not move , other move randomly (one square at the time). Agents must capture all targets. Targets are captures when there are at least two agents on an adjacent cell of a target. The environement gives a reward point for each captured target. The episode ends when there is no more target on the map. The number of agents and targets can be arbitrarily large.
- V0: This is the simplest environment. Targets (RED) do not move and agents (BLUE) can only move horizontally and vertically.
- V2: Some agents move horizontally/vertically (BLUE), other move diagonally (GREEN)
Running multiple environment in parallel
# Running 8 environment in parallel
import gym
import gym_ma_toy
env = gym.vector.make('team_catcher-v0',num_envs=8, asynchronous=True)
Test
pytest test/
Cite the environment as:
@misc{amarl2020
Author = {Mehdi Zouitine, Adil Zouitine, Ahmad Berjaoui},
Title = {Toy environment set for multi-agent reinforcement learning and more},
Year = {2020},
}
License
This project is free and open-source software licensed under the MIT license.