Code Monkey home page Code Monkey logo

ma-gym's Introduction

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 Python Version Downloads Wiki Docs Papers using ma-gym Open In Colab

Installation

  • Setup (important):
       pip install 'pip<=23.0.1'
       pip install 'setuptools<=66'
       pip install 'wheel<=0.38.4'
  • Install package:
    • Using PyPI:

      pip install ma-gym
    • Directly from source (recommended):

      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-v0 Combat-v0 Lumberjacks-v0
Checkers-v0.gif Combat-v0.gif Lumberjacks-v0.gif
PongDuel-v0 PredatorPrey5x5-v0 PredatorPrey7x7-v0
PongDuel-v0.gif PredatorPrey5x5-v0.gif PredatorPrey7x7-v0.gif
Switch2-v0 Switch4-v0 TrafficJunction4-v0
Switch2-v0.gif Switch4-v0.gif TrafficJunction4-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).

ma-gym's People

Contributors

koulanurag avatar rafaelmp2 avatar uhlajs avatar dongchirua avatar semitable avatar tjuhaoxiaotian avatar hatemselim94 avatar naivered avatar hzyjerry avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.