SlideShare una empresa de Scribd logo
1 de 13
Travelling Salesman Problem
Using Genetic Algorithms
By: Priyank Shah(1115082)
Shivank Shah(1115100)
Problem Definition
• The traveling salesman problem consists of a salesman and a
set of cities. The salesman has to visit each one of the cities
starting from a certain one (e.g. the hometown) and returning
to the same city. The challenge of the problem is that the
traveling salesman wants to minimize the total length of the
trip.
Method Used
• We have a set of cities (points) in 2d plane. Each city has
road to each city. We need to find loop-path that will be in
each city only one time and path length is minimal.
• The genetic algorithm is sequence of following operations
that repeated in generations loop:
1) Generate random population and finding path length.
2) find probabilities for selection.
3) prepare to crossover according probabilities.
4) crossover, parents replaced with children.
5) mutations.
STEP 1 : Create Random Population
• So we have a lot of paths with different lengths. A path can have
crossover with another path and mutate. After crossover it will be
replaced by its children. All paths recorded in matrix G :
• here we have population with 6 paths (population size ps=6), and it is
for 4 cities.
• In the code to generate initial population of random paths randperm
matlab function was used. It return randomly permutated numbers, for
example:
>> randperm(4)
ans =
3 4 2 1
STEP 2: Fitness evaluation
• To have fast calculation of paths length before start iteration,
it is calculated in a matrix of distancies dsm.It is a n x n matrix
where n is number of cities, dsm(i1,i2) is distance between
city i1 and city i2.
• The logic used is that if we want to minimize distance then we
want to maximize inverse distance.
• Thus the fitness function we want to maximize is the inverse
of distance
f(x)= 1/d
STEP 3 :SELECTION FOR CROSSOVER
• For this case roulette_wheel_indexes.m function was made. First calculate probabilities as
inverse distances divided by sum of inverse distances:
𝑝𝑖 =
1
𝑑𝑖
𝑖
1
𝑑𝑖
• Here 𝑝𝑖 is probability of 𝑖 path to be put to crossover, 𝑑𝑖 is 𝑖 path length.
• for example we have 6 paths with numbers
1 2 3 4 5 6
• and let it have probabilities
• 0.05 0.5 0.05 0.05 0.05 0.3
• then by using roulette_wheel_indexes.m function we will put for the crossover for example
• 1 2 6 2 6 2
• You can see that 2 most frequent and 6 also frequent, rest ELIMINATED. But all this is
random.
• So after that we have pair wise crossover:
1 and 2 (gives 2 children)
6 and 2 (gives 2 children)
6 and 2 (gives 2 children)
STEP 4: CROSSOVER
• The different crossover techniques used for solving the travelling
salesman problem are listed below:
• Among these PMX, ER and POS are quoted to be the fastest
operators as far as the number of necessary iterations to reach
convergence is concerned . The convergence rates of these three
operators are observed to be similar.
Example of PMX
STEP 5: MUTATION
• There are 3 types of mutations used:
1) Chose 2 random cities
and swap them,
Result:
2 1 3 4
STEP 5: MUTATION (CONT.)
2) mutation by exchange of 2 pieces of path :
• First randomly chose point of spit, for example
between 2 and 3 positions:
• now swap two pieces:
2 13 4
2 1 3 4
STEP 5 :MUTATION (CONT)
3) mutation of flip random piece of path
• first choose some random piece of path:
• now flip it left-right:
• Elitism means that we save best path and put it
manually to next generation without changes.
• G(1,:)=Gb; % elitism
2 71 63 84 5
2 81 63 74 5
References
• Genetic Algorithm Solution of the TSP Avoiding Special
Crossover and Mutation
G¨okt¨urk ¨Uc¸oluk
Department of Computer Engineering
Middle East Technical University
06531 Ankara, Turkey
THANK YOU !!

Más contenido relacionado

La actualidad más candente

Artificial Bee Colony algorithm
Artificial Bee Colony algorithmArtificial Bee Colony algorithm
Artificial Bee Colony algorithmAhmed Fouad Ali
 
Genetic algorithms
Genetic algorithmsGenetic algorithms
Genetic algorithmszamakhan
 
Local search algorithm
Local search algorithmLocal search algorithm
Local search algorithmMegha Sharma
 
Particle Swarm Optimization - PSO
Particle Swarm Optimization - PSOParticle Swarm Optimization - PSO
Particle Swarm Optimization - PSOMohamed Talaat
 
Flowchart of GA
Flowchart of GAFlowchart of GA
Flowchart of GAIshucs
 
Travelling salesman problem
Travelling salesman problemTravelling salesman problem
Travelling salesman problemWajahat Hussain
 
Chap 8. Optimization for training deep models
Chap 8. Optimization for training deep modelsChap 8. Optimization for training deep models
Chap 8. Optimization for training deep modelsYoung-Geun Choi
 
Genetic algorithm ppt
Genetic algorithm pptGenetic algorithm ppt
Genetic algorithm pptMayank Jain
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy methodhodcsencet
 
Unit 3 random number generation, random-variate generation
Unit 3 random number generation, random-variate generationUnit 3 random number generation, random-variate generation
Unit 3 random number generation, random-variate generationraksharao
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithmgarima931
 
Ant Colony Optimization
Ant Colony OptimizationAnt Colony Optimization
Ant Colony OptimizationPratik Poddar
 
Ant Colony Optimization presentation
Ant Colony Optimization presentationAnt Colony Optimization presentation
Ant Colony Optimization presentationPartha Das
 
Ant colony optimization
Ant colony optimizationAnt colony optimization
Ant colony optimizationJoy Dutta
 

La actualidad más candente (20)

Artificial Bee Colony algorithm
Artificial Bee Colony algorithmArtificial Bee Colony algorithm
Artificial Bee Colony algorithm
 
Genetic algorithms
Genetic algorithmsGenetic algorithms
Genetic algorithms
 
Adaptive equalization
Adaptive equalizationAdaptive equalization
Adaptive equalization
 
Local search algorithm
Local search algorithmLocal search algorithm
Local search algorithm
 
Particle Swarm Optimization - PSO
Particle Swarm Optimization - PSOParticle Swarm Optimization - PSO
Particle Swarm Optimization - PSO
 
Flowchart of GA
Flowchart of GAFlowchart of GA
Flowchart of GA
 
Congestion control
Congestion controlCongestion control
Congestion control
 
Travelling salesman problem
Travelling salesman problemTravelling salesman problem
Travelling salesman problem
 
RTOS Basic Concepts
RTOS Basic ConceptsRTOS Basic Concepts
RTOS Basic Concepts
 
Differential evolution
Differential evolutionDifferential evolution
Differential evolution
 
Chap 8. Optimization for training deep models
Chap 8. Optimization for training deep modelsChap 8. Optimization for training deep models
Chap 8. Optimization for training deep models
 
Genetic algorithm ppt
Genetic algorithm pptGenetic algorithm ppt
Genetic algorithm ppt
 
Computer networks - Channelization
Computer networks - ChannelizationComputer networks - Channelization
Computer networks - Channelization
 
AI Lecture 3 (solving problems by searching)
AI Lecture 3 (solving problems by searching)AI Lecture 3 (solving problems by searching)
AI Lecture 3 (solving problems by searching)
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy method
 
Unit 3 random number generation, random-variate generation
Unit 3 random number generation, random-variate generationUnit 3 random number generation, random-variate generation
Unit 3 random number generation, random-variate generation
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
 
Ant Colony Optimization
Ant Colony OptimizationAnt Colony Optimization
Ant Colony Optimization
 
Ant Colony Optimization presentation
Ant Colony Optimization presentationAnt Colony Optimization presentation
Ant Colony Optimization presentation
 
Ant colony optimization
Ant colony optimizationAnt colony optimization
Ant colony optimization
 

Similar a Travelling salesman problem using genetic algorithms

Comparison Study of Multiple Traveling Salesmen Problem using Genetic Algorithm
Comparison Study of Multiple Traveling Salesmen Problem using Genetic AlgorithmComparison Study of Multiple Traveling Salesmen Problem using Genetic Algorithm
Comparison Study of Multiple Traveling Salesmen Problem using Genetic AlgorithmIOSR Journals
 
Simulation of Crowd Evacuation scenarios using NetLogo
Simulation of Crowd Evacuation scenarios using NetLogoSimulation of Crowd Evacuation scenarios using NetLogo
Simulation of Crowd Evacuation scenarios using NetLogoFederico D'Amato
 
The Traveling Salesman problem ppt.pptx
The Traveling Salesman problem ppt.pptxThe Traveling Salesman problem ppt.pptx
The Traveling Salesman problem ppt.pptxHalimFerchichi
 
654719957459169719-gann-markov-games-presentation.pptx
654719957459169719-gann-markov-games-presentation.pptx654719957459169719-gann-markov-games-presentation.pptx
654719957459169719-gann-markov-games-presentation.pptxBiswajitLohar
 
Lecture 10 11-signal_flow_graphs
Lecture 10 11-signal_flow_graphsLecture 10 11-signal_flow_graphs
Lecture 10 11-signal_flow_graphsSaifullah Memon
 
3rd Conference on Sustainable Urban Mobility
3rd Conference on Sustainable Urban Mobility3rd Conference on Sustainable Urban Mobility
3rd Conference on Sustainable Urban MobilityLIFE GreenYourMove
 
Data Analysis and Algorithms Lecture 1: Introduction
 Data Analysis and Algorithms Lecture 1: Introduction Data Analysis and Algorithms Lecture 1: Introduction
Data Analysis and Algorithms Lecture 1: IntroductionTayyabSattar5
 
lec 2 Robotics time & motion
lec 2 Robotics time & motionlec 2 Robotics time & motion
lec 2 Robotics time & motioncairo university
 
ESCC 2016, July 10-16, Athens, Greece
ESCC 2016, July 10-16, Athens, GreeceESCC 2016, July 10-16, Athens, Greece
ESCC 2016, July 10-16, Athens, GreeceLIFE GreenYourMove
 
Presentation of GreenYourMove's hybrid approach in 3rd International Conferen...
Presentation of GreenYourMove's hybrid approach in 3rd International Conferen...Presentation of GreenYourMove's hybrid approach in 3rd International Conferen...
Presentation of GreenYourMove's hybrid approach in 3rd International Conferen...GreenYourMove
 
robotics presentation (2).ppt is good for the student life and easy to gain t...
robotics presentation (2).ppt is good for the student life and easy to gain t...robotics presentation (2).ppt is good for the student life and easy to gain t...
robotics presentation (2).ppt is good for the student life and easy to gain t...poojaranga2911
 
Popular search algorithms
Popular search algorithmsPopular search algorithms
Popular search algorithmsMinakshi Atre
 
Presentation of GreenYourMove's hybrid approach in the 3rd Conference on Sust...
Presentation of GreenYourMove's hybrid approach in the 3rd Conference on Sust...Presentation of GreenYourMove's hybrid approach in the 3rd Conference on Sust...
Presentation of GreenYourMove's hybrid approach in the 3rd Conference on Sust...GreenYourMove
 
With saloni in ijarcsse
With saloni in ijarcsseWith saloni in ijarcsse
With saloni in ijarcssesatish rana
 
Operation research model for solving TSP
Operation research model for solving TSPOperation research model for solving TSP
Operation research model for solving TSPDrGovindshaysharma
 

Similar a Travelling salesman problem using genetic algorithms (20)

Comparison Study of Multiple Traveling Salesmen Problem using Genetic Algorithm
Comparison Study of Multiple Traveling Salesmen Problem using Genetic AlgorithmComparison Study of Multiple Traveling Salesmen Problem using Genetic Algorithm
Comparison Study of Multiple Traveling Salesmen Problem using Genetic Algorithm
 
Simulation of Crowd Evacuation scenarios using NetLogo
Simulation of Crowd Evacuation scenarios using NetLogoSimulation of Crowd Evacuation scenarios using NetLogo
Simulation of Crowd Evacuation scenarios using NetLogo
 
The Traveling Salesman problem ppt.pptx
The Traveling Salesman problem ppt.pptxThe Traveling Salesman problem ppt.pptx
The Traveling Salesman problem ppt.pptx
 
654719957459169719-gann-markov-games-presentation.pptx
654719957459169719-gann-markov-games-presentation.pptx654719957459169719-gann-markov-games-presentation.pptx
654719957459169719-gann-markov-games-presentation.pptx
 
Lecture 10 11-signal_flow_graphs
Lecture 10 11-signal_flow_graphsLecture 10 11-signal_flow_graphs
Lecture 10 11-signal_flow_graphs
 
Traveling Eco-Salesman
Traveling Eco-SalesmanTraveling Eco-Salesman
Traveling Eco-Salesman
 
3rd Conference on Sustainable Urban Mobility
3rd Conference on Sustainable Urban Mobility3rd Conference on Sustainable Urban Mobility
3rd Conference on Sustainable Urban Mobility
 
Data Analysis and Algorithms Lecture 1: Introduction
 Data Analysis and Algorithms Lecture 1: Introduction Data Analysis and Algorithms Lecture 1: Introduction
Data Analysis and Algorithms Lecture 1: Introduction
 
lec 2 Robotics time & motion
lec 2 Robotics time & motionlec 2 Robotics time & motion
lec 2 Robotics time & motion
 
Lec2 state space
Lec2 state spaceLec2 state space
Lec2 state space
 
ESCC 2016, July 10-16, Athens, Greece
ESCC 2016, July 10-16, Athens, GreeceESCC 2016, July 10-16, Athens, Greece
ESCC 2016, July 10-16, Athens, Greece
 
Presentation escc 2016
Presentation escc 2016Presentation escc 2016
Presentation escc 2016
 
Presentation of GreenYourMove's hybrid approach in 3rd International Conferen...
Presentation of GreenYourMove's hybrid approach in 3rd International Conferen...Presentation of GreenYourMove's hybrid approach in 3rd International Conferen...
Presentation of GreenYourMove's hybrid approach in 3rd International Conferen...
 
robotics presentation (2).ppt is good for the student life and easy to gain t...
robotics presentation (2).ppt is good for the student life and easy to gain t...robotics presentation (2).ppt is good for the student life and easy to gain t...
robotics presentation (2).ppt is good for the student life and easy to gain t...
 
Popular search algorithms
Popular search algorithmsPopular search algorithms
Popular search algorithms
 
Presentation 3rd CSUM
Presentation 3rd CSUM Presentation 3rd CSUM
Presentation 3rd CSUM
 
Presentation of GreenYourMove's hybrid approach in the 3rd Conference on Sust...
Presentation of GreenYourMove's hybrid approach in the 3rd Conference on Sust...Presentation of GreenYourMove's hybrid approach in the 3rd Conference on Sust...
Presentation of GreenYourMove's hybrid approach in the 3rd Conference on Sust...
 
With saloni in ijarcsse
With saloni in ijarcsseWith saloni in ijarcsse
With saloni in ijarcsse
 
LLSF_for_Imperial
LLSF_for_ImperialLLSF_for_Imperial
LLSF_for_Imperial
 
Operation research model for solving TSP
Operation research model for solving TSPOperation research model for solving TSP
Operation research model for solving TSP
 

Último

CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 

Último (20)

CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 

Travelling salesman problem using genetic algorithms

  • 1. Travelling Salesman Problem Using Genetic Algorithms By: Priyank Shah(1115082) Shivank Shah(1115100)
  • 2. Problem Definition • The traveling salesman problem consists of a salesman and a set of cities. The salesman has to visit each one of the cities starting from a certain one (e.g. the hometown) and returning to the same city. The challenge of the problem is that the traveling salesman wants to minimize the total length of the trip.
  • 3. Method Used • We have a set of cities (points) in 2d plane. Each city has road to each city. We need to find loop-path that will be in each city only one time and path length is minimal. • The genetic algorithm is sequence of following operations that repeated in generations loop: 1) Generate random population and finding path length. 2) find probabilities for selection. 3) prepare to crossover according probabilities. 4) crossover, parents replaced with children. 5) mutations.
  • 4. STEP 1 : Create Random Population • So we have a lot of paths with different lengths. A path can have crossover with another path and mutate. After crossover it will be replaced by its children. All paths recorded in matrix G : • here we have population with 6 paths (population size ps=6), and it is for 4 cities. • In the code to generate initial population of random paths randperm matlab function was used. It return randomly permutated numbers, for example: >> randperm(4) ans = 3 4 2 1
  • 5. STEP 2: Fitness evaluation • To have fast calculation of paths length before start iteration, it is calculated in a matrix of distancies dsm.It is a n x n matrix where n is number of cities, dsm(i1,i2) is distance between city i1 and city i2. • The logic used is that if we want to minimize distance then we want to maximize inverse distance. • Thus the fitness function we want to maximize is the inverse of distance f(x)= 1/d
  • 6. STEP 3 :SELECTION FOR CROSSOVER • For this case roulette_wheel_indexes.m function was made. First calculate probabilities as inverse distances divided by sum of inverse distances: 𝑝𝑖 = 1 𝑑𝑖 𝑖 1 𝑑𝑖 • Here 𝑝𝑖 is probability of 𝑖 path to be put to crossover, 𝑑𝑖 is 𝑖 path length. • for example we have 6 paths with numbers 1 2 3 4 5 6 • and let it have probabilities • 0.05 0.5 0.05 0.05 0.05 0.3 • then by using roulette_wheel_indexes.m function we will put for the crossover for example • 1 2 6 2 6 2 • You can see that 2 most frequent and 6 also frequent, rest ELIMINATED. But all this is random. • So after that we have pair wise crossover: 1 and 2 (gives 2 children) 6 and 2 (gives 2 children) 6 and 2 (gives 2 children)
  • 7. STEP 4: CROSSOVER • The different crossover techniques used for solving the travelling salesman problem are listed below: • Among these PMX, ER and POS are quoted to be the fastest operators as far as the number of necessary iterations to reach convergence is concerned . The convergence rates of these three operators are observed to be similar.
  • 9. STEP 5: MUTATION • There are 3 types of mutations used: 1) Chose 2 random cities and swap them, Result: 2 1 3 4
  • 10. STEP 5: MUTATION (CONT.) 2) mutation by exchange of 2 pieces of path : • First randomly chose point of spit, for example between 2 and 3 positions: • now swap two pieces: 2 13 4 2 1 3 4
  • 11. STEP 5 :MUTATION (CONT) 3) mutation of flip random piece of path • first choose some random piece of path: • now flip it left-right: • Elitism means that we save best path and put it manually to next generation without changes. • G(1,:)=Gb; % elitism 2 71 63 84 5 2 81 63 74 5
  • 12. References • Genetic Algorithm Solution of the TSP Avoiding Special Crossover and Mutation G¨okt¨urk ¨Uc¸oluk Department of Computer Engineering Middle East Technical University 06531 Ankara, Turkey