Professional Documents
Culture Documents
Genetic Algorithm Vehicle
Genetic Algorithm Vehicle
) Mathematics
Center of Mathematics Studies Faculty of Computer and Mathematical
Sciences
TECHNICAL REPORT
GENETIC ALGORITHM FOR VEHICLE ROUTING PROBLEM
MOHAMMAD IZWAN BIN JAMALUDDIN 2014829388
MUHAMAD SYAHMIE ADEEB BIN MOHD SHUKRI 2014407422
K15/34
UNIVERSITI TEKNOLOGI MARA
TECHNICAL REPORT
Alhamdulillah, first of all, I am grateful to Allah S.W.T thus far in my final years and car-
ried me through this very challenging Honours year.Utmost thanks and glory to God Almighty
in the highest for give me the strength to complete this project successfully. I would like to ex-
press my deep appreciate to Madam W.Nurfahizul W.Ifwah, my research supervisors, for giving
enthusiastic encouragement and useful critiques of this research work. Thanks to our parents
for their big hands in supporting us, the advise and also prays for us days and night. For our
siblings, thanks for their encouragements and support.Last but certainly not the least, we would
like to thanks also gratitude to all of friends and for the rest for the rest people who I do not
state here, whom contribute to this study either direct or indirectly. Thanks for such brilliance
ii
TABLE OF CONTENTS
ACKNOWLEDGEMENTS ii
LIST OF FIGURES iv
LIST OF TABLES vi
ABSTRACT vii
1 INTRODUCTION 1
2 METHODOLOGY 13
3 IMPLEMENTATION 18
REFERENCES 45
iii
LIST OF FIGURES
iv
Figure 4.13 Iteration 3 : Three Operators. 34
v
LIST OF TABLES
vi
ABSTRACT
an optimal object from a finite set of objects. The objective of the VRP is to find a series of
routes at a minimal cost which means by finding the shortest direction, minimizing the number
of vehicles and others from the beginning and ending the route at the depot, so that the known
demands of all nodes are fully occupied. We are use four step in methodology as determine
of genetic algorithm characteristic, data input, the process by using operator selection and pre-
diction. the results have been compares with two operator selection to determine the minimum
routes in cities. Based on the study that have been conducted the minimum routes is equal to
22-25-24-23. The results of the studies that have been conducted, it can be concluded that GA
method can be used in the routes of large city. But it is not the best method, in other words,
we can’t guarantee whether the table that solution. Therefore, the solution obtained is regarded
as approximations only. Normally this GA to obtain a solution that is almost the best solution
quickly and easily. Therefore, a more thorough study could be done to improve the methods
that have been discussed, in particular the GA method by setting conditions for the processes in
the GA.
vii
1 INTRODUCTION
optimal object from a finite set of objects. The objective of the VRP is to observe a series of
routes at a least cost which means by discovering the shortest distance, reducing the number of
vehicles and others from the beginning and ending the route at the depot, so that the identified
Therefore, the management should take an initiative to make the process proficient. The cor-
poration or organization should take seriously all the factor including minimize the cost and
maximize the profit. Vehicle routing problem should determine the optimum path for deliver-
ing to a (n) set total customer which known as nod. Therefore, in this research VRP will be
Genetic Algorithm is a search heuristics that similarly to the process of natural selection.
Heuristics is usually to produce usually solutions for optimization and search problems. Heuris-
tic may not be the best way to solve all the actual solution for this problem, but it still worthy be-
cause it does not require a prohibitively long time to find the solution. Genetic algorithms gen-
erate solutions to optimize problems using some methods such as mutation, selection, crossover
and inversion.
1
1.1 Problem Statement
Nowadays, every company has its own transportation. But, the manager of the company have
1. To determine the route they should take for delivering process but it have to be at minimize
2. To investigate the problem when they shortage number of vehicles for delivering process
3. To investigate the problem when they have excess loading capacity but it have to deliver
4. To find out what kind of time interval need to be considered for the vehicle reach to the
5. To investigate unusual things when the customer were receiving the same item from dif-
ferent vehicles and the item become surplus for the company.
The main objective of this study is to find a set of routes that minimizes the distance travelled.
We have the following objective as our working strategies and the objectives of research are:-
2
1.3 Scope Of The Study
This research will focus for solving vehicle routing problem (VRP). We can Genetic Algorithm
method to solve Vehicle Routing Problem. This study will need to be carefully considered for
the algorithm to work as effective possible by values of parameter, population size, probability
of using operators, etc. A review of insertion heuristics in GA and crossover operators in this
project is to resolve the VRP. The genetic algorithm methods discussed in this study can provide
the best solution that minimizes the total travel distance to be travelled. This study will be a
significant the vehicle routing problem (VRP) concerns the service of a delivery company. How
things are delivered from one or more stores that have a particular group of caravan and manage
by a set of drivers who can move on a given road network to a set of customers. It asks for
a resolve of a set of routes S, one route for each vehicle that must start and finish at its own
store such that all customers’ requirements and operational constraints are satisfied and the
transportation rate is decreasing. This rate may be economic, distance or otherwise. Other
than that, using a genetic algorithm method by heuristic is routinely used to generate useful
solutions to l and search problems. Moreover, this study will be helpful to the retail industry and
transportation in service delivery and informing them in the area of routing problem, objective,
and strategies to resolve the problem. It will also serve as a future reference for researchers
on the subject mathematical modelling and delivery companies. And importantly, this research
will educate clients in deciding on whether an industry e.g. retail industry is really fulfilling its
responsibility to the place of delivery of goods from the minimised the cost and route.
3
1.4 Literature Review
Vehicle Routing Problem (VRP) is a common name for a set of problems, in which a group of
vehicles service a set of customers (Vaira, 2014). VRP also called Travelling Salesman Problem
(TSP), where only one vehicle was used and each vehicle have a limited capacity. A number of
different exact and heuristic methods have been studied to explain the VRP that is recognized
to be NP-hard (Vaira, 2014). NP-hard problems are challenging to crack and it means that to
date no optimal algorithm has create, which it is able to answer the problem in polynomial time
time overwhelming or even unfeasible for this kind of the problem, its not reasonable to apply
These algorithms will result an estimated solution with a miscalculation around 2 until 3 per-
cents, but they are the most efficient cracking this problem (Kovacs, 2008). The technique
solution for the VRP consists of the right approach, classical heuristic methods and Heuristic
methods (Metaheuristic). Heuristic method could explain the problem for the large scale which
is it has a lot of nod. The benefit of the standard heuristics is that they have a polynomial running
time, therefore by using it will enhanced to give fine solutions within a logical amount of time
(Bjarnadottir, 2004). Metaheuristic is another method to solve a complex problem that might
tic method that usually used are Simulated Annealing (SA), Tabu Search (TA), Ant Colony
Optimization (ACO), Large Neighbourhood Search (LNS), Neural Network (NN) and Genetic
are recombined to produce new solutions (Bjarnadottir, 2004). GA have been explored signifi-
cantly, but mainly in order to explain TSP and VRP with time windows (Bjarnadottir, 2004).
4
For explaining the TSP, Genetic Algorithm and Simulated Annealing is an excellent choice.
This Thesis Work will not focus on solving the TSP, but it will concentrate solving the VRP,
which is a more complicated – multi constrained -– variation of the TSP and he explain process
in VRP can be straightforwardly used also for explaining the TSP (Kovacs, 2008). Genetic al-
gorithms have been motivated by the natural selection procedure present by Darwin. They put
into operation to a population as solutions of the problem nearby, in such a way that the recent
population is improved compared with the earlier population according to a pre – specified cri-
The operators applied by genetic algorithms imitate the way natural selection is completed and
the most famous operators used are the crossover, and mutation operators used in that order
to the current population (Masum & Faruque, 2011). Thus genetic algorithms give a search
method used in computing to find exact or estimation solutions to optimization and search
problems (Masum & Faruque, 2011). A new generation is developed by repeating the selec-
tion, crossover and mutation processes until every chromosomes in the recent population swap
those from the old one (Braysy, 2001). An adaptive memory is a group of solutions, which is
dynamically reorganized during the search process by joining some of the solutions in the group
in order to create some new good solutions (Bjarnadottir, 2004). Therefore, it can be considered
on the selection, crossover and mutation operators (Rani & Kumar, 2014). They were used
Roulette Wheel Selection (RWS) with distinct crossover and mutation probability, and it well
known used for optimization problem in Travelling Salesman Problem (TSP). Based on their
research they were compared their results of RWS with a new selection method Stochastic Uni-
versal Selection (SUS) and it reveal that SUS is surpass for small amount of town meanwhile
RWS is much better that SUS when the number of city increasing (Rani & Kumar, 2014). In
5
addition, they evaluate the outcome with a difference between mutation and crossover probabil-
ity, which concludes that mutation, is more efficient for decimal chromosomes (Rani & Kumar,
2014).
From the Srivastava & hoon Kim (2009) were applied Genetic Algorithm in software test-
ing. It was after the verification and validation from the software through dynamic testing in
area of software engineering might be slow. Software testing was used for gain consumers’
confidence in the software. The aim of software testing is to design a set of minimal number of
test cases such that reveals as many faults as possible. The application of genetic algorithm in
software testing is to recognize the most error prone paths in software construct (Srivastava &
Genetic algorithm starts with guesses and attempts to improve the guesses by evolution
(Srivastava & hoon Kim, 2009). Usually genetic algorithm have five parts which were a rep-
fitness function, choose a selection function and a crossover operator and also a mutation oper-
ator (Srivastava & hoon Kim, 2009). A chromosome could be a binary string or more complex
data structure. Next, the initial pool of chromosomes could be able to produce randomly or man-
ually created. After that, the fitness function is to measure the appropriate of a chromosome to
(Srivastava & hoon Kim, 2009). Finally, the selection function determines which chromosomes
will contribute in the evolution phase of the genetic algorithm invented by the crossover and
mutation operators. The crossover operator substitute genes from two chromosomes and create
two new chromosomes meanwhile the mutation operator modify a gene in a chromosome and
6
1.4 (b) Vehicle Routing Problem
optimization problem, which is very tough for optimization problem (Noor, 2004). A finite
represent the size of the problem (E.L. Lawlor, 1976). Vehicle Routing Problem is m-Salesman
Travelling Problem. Based on this research, it can conclude m is number of vehicle as one.
Therefore, the solution of Vehicle Routing Problem could be used by same method like solving
As it mentioned before, Vehicle Routing Problem is difficult to determine the best way for
delivering substance to customer. Consider the situation on Figure 1.1 that consist a company
From the Figure 1.1, we know that the manager of the company had to decide which
route is the most optimum for delivering merchandise to customer. The process of delivering
merchandise started from the company to a set of n customer with location and the customer
demand is certainty. Every company has its own vehicle and the vehicle has its own capacity.
Every customer has one trip only by using a vehicle. All routes were started and ending at
the company and the total demand for every customer have been set and it cannot in surplus.
To generate the routes, there are certain objectives need to consider such as minimize the total
distance, minimize the time travel, minimize the transportation cost and minimize the number
7
of the vehicles needed to supply every customers. There are several difficulty for the company
manager to comply with in order to generate the route for delivering merchandise to customers.
• Difficulty To Transportation
3. The vehicles have carrying limited amount of the merchandise that have to dis-
tribute.
• Difficulty To Customer
2. Every delivery location has its own time windows. For example, the customer must
3. Every customer has their own priority in delivering process. For instance, if the
vehicle or driver have unsatisfactory condition or even the bad weather conditions
that stuck the flow of delivering process, the delivery must be done in other ways
4. Every customer has a set of vehicles that not able to use for delivery process.
8
Meanwhile, Vehicle Routing Problem can occur in our daily life such as to determine
routes for a truck to deliver goods to the customer, determine routes for cargo ship to deliver
container to every dock and determine the routes for taxi driver in order to send the passengers
to their destination. As a conclusion, Vehicle Routing Problem (VRP) can occur in variety
situations. VRP is a problem to determine a series of object to minimize the total cost, distance
or time travel.
According to Toro et al. (2015) ,There are different types of vehicle routing problem which are:
Given n-1 node, a building, the distance between node to building and distance between
every nodes. Every node has the precisely demand. There are a few of truck that have
same cargo to deliver to the node. The problem is to find the route for the lorry in order to
minimize the distance travelled and fulfil node demand without excess capacity loaded.
The purpose is to provide every customer in an identify time interval. Solomon (1987)
display answer, technique and function. In VRPTW, delivery process must on schedule,
which is in M day interval. The goals of VRPTW is to minimize the speed of vehicle and
minimize the time taken to deliver goods for every nodes of customer.
It includes both a group of customers to whom merchandise are to distribute, and a group
9
This problem is an alternative of familiar vehicle routing problem (VRP). Unlike the VRP,
in the TTRP, customers are helped by a convoy of lorry and trailers. Due to some practical
limitation, a few customers can only be assistance by a single lorry. The other customer
In this alternative some warehouse are be concerned about to serve the customer. Cus-
tomers are commonly allocating to warehouse using clustering tactic. Some result meth-
ods have been applied in this problem. So in other words, a company has a building
for goods store use for delivering process to customer. The problem has been solved by
choosing which one of the company as a distribution centre. Every vehicle has same
starting point which is at the company then it provide the services to the customers and
back to the same company and it is the ending point for the vehicle. The purpose for this
6. Dial-A-Ride Problem
of accessible routes between permanent resource and destinations, within limited time
period and the chances of switching vehicle for the duration of a trip.
There are three problems that have to be solved simultaneously which are location of
10
1.5 Formula Vehicle Routing Problem
As we mentioned before, the vehicle routing problem is one of the and it is categorized as
11
1.6 Methods Solution of Vehicle Routing Problem
The method solution for VRP consists of classical methods and heuristic methods (metaheuris-
tics). But, until now there is still no exact algorithm for finding optimal routes when there is
large number of city. VRP solution technique for this is described as follows:
Heuristic method
Heuristic method can find feasible solutions for the problems that may be large in size (many
For classical heuristic methods, namely the search space is limited to points of the neigh-
borhood that gives better results only. The search will stop if there is no change in the
• Metaheuristic Method
Surveys in finding space to get the best solution for this method is greater. Among the
This method can avoid the local optimum solution less well accepts before the bests solu-
tion obtained.
12
2 METHODOLOGY
We use the primary data that we search through the internet by Google maps. The data were
collect by calculates the route of the every cities in Malaysia from Johor Bahru. From the city,
we choose the 25 cities in Malaysia to find the minimum routes. The software that we use to
calculate the data that we gained from the search is Microsoft Excel and also can use in Borland
C++ (Appendix A). The model that we use is the probability for vehicle to calculate the series
From the data that we gain from the Google maps. We will be using the primary data from
the internet about the city routes in Malaysia by Genetic Algorithm characteristic. The operator
13
Step 2: Data input In this part we will use the data from Google maps to determine the
14
Figure 2.2: The distance of 25 city.
15
Step 3: The process by using the operator selection There are three main steps to resolve
the vehicle routing problem using Genetic Algorithm (GA) which are:
group consist of some journey made randomly. It is known as population and saved as sequence
of numbers. Then, the selection of population is added to two or more for the new generation.
This generation is normally gives a good result than preceding generations. Commonly, the
crossover is the procedure of choosing the best ways at random and switch the location of the
The process of selection is a vital feature in the G.A. Once the crossover procedure is
complete, the selection of personal between the old generation and new generation is carry
out to find the best passenger that can give the finest result. In every iteration, the selection
process was handling twice, to be precise, afterwards crossover process and the process of
mutation later. It had process nearby the relevant disagreement there is city that is operate twice
or incomplete journey, then choose city at random by apply a city that is not included in a
16
Process 3: Mutation Process
This mutation process is complete by swapping the chromosome in a single pass. Chro-
mosome switch over is complete randomly. At times, the mutation can be proved to an answer
The inversion process is final by reversing the chromosome in a single pass. Therefore,
the chromosome will invert randomly. Hence, the inversion process can be proved as the best
Step 4: Prediction
We can determine the future value using the process of operator selection and draw the
graph from the result. Otherwise, we can determine the result when the last three iterations
repeated and stop at the tenth iteration. The best value of minimum routes is chooses as the last
17
3 IMPLEMENTATION
18
Figure 3.1: The distances between 25 cities in the VRP.
19
No Iteration
1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 25 24
3 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 25 23
4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 25 24 23
5 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 23 25
6 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 25 23 24
7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 23 22 24 25
8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 23 24 22 25
9 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 23 25 22 24
10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 23 22 25 24
11 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 23 24 25 22
12 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 23 25 24 22
13 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 24 22 23 25
14 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 24 22 25 23
15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 24 23 22 25
16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 24 23 25 22
17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 24 25 22 23
18 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 24 25 23 22
19 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 25 24 23 22
20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 25 24 22 23
21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 22 21 23 24 25
22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 23 22 21 24 25
23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 24 22 23 21 25
24 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 25 22 23 24 21
25 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 25 23 24 21 22
Choose the routes randomly. Here, the route 1 and route 10 is selected. Route 1 is repre-
sents as X and route 10 is represent as Y. The quantity of the distance traveled between 25 cities.
20
3.2 Data Implementation
It is impossible to list out 3.102 × 1023 routes. This means we can considerate their others
25 routes .
From table above, we used the value of number of cities to calculate the route series of
cities from the formula above. All the result will be show in the chapter 4. We use Microsoft
21
4 RESULTS AND DISCUSSION
22
Figure 4.2: Iteration 2 : Two Operators.
23
Figure 4.3: Iteration 3 : Two Operators.
24
Figure 4.4: Iteration 4 : Two Operators.
25
Figure 4.5: Iteration 5 : Two Operators.
26
Figure 4.6: Iteration 6 : Two Operators.
27
Figure 4.7: Iteration 7 : Two Operators.
28
Figure 4.8: Iteration 8 : Two Operators.
29
Figure 4.9: Iteration 9 : Two Operators.
30
Figure 4.10: Iteration 10 : Two Operators.
After four iterations the last iteration of 7, 8, 9 and 10 found that the value of X and Y is
not changed. The minimum value of X is 4419 while the minimum value of Y is 4464. Here
we choose the value of X as a minimum, with a number of routes is 4419. The order route is
1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-18-17-19-16-20-21-22-23-24-25.
31
4.1 (b) Three Operators Selection
32
Figure 4.12: Iteration 2 : Three Operators.
33
Figure 4.13: Iteration 3 : Three Operators.
34
Figure 4.14: Iteration 4 : Three Operators.
35
Figure 4.15: Iteration 5 : Three Operators.
36
Figure 4.16: Iteration 6 : Three Operators.
37
Figure 4.17: Iteration 7 : Three Operators.
38
Figure 4.18: Iteration 8 : Three Operators.
39
Figure 4.19: Iteration 9 : Three Operators.
40
Figure 4.20: Iteration 10 : Three Operators.
41
After four iterations the last iteration of 7, 8, 9 and 10 found that the value of X and Y
is not changed. The minimum value of X is 3990 while the minimum value of Y is 4726.
Here we choose the value of X as a minimum, with total distance is 3990. The order route is
1-2-3-4-5-6-7- 8-9-10-11-12-13-14-15-18-19-16-17-20-21-22-25-24-23.
Two Operators
GA I1 I2 I3 I4 I5 I6 I7 I8 I9 I10
X 4440 4440 4440 4419 4419 4419 4419 4419 4419 4419
Y 4726 4726 4464 4464 4464 4464 4464 4464 4464 4464
Three Operators
GA1 I1 I2 I3 I4 I5 I6 I7 I8 I9 I10
X 3994 3994 3994 3992 3992 3992 3990 3990 3990 3990
Y 4726 4726 4726 4726 4726 4726 4726 4726 4726 4726
42
Figure 4.22: Graph of Three Operators.
Name GA GA1
Operator Selection 2 3
The Minimum Route 4419 3990
From the table, we can see that the minimum route of the 25 cities is 3990 by GA1 as the
20-21-22-25-24-23. So, we can conclude that addition of the operator selection of the inversion
43
5 CONCLUSIONS AND RECOMMENDATIONS
The results have been compares with two operator selection to determine the minimum routes
in cities. Based on the study that have been conducted, the minimum routes is equal to 3990.
24-23. From the results of the studies, it can be concluded that GA method can be used in
the shortest routes of the large number of cities. But it is not the best method, in other words,
we can’t guarantee whether it is the best solution or not. Therefore, the solution obtained is
regarded as approximations only. Normally this GA to obtain a solution that is almost the best
solution quickly and easily. GA is right that sometimes the best solution is obtained. Although
this heuristic methods do not provide an optimal result for sure, but it can be solve the difficult
problem. By using Vehicle Routing Problem that include a lot of customers, a programming
computer which is Borland C++ can overcome this problem for finding the shortest routes. By
using this software, it can reduce the time taken, minimize the cost and make the distance travel
Research conducted in this thesis involves the Vehicle Routing Problem (VRP) in gener-
ally. Since, there are several types of VRP which are VRP as charged, VRP with time constrains,
VRP with a certain time and VRP with the number of the lot, is expected to further and deeper
study can be conducted to identify the problems further study of the method of solution. In ad-
dition, a more thorough study could be done to improve the methods that have been discussed,
in particular the GA method by setting conditions for the processes in the GA.
44
REFERENCES
Bjarnadottir, A. S. (2004). Solving the vehicle routing problem with genetic algorithms. Small(April), 127.
Braysy, O. (2001). Genetic algorithms for the vehicle routing problem with time windows. Arpakan-
Kovacs, A. (2008). Solving the vehicle routing problem with genetic algorithm and simulated annealing (Unpub-
Masum, A., & Faruque, M. (2011). Solving the vehicle routing problem using genetic algorithm. Inter-
-SolvingtheVehicleRoutingProblemusingGeneticAlgorithm.pdf
Rani, K., & Kumar, V. (2014). Solving travelling salesman problem using genetic algorithm based on heuristic
Srivastava, P. R., & hoon Kim, T. (2009). Application of genetic algorithm in software testing. International
Toro, E., Escobar, A., & Granada, M. (2015). Literature review on the vehicle routing problem in the green
45
APPENDIX A
46
47
48
49
50
51
52