• Stars
    star
    387
  • Rank 110,971 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Implementing Reinforcement Learning, namely Q-learning and Sarsa algorithms, for global path planning of mobile robot in unknown environment with obstacles. Comparison analysis of Q-learning and Sarsa

Reinforcement Learning in Python

Implementing Reinforcement Learning (RL) Algorithms for global path planning in tasks of mobile robot navigation. Comparison analysis of Q-learning and Sarsa algorithms fo the environment with cliff, mouse and cheese.
DOI

Related works:

Description

RL Algorithms implemented in Python for the task of global path planning for mobile robot. Such system is said to have feedback. The agent acts on the environment, and the environment acts on the agent. At each step the agent:

  • Executes action.
  • Receives observation (new state).
  • Receives reward.

The environment:

  • Receives action.
  • Emits observation (new state).
  • Emits reward.

Goal is to learn how to take actions in order to maximize the reward. The objective function is as following:

Q_[s_, a_] = Q[s, a] + Ξ» * (r + Ξ³ * max(Q_[s_, a_]) – Q[s, a]),

where,
Q_[s_, a_] - value of the objective function on the next step,
Q[s, a] - value of the objective function on the current position,
max(Q_[s_, a_]) – Q[s, a]) - choosing maximum value from the possible next steps,
s – current position of the agent,
a – current action,
Ξ» – learning rate,
r – reward that is got in the current position,
Ξ³ – gamma (reward decay, discount factor),
s_ - next chosen position according to the next chosen action,
a_ - next chosen action.

The major component of the RL method is the table of weights - Q-table of the system state. Matrix Q is a set of all possible states of the system and the system response weights to different actions. During trying to go through the given environment, mobile robot learns how to avoid obstacles and find the path to the destination point. As a result, the Q-table is built. Looking at the values of the table it is possible to see the decision for the next action made by agent (mobile robot).


Experimental results with different Environments sre shown and described below.
Code is supported with a lot of comments. It will guide you step by step through entire idea of implementation.

Each example consists of three files:

  • env.py - building an environment with obstacles.
  • agent_brain.py - implementation of algorithm itself.
  • run_agent.py - running the experiments.

Content

Codes (it'll send you to appropriate folder):


Experimental results (figures and tables on this page):

RL Q-Learning Environment-1. Experimental results

Environment-1 with mobile robot, goal and obstacles

RL_Q-Learning_E-1 RL_Q-Learning_E-1


Q-learning algorithm resulted chart for the environment-1

Represents number of episodes via number of steps and number of episodes via cost for each episode

RL_Q-Learning_C-1


Final Q-table with values from the final shortest route for environment-1

RL_Q-Learning_T-1
Looking at the values of the table we can see the decision for the next action made by agent (mobile robot). The sequence of final actions to reach the goal after the Q-table is filled with knowledge is the following: down-right-down-down-down-right-down-right-down-right-down-down-right-right-up-up.
During the experiment with Q-learning algorithm the found shortest route to reach the goal for the environment-1 consist of 16 steps and the found longest rout to reach the goal consists of 185 steps.


RL Q-Learning Environment-2. Experimental results

Bigger environment-2 with more obstacles

RL_Q-Learning_E-2


Q-learning algorithm resulted chart for the environment-2

Represents number of episodes via number of steps and number of episodes via cost for each episode

RL_Q-Learning_C-2


Final Q-table with values from the final shortest route for environment-1

RL_Q-Learning_T-2


RL Q-Learning Environment-3. Experimental results

Super complex environment-3 with a lot of obstacles

RL_Q-Learning_E-3


Comparison analysis of Q-Learning and Sarsa algorithms

RQ-learning_via_Sarsa


MIT License

Copyright (c) 2018 Valentyn N Sichkar

github.com/sichkar-valentyn

Reference to:

Valentyn N Sichkar. Reinforcement Learning Algorithms for global path planning // GitHub platform. DOI: 10.5281/zenodo.1317898

More Repositories

1

Neural_Networks_for_Computer_Vision

Implementing Neural Networks for Computer Vision in autonomous vehicles and robotics for classification, pattern recognition, control. Using Python, numpy, tensorflow. From basics to complex project
Jupyter Notebook
23
star
2

Intelligent_Mobile_Robot

Intelligent Navigation System of mobile robot with ten Ultrasonic sensors, user interface via C# Windows Form Application, instructions and videos on how to assemble mobile robotic platform
C#
17
star
3

Transportation_Problem

Transportation Model for an optimal strategy for distributing a commodity from a group of supply centers to various receiving centers. Solved in C# Windows Form Application
C#
14
star
4

Matlab_implementation_of_Neural_Networks

Matlab implementation of Neural Networks Results for Alarm-Warning Control System of mobile robot with five Ultrasonic sensors
MATLAB
13
star
5

Traffic-Signs-dataset-in-YOLO-v3-format

YOLO v3 format of traffic signs dataset to train and test detector
Jupyter Notebook
9
star
6

Restoration_of_images_in_Matlab

Restoration of images in Matlab using inverse filtration technique
MATLAB
5
star
7

Analysis_of_Characteristics_for_Direct_Current_Motor_in_Matlab

Simulation of Linear Control Systems using Functions From Control System Toolbox in Matlab
MATLAB
5
star
8

Radon_Transformation_Matlab

Radon Transformations in Matlab
MATLAB
4
star
9

Traffic-Signs-Classification-with-CNN

Effective Traffic Signs Classification by CNN
Jupyter Notebook
3
star
10

Matlab_and_FIR_Filters

Two-Dimensional Finite Impulse Response (FIR) Filters in Matlab
MATLAB
3
star
11

Matlab_image_converting

Using MATLAB functions, converting images in different formats
MATLAB
3
star
12

What-is-mAP-for-Objects-Detection-tasks-

Understanding of use of mAP as a metric for Objects Detection problems
Jupyter Notebook
3
star
13

Color_Image_Processing_in_Matlab

Pseudo-color image processing, Luminance correction, Segmentation of image in Matlab
MATLAB
3
star
14

Analysis_of_a_Nonlinear_Electromechanical_Plant

Analysis of a Nonlinear Electromechanical Plant in Matlab Using Simulink Model
MATLAB
3
star
15

Synthesis_SS_Controller

Synthesis of SS Controller in Matlab using Simulink
MATLAB
3
star
16

Knowledge_Base_Represented_by_Semantic_Web_Language

Semantic Web languages OWL and RDF for knowledge representation of Alarm-Warning system for mobile robot showing the states for each sensor
3
star
17

Processing_html_files_in_Python

Examples on how to process html files in Python
Python
2
star
18

String_Decoding

Decoding input string - so called task of 'decompression'
Python
2
star
19

XML_files_in_Python

Examples on how to process xml files in Python
Python
2
star
20

Image_processing_in_Python

Image processing in Python. Reading, converting to different formats, implementing filtering, convolving images, detecting edges, cropping and resizing images
Python
2
star
21

Machine_Learning_in_Python

Practical experiments on Machine Learning in Python. Processing of sentences and finding relevant ones, approximation of function with polynomials, function optimization
Python
2
star
22

traffic_sign

Traffic Sign Classification with Convolutional Neural Networks in Python
1
star
23

Logistic_Regression

Implementing Logistic Regression for the Image Recognition task
1
star
24

Encoding_Decoding_in_Python

Simple example how to encode and decode strings in Python
Python
1
star
25

identify-moving-direction-opencv-python

Moving direction OpenCV Python
Python
1
star
26

Sparql_query_using_C_Sharp

Sparql query programming using C#
C#
1
star
27

Functions_in_Python

Creating functions in Python
Python
1
star
28

Convolutional_Neural_Network

Convolutional Neural Network
1
star
29

jolly_jumper_sequence

Checking if the input is so called "jolly jumper"
Python
1
star
30

Reading_Data_from_Resistor

Switching on and switching off LEDs according to the data from analog input
C++
1
star
31

Variables_and_Branching_in_Python

Variables and Branching in Python
Python
1
star
32

C_Sharp_Windows_Form_data_transceiver

C# program to communicate with Arduino
C#
1
star
33

Correlation_function_and_Fourier_Transform_in_Matlab

Using Correlation function and Fourier Transform to find one specific letter in the image with the text
MATLAB
1
star
34

Analysis_of_a_digital_stabilization_system

Analysis of a digital stabilization system
MATLAB
1
star
35

Modules_in_Python

Examples of importing modules in Python and usage of them
Jupyter Notebook
1
star
36

Switching_on_LED_by_1_and_0

Sending to the Serial Port 1 and 0 to switch on and switch off LED in Arduino Microcontroller
C++
1
star
37

Backpropagation

Backpropagation in Neural Network (NN) with Python
1
star
38

Matlab_Functions_and_Spatial_Techniques_for_Image_Processing

Spatial techniques for image processing in Matlab
MATLAB
1
star
39

Introduction_in_Python

Simple mathematical operations in Python
Python
1
star
40

Dynamic_Analysis_of_Current_and_Velocity_Loops

Simulation of a DC motors feedback loop via current and velocity regulation
MATLAB
1
star
41

1-million-images-for-Traffic-Signs-Classification-tasks

Applied geometric transformations for Traffic Signs images
1
star
42

While_loop_and_lists_in_Python

Working with while loop and lists in Python
Python
1
star
43

Iterations_Functions_Sequences_in_Python

Example of simple functions, sequences and operations with them
Python
1
star
44

Introduction_into_Neural_Networks

Introduction into Neural Networks
1
star
45

Multiplication_Table

Simple example of multiplication table and how to use loops and tabulation in Python
Python
1
star
46

Roman_number_to_decimal_number

Conversion Roman number to decimal number system
Python
1
star