mg

ma-gym

A collection of multi agent environments based on OpenAI gym.

Showing:

Popularity

Downloads/wk

0

GitHub Stars

268

Maintenance

Last Commit

2mos ago

Contributors

11

Package

Dependencies

13

License

MIT License

Categories

Readme

ma-gym

It's a collection of multi agent environments based on OpenAI gym. Also, you can use minimal-marl to warm-start training of agents.

Python package Upload Python Package Wiki Docs

Installation

Using PyPI:

pip install ma-gym

Directly from source:

git clone https://github.com/koulanurag/ma-gym.git
cd ma-gym
pip install -e .

Reference:

Please use this bibtex if you would like to cite it:

@misc{magym,
      author = {Koul, Anurag},
      title = {ma-gym: Collection of multi-agent environments based on OpenAI gym.},
      year = {2019},
      publisher = {GitHub},
      journal = {GitHub repository},
      howpublished = {\url{https://github.com/koulanurag/ma-gym}},
    }

Usage:

import gym

env = gym.make('ma_gym:Switch2-v0')
done_n = [False for _ in range(env.n_agents)]
ep_reward = 0

obs_n = env.reset()
while not all(done_n):
    env.render()
    obs_n, reward_n, done_n, info = env.step(env.action_space.sample())
    ep_reward += sum(reward_n)
env.close()

Please refer to Wiki for complete usage details

Environments:

  • Checkers
  • Combat
  • PredatorPrey
  • Pong Duel (two player pong game)
  • Switch
  • Lumberjacks
  • TrafficJunction
Note : openai's environment can be accessed in multi agent form by prefix "ma_".Eg: ma_CartPole-v0
This returns an instance of CartPole-v0 in "multi agent wrapper" having a single agent. 
These environments are helpful during debugging.

Please refer to Wiki for more details.

Zoo!

Checkers-v0Combat-v0Lumberjacks-v0
Checkers-v0.gifCombat-v0.gifLumberjacks-v0.gif
PongDuel-v0PredatorPrey5x5-v0PredatorPrey7x7-v0
PongDuel-v0.gifPredatorPrey5x5-v0.gifPredatorPrey7x7-v0.gif
Switch2-v0Switch4-v0TrafficJunction4-v0
Switch2-v0.gifSwitch4-v0.gifTrafficJunction4-v0.gif
TrafficJunction10-v0
TrafficJunction10-v0.gif

Testing:

  • Install: pip install -e ".[test]"
  • Run: pytest

Acknowledgement:

  • This project was initially developed to complement my research internship @ SAS (Summer - 2019).

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100