In this project, we train a reinforcement learning (RL) agent that navigates an environment similar to Unity's Banana Collector environment. This is one of the projects described in the Udacity Deep Reinforcement Learning Nanodegree repository.
The environment has yellow and blue bananas scattered around a in rectangle-shaped environment. Occasionally some bananas drop from the air. The environment is episodic and runs for 300 timesteps (30 seconds).
A reward of +1 is provided for collecting a yellow banana, and a reward of -1 is provided for collecting a blue banana. The goal is to collect as many yellow bananas as possible while avoiding blue bananas. The environment is solved when the agent achieves an average score of +13 over 100 consecutive episodes.
The state space has 37 dimensions and contains the agent's velocity, along with ray-based perception of objects around agent's forward direction. Given this information, the agent has to learn how to best select actions. Four discrete actions are available, corresponding to:
0
- move forward.1
- move backward.2
- turn left.3
- turn right.
- Clone this repository, then create and activate a conda environment with
conda create -n dql python=3.6
conda activate dql
For this project we use unity unityagents 0.4. You can install this and other requitements with
git clone https://github.com/udacity/deep-reinforcement-learning.git
cd deep-reinforcement-learning/python
pip install .
-
Download the environment from one of the links below. Then copy the enviroment zip file in the root folder of the repository and decompress it. 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 environment.
-
Follow the instructions in
main.ipynb
to train the agent.
We use deep Q-learning with fixed Q-targets, double Q-learning and experience replay, similar to DeepMind's implementation here. This algorithm solves the problem in 255 episodes.