GithubHelp home page GithubHelp logo

deep-q-learning_maze's Introduction

This repository contains the 2nd Reinforcement Learning coursework from the Department of Computing, Imperial College London, Academic Year 2019-2020, delivered by Dr A. Aldo Faisal and Dr Edward Johns. The coursework was developed with their PhD students.

DQN_RL_maze

This project consisted of building an DQN implementation to solve a maze problem where an agent had to reach a given goal position. The agent's stepsize was limited to 2 pixels.
The random_environment.py and train_and_test.py files were given.
The random_environment.py file creates random maze environments.
The train_and_test.py creates an environment, trains the agent 10 minutes, and then tests it against a new maze.

Important features of the DQN implementation in the agent.py file comprise of:

  • Epsilon-greedy policy (line 34)
  • Epsilon decay rate (line 35)
  • Epsilon decay clipping (line 36)
  • Experience replay buffer (lines 301-340)
  • Prioritised experience replay (lines 322-340)
  • Episode length (line 22)
  • Reward function which penalises hitting the wall proportionally to the distance from the goal; gives 0 reward for moving vertically; rewards positively when entering a circle close to the reward state (lines 95-108)

An example of a simple maze, where the red dot is the agent and the green dot is the goal:

Requirements

You need to use Python 3.6 or greater.

Installing the environment on a Unix system

We created this repository to ensure that everybody uses exactly the same versions of the libraries.

To install the libraries, start by cloning this repository and enter the created folder:

git clone https://github.com/sachahu1/Deep-Q-Learning_maze.git

Setting up a virtual environment (called venv here):

python3 -m venv ./venv 

Then enter the environment:

source venv/bin/activate

And install the libraries in the environment by launching the following command:

pip3 install -r requirements.txt

This will install the following libraries (and their dependencies) in the virtual environment venv:

  • torch
  • opencv-python
  • numpy

How to run a script ?

Before launching your experiment, be sure to use the right virtual environment in your shell:

source venv/bin/activate  # To launch in the project directory

Once you are in the right virtual environment, you can directly launch the scripts by using one of the following command:

python3 ./train_and_test.py  # To launch the coursework script

Leaving the virtual environment

If you want to leave the virtual environment, you just need to enter the following command:

deactivate

deep-q-learning_maze's People

Contributors

sachahu1 avatar

Watchers

 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.