Implementation of Q-Learning using TD error to navigate a maze avoiding obstacles and a moving enemy
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
actions
main.py
maze_env.py
qlearn2.gif
rl_brain.py
visualiser.py

README.md

q-learning td error

Goal: Reaching the yellow oval while avoiding black blocks and moving enemy (red block)

QLearningMaze

Implementation of Q-Learning usind TD error for optimally navigating a maze while avoiding a moving enemy.

To run:

$ pip install numpy pandas
$ python main.py

Project comes with trained Qtable in pickled file action You may run in the following ways

Importing Q-table and running optimal policy

$ python main.py

Training

$ python main.py --test

Training + GUI

(slow, mostly for debugging)

$ python main.py --test --vis

Algorithm used

Q-values are updated based on the following formula: q-learning td error

pseudo formula

newVal = oldVal + learningRate * (reward + discount_val * maxValOfNextState - oldVal)