Giter Club home page Giter Club logo

multi-agent-ddpg's Introduction

Multi-Agent Continuous Control in Collaborative-Competitive environment

Introduction

For this project, I am using slightly modified versions of Unity Tennis environment. See the animation with trained agent in comparison to "dumb" agent below

Trained Agent:

Trained Agent

Random Agent

Random Agnet

In this environment, two agents control rackets to bounce a ball over a net. If an agent hits the ball over the net, it receives a reward of +0.1. If an agent lets a ball hit the ground or hits the ball out of bounds, it receives a reward of -0.01. Thus, the goal of each agent is to keep the ball in play. The observation space consists of 8 variables corresponding to the position and velocity of the ball and racket. Each agent receives its own, local observation. Two continuous actions are available, corresponding to movement toward (or away from) the net, and jumping.

The task is episodic, and in order to solve the environment, agents must get an average score of +0.5 (over 100 consecutive episodes, after taking the average over both agents).

Getting Started

Note: This guide was only tested for macOS with pyenv for python versions management.

Please follow these steps to be able to run this project:

  1. Install build tools (such as C++ compiler and etc.) by installing Xcode and then Xcode command-line tools following one of the various guides .

  2. Install dependencies. It is highly recommended to install all dependencies in virtual environment (see guide).

    • Install Unity ML-Agents Toolkit following instruction from this page (official GitHub of Unity ML-Agents Toolkit). It is very likely that most of you will only need to install mlagents and unityagents packages with the following command:

      pip install mlagents unityagents

      It is highly recommended to use Python not higher then 3.7, because TesnsorFlow (one of the dependency for mlagents) is only compatible with Python 3.7).

    • Install PyTorch with

      pip insall torch torchvision

      Please see official installation guide for more information.

    Alternatively, it is possible to install required dependencies using requirements.txt. To do that jsut run the following command in your terminal (preferably in project's virtual environment):

    pip install -r requirements.txt

    Please note: this method is a bit of an overkill and has some packages that are not really used in this project. In fact this is a "R&D" environment for the experiments and testing.

  3. Download the environment from one of the links below. You need only select the environment that matches your operating system:

  4. Place the file in the root of the project repository.

  5. Run main.py from terminal with

    python main.py

    or simply run main.py in your IDE.

  6. Run visualize.py to see intelligent agent with

    python vizualize.py

    or, again, simply run this file in you IDE.

Technical report

Check out technical report for implementation details.

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.