/ML-Q-Learning-Robot-in-Maze-MATLAB

Implementation of Reinforcement learning using Q learning algorithm- Robot in Maze - Matlab

Primary LanguageMATLAB

Machine Learning

Reinforcement learning / Q-Learning

Implementation of Q-learning algorithm for solving maze in Matlab

This Q-Learning code for MATLAB has been written by Mohammad Maghsoudi Mehrabani. It trains an agent to find the way from start point to goal point through a 20x20 maze.

  • Actions include turning and moving through the maze
  • The agent earns rewards from the environment under certain conditions
  • The agent’s goal is to maximize the reward

The Base Map

alt text

Base map is stored in maze.txt included Start Point, Goal Point, Walls and Obstacles.

Rewards:

  • Goal = 200
  • Hole = -10
  • Oil = -5
  • Free Cells = -1

How to run

Just open Main.m file and click on Run button

And Following convergence of the algorithm, MATLAB will print out the best path to the goal

Output :

  • Optimal Path which shows the best path from start point to goal point - the best path is shown in below: alt text

  • Figure 1 : Average Cumulative Rewards of each Episode of 30 Runs vs. Episodes alt text

  • Figure 2 : Average Steps of each Episode of 30 Runs vs. Episodes alt text