際際滷

際際滷Share a Scribd company logo
GENETIC ALGORITHM
FOR
FINDING THE SHORTEST PATH
Dr. Baljit Singh Khehra
Professor, CSE Department
BBSB Engineering College, Fatehgarh Sahib
Introduction of Genetic Algorithms
 GA is a computer algorithm that searches for good
solutions to a problem among a large number of possible
solutions.
 GAs are based on the mechanism of natural genetics and
natural selection.
 In GAs, maintain a population of some feasible solutions
for given problem.This population undergoes evolution in
a form of natural selection. In each generation relatively
good solutions reproduce and relatively bad solutions die,
to be replaced by the offspring of the good.
Problem Description
In TSP, to find shortest Hamiltonian cycle in
complete graph.
Permutation Problem.
NP-Hard Problem.
Fitness Measure
Step 1: Traverse the cities according to the sequence in a
tour
Step 2: Calculate d(ci, ci+1) using equation
d(ci, ci+1) = (x-s)2 + (y-t)2
and find the total distance in the tour
n
Total distance = S d (ci, ci+1) + d (cn,c1)
i=1
Step3: Calculate the fitness of the chromosome in the
population using the equation fit (tk) = 1/Total
distance
Selection Method
 Steady-state selection mechanism is used in this
algorithm.
 In steady-state selection, two chromosomes
from population are selected for crossover.
 The offspring so obtained replace the least fit
chromosome in the existing population.
Partially Mapped crossover
Step 1:Two chromosomes as parent P1 and P2 are
aligned, and two crossover sites are picked
uniformly at random along the chromosomes.
Step 2:Each element between the two crossover
points in the alternate parent is mapped to
the position held by this element in the
first parent.
Step3:The remaining elements are inherited from
the parent without any conflict.
Partially Mapped crossover
Step 4:If conflict occurs, then for the first child:
(a) Find the position of the element,where
conflict occurs, in the second parent.
Pick the element from that position in
the first parent and place it that position
where conflict occur in the first child.
(b) For the second child, parent roles
reversed.
Swap Mutation Operator
Step 1: Randomly choose one tour and randomly
select two mutation points.
Step 2: Interchange the cities at these two
points.
Overall Procedure of GA to Solve TSP
Step 1: Setting the parameter
Set the parameter: number of cities n, population
size pop_size, crossover probability pc, mutation
probability pm, and maximum generation maxgen.
Let generation gen = 0, maxeval = 0
Step 2: Initialization
Generate pop_size chromosomes (tours) randomly.
Overall Procedure of GA to Solve TSP
Step 3: Evaluate
Step 3.1: Calculate the fitness value of each chromosome .
Step 3.2: if maxeval < max{fit(tk)}
Then
bestsol = findbest {fit(tk)}
and maxeval = max {fit (tk)}
Overall Procedure of GA to Solve TSP
Step 4: Crossover
Perform the crossover PMX on
chromosomes selected with probability pc.
Step 5: Mutation
Perform the swap mutation on
chromosomes selected with probability pm.
Overall Procedure of GA to Solve TSP
Step 6: Selection
Select pop_size chromosomes from the parents
and offspring for the next generation by steady
state selection method.
Step 7: Stop testing
If gen = maxgen , then output bestsol and stop
Else
gen = gen + 1 and return to step 3
Experimental Results
The best tour after 2600 iterations
Problem Size GA
10
20
30
BEST AVG
56.47
58.81
64.15
45.36
52.89
55.91
Experimental Results
Performance of the Experiment
Performance of the experiment when n=20:
The size of the solution space:
20! / (20*2) = 60822550204416000
The number of the particles:18
The number of the iterations of the algorithm:2600
The size of the search space: 46800
Search space/solution space: 7.6945E-11%
Thanks

More Related Content

Similar to Ga for shortest_path (20)

An Improved Iterative Method for Solving General System of Equations via Gene...
An Improved Iterative Method for Solving General System of Equations via Gene...An Improved Iterative Method for Solving General System of Equations via Gene...
An Improved Iterative Method for Solving General System of Equations via Gene...
Zac Darcy
Particle Swarm Optimization
Particle Swarm OptimizationParticle Swarm Optimization
Particle Swarm Optimization
QasimRehman
GABPN genetic algorithm based back propogation networknew.pptx
GABPN genetic algorithm based back propogation networknew.pptxGABPN genetic algorithm based back propogation networknew.pptx
GABPN genetic algorithm based back propogation networknew.pptx
ravikumarfulwaria
Genetic Algorithm
Genetic AlgorithmGenetic Algorithm
Genetic Algorithm
Jagadish Mohanty
Quantum inspired evolutionary algorithm for solving multiple travelling sales...
Quantum inspired evolutionary algorithm for solving multiple travelling sales...Quantum inspired evolutionary algorithm for solving multiple travelling sales...
Quantum inspired evolutionary algorithm for solving multiple travelling sales...
eSAT Publishing House
Genetic Algorithm
Genetic AlgorithmGenetic Algorithm
Genetic Algorithm
SHIMI S L
Genetic algorithms
Genetic algorithmsGenetic algorithms
Genetic algorithms
guest9938738
An Implementational approach to genetic algorithms for TSP
An Implementational approach to genetic algorithms for TSPAn Implementational approach to genetic algorithms for TSP
An Implementational approach to genetic algorithms for TSP
Sougata Das
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
Jari Abbas
BGA.pptx
BGA.pptxBGA.pptx
BGA.pptx
ShubhamKamble942039
Genetic algorithm optimization technique.pptx
Genetic algorithm optimization technique.pptxGenetic algorithm optimization technique.pptx
Genetic algorithm optimization technique.pptx
sridharece1
10.1.1.34.7361
10.1.1.34.736110.1.1.34.7361
10.1.1.34.7361
Rahmat Fauzi
Genetic Algorithms
Genetic AlgorithmsGenetic Algorithms
Genetic Algorithms
Karthik Sankar
D0353027043
D0353027043D0353027043
D0353027043
inventionjournals
Pso notes
Pso notesPso notes
Pso notes
Darshan Sharma
53564379-Ant-Colony-Optimization.ppt
53564379-Ant-Colony-Optimization.ppt53564379-Ant-Colony-Optimization.ppt
53564379-Ant-Colony-Optimization.ppt
AhmedSalimJAlJawadi
F0422052058
F0422052058F0422052058
F0422052058
ijceronline
Optimization Using Evolutionary Computing Techniques
Optimization Using Evolutionary Computing Techniques Optimization Using Evolutionary Computing Techniques
Optimization Using Evolutionary Computing Techniques
Siksha 'O' Anusandhan (Deemed to be University )
Muzammil Adulrahman ppt on travelling salesman Problem Based On Mutation Gene...
Muzammil Adulrahman ppt on travelling salesman Problem Based On Mutation Gene...Muzammil Adulrahman ppt on travelling salesman Problem Based On Mutation Gene...
Muzammil Adulrahman ppt on travelling salesman Problem Based On Mutation Gene...
Petroleum Training Institute
Particle Swarm Optimization
Particle Swarm OptimizationParticle Swarm Optimization
Particle Swarm Optimization
Stelios Petrakis
An Improved Iterative Method for Solving General System of Equations via Gene...
An Improved Iterative Method for Solving General System of Equations via Gene...An Improved Iterative Method for Solving General System of Equations via Gene...
An Improved Iterative Method for Solving General System of Equations via Gene...
Zac Darcy
Particle Swarm Optimization
Particle Swarm OptimizationParticle Swarm Optimization
Particle Swarm Optimization
QasimRehman
GABPN genetic algorithm based back propogation networknew.pptx
GABPN genetic algorithm based back propogation networknew.pptxGABPN genetic algorithm based back propogation networknew.pptx
GABPN genetic algorithm based back propogation networknew.pptx
ravikumarfulwaria
Quantum inspired evolutionary algorithm for solving multiple travelling sales...
Quantum inspired evolutionary algorithm for solving multiple travelling sales...Quantum inspired evolutionary algorithm for solving multiple travelling sales...
Quantum inspired evolutionary algorithm for solving multiple travelling sales...
eSAT Publishing House
Genetic Algorithm
Genetic AlgorithmGenetic Algorithm
Genetic Algorithm
SHIMI S L
Genetic algorithms
Genetic algorithmsGenetic algorithms
Genetic algorithms
guest9938738
An Implementational approach to genetic algorithms for TSP
An Implementational approach to genetic algorithms for TSPAn Implementational approach to genetic algorithms for TSP
An Implementational approach to genetic algorithms for TSP
Sougata Das
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
Jari Abbas
Genetic algorithm optimization technique.pptx
Genetic algorithm optimization technique.pptxGenetic algorithm optimization technique.pptx
Genetic algorithm optimization technique.pptx
sridharece1
53564379-Ant-Colony-Optimization.ppt
53564379-Ant-Colony-Optimization.ppt53564379-Ant-Colony-Optimization.ppt
53564379-Ant-Colony-Optimization.ppt
AhmedSalimJAlJawadi
Muzammil Adulrahman ppt on travelling salesman Problem Based On Mutation Gene...
Muzammil Adulrahman ppt on travelling salesman Problem Based On Mutation Gene...Muzammil Adulrahman ppt on travelling salesman Problem Based On Mutation Gene...
Muzammil Adulrahman ppt on travelling salesman Problem Based On Mutation Gene...
Petroleum Training Institute
Particle Swarm Optimization
Particle Swarm OptimizationParticle Swarm Optimization
Particle Swarm Optimization
Stelios Petrakis

More from DrBaljitSinghKhehra (6)

Ann 3
Ann 3Ann 3
Ann 3
DrBaljitSinghKhehra
Deep learning
Deep learningDeep learning
Deep learning
DrBaljitSinghKhehra
Back propagation
Back propagation Back propagation
Back propagation
DrBaljitSinghKhehra
Artificial Neural Networks-Supervised Learning Models
Artificial Neural Networks-Supervised Learning ModelsArtificial Neural Networks-Supervised Learning Models
Artificial Neural Networks-Supervised Learning Models
DrBaljitSinghKhehra
Artificial Neural Networks-Supervised Learning Models
Artificial Neural Networks-Supervised Learning ModelsArtificial Neural Networks-Supervised Learning Models
Artificial Neural Networks-Supervised Learning Models
DrBaljitSinghKhehra
Artificial Neural Networks-Supervised Learning Models
Artificial Neural Networks-Supervised Learning ModelsArtificial Neural Networks-Supervised Learning Models
Artificial Neural Networks-Supervised Learning Models
DrBaljitSinghKhehra
Artificial Neural Networks-Supervised Learning Models
Artificial Neural Networks-Supervised Learning ModelsArtificial Neural Networks-Supervised Learning Models
Artificial Neural Networks-Supervised Learning Models
DrBaljitSinghKhehra
Artificial Neural Networks-Supervised Learning Models
Artificial Neural Networks-Supervised Learning ModelsArtificial Neural Networks-Supervised Learning Models
Artificial Neural Networks-Supervised Learning Models
DrBaljitSinghKhehra
Artificial Neural Networks-Supervised Learning Models
Artificial Neural Networks-Supervised Learning ModelsArtificial Neural Networks-Supervised Learning Models
Artificial Neural Networks-Supervised Learning Models
DrBaljitSinghKhehra

Recently uploaded (20)

Comprehensive Hematology Overview: Blood Physiology, Disorders, and Diagnostics
Comprehensive Hematology Overview: Blood Physiology, Disorders, and DiagnosticsComprehensive Hematology Overview: Blood Physiology, Disorders, and Diagnostics
Comprehensive Hematology Overview: Blood Physiology, Disorders, and Diagnostics
rdiasolatorio
Steve Nickel In God I Trust 03.23.2025.pptx
Steve Nickel In God I Trust 03.23.2025.pptxSteve Nickel In God I Trust 03.23.2025.pptx
Steve Nickel In God I Trust 03.23.2025.pptx
FamilyWorshipCenterD
Supporting innovations at scale through relevant funding mechanisms and markets
Supporting innovations at scale through relevant funding mechanisms and marketsSupporting innovations at scale through relevant funding mechanisms and markets
Supporting innovations at scale through relevant funding mechanisms and markets
Francois Stepman
1. Critical thinking to write down .pptx
1. Critical thinking to write down .pptx1. Critical thinking to write down .pptx
1. Critical thinking to write down .pptx
hibahassan160702
Front-End Specialization Certification: A Journey with Style!
Front-End Specialization Certification: A Journey with Style!Front-End Specialization Certification: A Journey with Style!
Front-End Specialization Certification: A Journey with Style!
ShubhamSharma2528
The Global NARS Consortium (GNC) supported by: Transforming the Agri-Food Sys...
The Global NARS Consortium (GNC) supported by: Transforming the Agri-Food Sys...The Global NARS Consortium (GNC) supported by: Transforming the Agri-Food Sys...
The Global NARS Consortium (GNC) supported by: Transforming the Agri-Food Sys...
Francois Stepman
Shadows of Tet story created by me for a work
Shadows of Tet story created by me for a workShadows of Tet story created by me for a work
Shadows of Tet story created by me for a work
lucasczaffari
Attitude Presentation on people behaviours
Attitude Presentation on people behavioursAttitude Presentation on people behaviours
Attitude Presentation on people behaviours
Abrar Ali Shah
A Resilient Caribbean: Catalysing our Transformation
A Resilient Caribbean: Catalysing our TransformationA Resilient Caribbean: Catalysing our Transformation
A Resilient Caribbean: Catalysing our Transformation
Caribbean Development Bank
Present Continuous Tense kelas 8 kurikulum k13
Present Continuous Tense kelas 8 kurikulum k13Present Continuous Tense kelas 8 kurikulum k13
Present Continuous Tense kelas 8 kurikulum k13
agustinusgudipun
FACEBOOK-AS-ONLINE-BUSINESS-PLATFORM.pptx
FACEBOOK-AS-ONLINE-BUSINESS-PLATFORM.pptxFACEBOOK-AS-ONLINE-BUSINESS-PLATFORM.pptx
FACEBOOK-AS-ONLINE-BUSINESS-PLATFORM.pptx
estenzomaria08
Building Resilience to Climate Change and Disasters in the Caribbean
Building Resilience to Climate Change and Disasters in the CaribbeanBuilding Resilience to Climate Change and Disasters in the Caribbean
Building Resilience to Climate Change and Disasters in the Caribbean
Caribbean Development Bank
R辿union Paris sur ECCE unesco 2006
R辿union  Paris sur ECCE unesco 2006R辿union  Paris sur ECCE unesco 2006
R辿union Paris sur ECCE unesco 2006
RdM-RoW Blog story
Video Skills for Authors: Mastering Your On-Camera Presence
Video Skills for Authors: Mastering Your On-Camera PresenceVideo Skills for Authors: Mastering Your On-Camera Presence
Video Skills for Authors: Mastering Your On-Camera Presence
Paula Rizzo
Raspberry-Pi-as-a-Web-Server-Complete.pptx
Raspberry-Pi-as-a-Web-Server-Complete.pptxRaspberry-Pi-as-a-Web-Server-Complete.pptx
Raspberry-Pi-as-a-Web-Server-Complete.pptx
SaqibAwan37
SMALL-BUSINESS: the impacts of small business enterprises
SMALL-BUSINESS: the impacts of small business enterprisesSMALL-BUSINESS: the impacts of small business enterprises
SMALL-BUSINESS: the impacts of small business enterprises
estenzomaria08
Book Presentation - Hacking Home Devices I: PoCs & Hacks Just for Fun
Book Presentation - Hacking Home Devices I: PoCs & Hacks Just for FunBook Presentation - Hacking Home Devices I: PoCs & Hacks Just for Fun
Book Presentation - Hacking Home Devices I: PoCs & Hacks Just for Fun
Gerard Fuguet
2025-03-23 FATC 04 Mary, Martha, Lazarus & Mary Magdalene (shared slides).pptx
2025-03-23 FATC 04 Mary, Martha, Lazarus & Mary Magdalene (shared slides).pptx2025-03-23 FATC 04 Mary, Martha, Lazarus & Mary Magdalene (shared slides).pptx
2025-03-23 FATC 04 Mary, Martha, Lazarus & Mary Magdalene (shared slides).pptx
Dale Wells
Rebirth: Innovate, Transform and Thrive for a Resilient Future
Rebirth: Innovate, Transform and Thrive for a Resilient FutureRebirth: Innovate, Transform and Thrive for a Resilient Future
Rebirth: Innovate, Transform and Thrive for a Resilient Future
Caribbean Development Bank
Regional Economic Performance and Prospects: Progress Towards a Resilient Future
Regional Economic Performance and Prospects: Progress Towards a Resilient FutureRegional Economic Performance and Prospects: Progress Towards a Resilient Future
Regional Economic Performance and Prospects: Progress Towards a Resilient Future
Caribbean Development Bank
Comprehensive Hematology Overview: Blood Physiology, Disorders, and Diagnostics
Comprehensive Hematology Overview: Blood Physiology, Disorders, and DiagnosticsComprehensive Hematology Overview: Blood Physiology, Disorders, and Diagnostics
Comprehensive Hematology Overview: Blood Physiology, Disorders, and Diagnostics
rdiasolatorio
Steve Nickel In God I Trust 03.23.2025.pptx
Steve Nickel In God I Trust 03.23.2025.pptxSteve Nickel In God I Trust 03.23.2025.pptx
Steve Nickel In God I Trust 03.23.2025.pptx
FamilyWorshipCenterD
Supporting innovations at scale through relevant funding mechanisms and markets
Supporting innovations at scale through relevant funding mechanisms and marketsSupporting innovations at scale through relevant funding mechanisms and markets
Supporting innovations at scale through relevant funding mechanisms and markets
Francois Stepman
1. Critical thinking to write down .pptx
1. Critical thinking to write down .pptx1. Critical thinking to write down .pptx
1. Critical thinking to write down .pptx
hibahassan160702
Front-End Specialization Certification: A Journey with Style!
Front-End Specialization Certification: A Journey with Style!Front-End Specialization Certification: A Journey with Style!
Front-End Specialization Certification: A Journey with Style!
ShubhamSharma2528
The Global NARS Consortium (GNC) supported by: Transforming the Agri-Food Sys...
The Global NARS Consortium (GNC) supported by: Transforming the Agri-Food Sys...The Global NARS Consortium (GNC) supported by: Transforming the Agri-Food Sys...
The Global NARS Consortium (GNC) supported by: Transforming the Agri-Food Sys...
Francois Stepman
Shadows of Tet story created by me for a work
Shadows of Tet story created by me for a workShadows of Tet story created by me for a work
Shadows of Tet story created by me for a work
lucasczaffari
Attitude Presentation on people behaviours
Attitude Presentation on people behavioursAttitude Presentation on people behaviours
Attitude Presentation on people behaviours
Abrar Ali Shah
A Resilient Caribbean: Catalysing our Transformation
A Resilient Caribbean: Catalysing our TransformationA Resilient Caribbean: Catalysing our Transformation
A Resilient Caribbean: Catalysing our Transformation
Caribbean Development Bank
Present Continuous Tense kelas 8 kurikulum k13
Present Continuous Tense kelas 8 kurikulum k13Present Continuous Tense kelas 8 kurikulum k13
Present Continuous Tense kelas 8 kurikulum k13
agustinusgudipun
FACEBOOK-AS-ONLINE-BUSINESS-PLATFORM.pptx
FACEBOOK-AS-ONLINE-BUSINESS-PLATFORM.pptxFACEBOOK-AS-ONLINE-BUSINESS-PLATFORM.pptx
FACEBOOK-AS-ONLINE-BUSINESS-PLATFORM.pptx
estenzomaria08
Building Resilience to Climate Change and Disasters in the Caribbean
Building Resilience to Climate Change and Disasters in the CaribbeanBuilding Resilience to Climate Change and Disasters in the Caribbean
Building Resilience to Climate Change and Disasters in the Caribbean
Caribbean Development Bank
R辿union Paris sur ECCE unesco 2006
R辿union  Paris sur ECCE unesco 2006R辿union  Paris sur ECCE unesco 2006
R辿union Paris sur ECCE unesco 2006
RdM-RoW Blog story
Video Skills for Authors: Mastering Your On-Camera Presence
Video Skills for Authors: Mastering Your On-Camera PresenceVideo Skills for Authors: Mastering Your On-Camera Presence
Video Skills for Authors: Mastering Your On-Camera Presence
Paula Rizzo
Raspberry-Pi-as-a-Web-Server-Complete.pptx
Raspberry-Pi-as-a-Web-Server-Complete.pptxRaspberry-Pi-as-a-Web-Server-Complete.pptx
Raspberry-Pi-as-a-Web-Server-Complete.pptx
SaqibAwan37
SMALL-BUSINESS: the impacts of small business enterprises
SMALL-BUSINESS: the impacts of small business enterprisesSMALL-BUSINESS: the impacts of small business enterprises
SMALL-BUSINESS: the impacts of small business enterprises
estenzomaria08
Book Presentation - Hacking Home Devices I: PoCs & Hacks Just for Fun
Book Presentation - Hacking Home Devices I: PoCs & Hacks Just for FunBook Presentation - Hacking Home Devices I: PoCs & Hacks Just for Fun
Book Presentation - Hacking Home Devices I: PoCs & Hacks Just for Fun
Gerard Fuguet
2025-03-23 FATC 04 Mary, Martha, Lazarus & Mary Magdalene (shared slides).pptx
2025-03-23 FATC 04 Mary, Martha, Lazarus & Mary Magdalene (shared slides).pptx2025-03-23 FATC 04 Mary, Martha, Lazarus & Mary Magdalene (shared slides).pptx
2025-03-23 FATC 04 Mary, Martha, Lazarus & Mary Magdalene (shared slides).pptx
Dale Wells
Rebirth: Innovate, Transform and Thrive for a Resilient Future
Rebirth: Innovate, Transform and Thrive for a Resilient FutureRebirth: Innovate, Transform and Thrive for a Resilient Future
Rebirth: Innovate, Transform and Thrive for a Resilient Future
Caribbean Development Bank
Regional Economic Performance and Prospects: Progress Towards a Resilient Future
Regional Economic Performance and Prospects: Progress Towards a Resilient FutureRegional Economic Performance and Prospects: Progress Towards a Resilient Future
Regional Economic Performance and Prospects: Progress Towards a Resilient Future
Caribbean Development Bank

Ga for shortest_path

  • 1. GENETIC ALGORITHM FOR FINDING THE SHORTEST PATH Dr. Baljit Singh Khehra Professor, CSE Department BBSB Engineering College, Fatehgarh Sahib
  • 2. Introduction of Genetic Algorithms GA is a computer algorithm that searches for good solutions to a problem among a large number of possible solutions. GAs are based on the mechanism of natural genetics and natural selection. In GAs, maintain a population of some feasible solutions for given problem.This population undergoes evolution in a form of natural selection. In each generation relatively good solutions reproduce and relatively bad solutions die, to be replaced by the offspring of the good.
  • 3. Problem Description In TSP, to find shortest Hamiltonian cycle in complete graph. Permutation Problem. NP-Hard Problem.
  • 4. Fitness Measure Step 1: Traverse the cities according to the sequence in a tour Step 2: Calculate d(ci, ci+1) using equation d(ci, ci+1) = (x-s)2 + (y-t)2 and find the total distance in the tour n Total distance = S d (ci, ci+1) + d (cn,c1) i=1 Step3: Calculate the fitness of the chromosome in the population using the equation fit (tk) = 1/Total distance
  • 5. Selection Method Steady-state selection mechanism is used in this algorithm. In steady-state selection, two chromosomes from population are selected for crossover. The offspring so obtained replace the least fit chromosome in the existing population.
  • 6. Partially Mapped crossover Step 1:Two chromosomes as parent P1 and P2 are aligned, and two crossover sites are picked uniformly at random along the chromosomes. Step 2:Each element between the two crossover points in the alternate parent is mapped to the position held by this element in the first parent. Step3:The remaining elements are inherited from the parent without any conflict.
  • 7. Partially Mapped crossover Step 4:If conflict occurs, then for the first child: (a) Find the position of the element,where conflict occurs, in the second parent. Pick the element from that position in the first parent and place it that position where conflict occur in the first child. (b) For the second child, parent roles reversed.
  • 8. Swap Mutation Operator Step 1: Randomly choose one tour and randomly select two mutation points. Step 2: Interchange the cities at these two points.
  • 9. Overall Procedure of GA to Solve TSP Step 1: Setting the parameter Set the parameter: number of cities n, population size pop_size, crossover probability pc, mutation probability pm, and maximum generation maxgen. Let generation gen = 0, maxeval = 0 Step 2: Initialization Generate pop_size chromosomes (tours) randomly.
  • 10. Overall Procedure of GA to Solve TSP Step 3: Evaluate Step 3.1: Calculate the fitness value of each chromosome . Step 3.2: if maxeval < max{fit(tk)} Then bestsol = findbest {fit(tk)} and maxeval = max {fit (tk)}
  • 11. Overall Procedure of GA to Solve TSP Step 4: Crossover Perform the crossover PMX on chromosomes selected with probability pc. Step 5: Mutation Perform the swap mutation on chromosomes selected with probability pm.
  • 12. Overall Procedure of GA to Solve TSP Step 6: Selection Select pop_size chromosomes from the parents and offspring for the next generation by steady state selection method. Step 7: Stop testing If gen = maxgen , then output bestsol and stop Else gen = gen + 1 and return to step 3
  • 14. The best tour after 2600 iterations
  • 15. Problem Size GA 10 20 30 BEST AVG 56.47 58.81 64.15 45.36 52.89 55.91 Experimental Results
  • 16. Performance of the Experiment Performance of the experiment when n=20: The size of the solution space: 20! / (20*2) = 60822550204416000 The number of the particles:18 The number of the iterations of the algorithm:2600 The size of the search space: 46800 Search space/solution space: 7.6945E-11%