The Report notebook and all the Python files in this repository propose a solution using the Unity ML-Agents environment Tennis, as modified by Udacity for the third project of the Udacity.
In this environment, two agents control rackets to bounce a ball over a net.
- Positive Rewards: +0.1 if an agent hits the ball over the net.
- Negative Rewards: -0.01 if an agent lets a ball hit the ground or hits the ball out of bounds.
- Observation Space: 8 variables corresponding to the position and velocity of the ball and racket. Each agent receives its own, local observation.
- Action Space: Two continuous actions are available: 1) movement toward (or away from) the net, and 2) jumping.
So, the Goal of each agent is to keep the ball in play.
The task is episodic, and in order to solve the environment, our agents must get an average score of +0.5 (over 100 consecutive episodes, after taking the maximum over both agents).
-
Download the environment from one of the links below. You need only select the environment that matches your operating system:
- Linux: click here
- Mac OSX: click here
- Windows (32-bit): click here
- Windows (64-bit): click here
(For Windows users) Check out this link if you need help with determining if your computer is running a 32-bit version or 64-bit version of the Windows operating system.
(For AWS) If you'd like to train the agent on AWS (and have not enabled a virtual screen), then please use this link to obtain the "headless" version of the environment. You will not be able to watch the agent without enabling a virtual screen, but you will be able to train the agent. (To watch the agent, you should follow the instructions to enable a virtual screen, and then download the environment for the Linux operating system above.)
-
Place the file in the DRLND GitHub repository, in the
p3_collab-compet/folder, and unzip (or decompress) the file.
To set up your Python environment to run the code in this repository, follow the instructions below.
- Create (and activate) a new environment with Python 3.6.
conda create --name drlnd python=3.6
activate drlnd
-
Install Pytorch by following the instructions in the link below.
-
Then navigate to DRLND_P3_collab-compet/ml-agents-0.4.0b/python and install ml-agent.
pip install . -
Install matplotlib for plotting graphs.
conda install -c conda-forge matplotlib -
(Optional) Install latest prompt_toolkit may help in case Jupyter Kernel keeps dying
conda install -c anaconda prompt_toolkit
Open Report.ipynb in Jupyter and press Ctrl+Enter to run the first cell to import all the libraries. You would have to modify the file multi_agent.py to change the hyperparameters and the file model.py to change the neural network topology.
