This code demonstrates the reinforcement learning (Q-learning) algorithm using an example of a maze in which a robot has to reach its destination by moving in the left, right, up and down directions only. At each step, based on the outcome of the robot action it is taught and re-taught whether it was a good move or not eventually the whole process is repeated time and again until it reaches its destination. At this point the process will start again so that what ever has been learned can be verified and unnecessary moves made during the first pass can be forgotten and so on. It is good tutorial example for situations in which learning has to be done on the go i.e. without the use of training examples. Can be used in games to learn and improve the competitive capability of AI algorithm with that of human players and several other scenarios.
On small maze the convergence will be fast where as on large maze convergence can take some time. You can improve convergence speed by modifying the code to make Q-learning efficient.
There are four m-files
QLearning_Maze_Walk.m - demonstrates the working of Q-learning algorithm on a selected maze
Random_Maze_Walk.m - demonstrates the working of random selection for comparison
Read_Maze.m - will read the maze provided as input and translate into numeric representation for processing
Textscanu.m - reads the raw maze text file
Two maze files are included:
maze-9-9.txt
maze-61-21.txt
引用格式
Asad Ali (2024). Reinforcement Learning (Q-Learning) (https://www.mathworks.com/matlabcentral/fileexchange/63407-reinforcement-learning-q-learning), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Reinforcement Learning(Q-Learning)/
版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.0.0.0 |