SlideShare a Scribd company logo
1 of 9
TRAVELING
SALESPERSON
PROBLEM
M.NIVETHITHA,
DEPARTMENT OF INFORMATION TECHNOLOGY,
V.V.VANNIYAPERUMAL COLLEGE FOR WOMEN,
VIRUDHUNAGAR.
DYNAMIC PROGRAMMING
2
 Dynamic programming is an algorithm design method that can be
used when the solution to a problem can be viewed as the result of
a sequence of decisions.
PRINCIPAL OF OPTIMALITY
 Principal of optimality states that an optimal sequence of decisions.
TRAVELING SALESPERSON PROBLEM
DEFINITION
 The traveling salesperson problem is finding a minimum tour of length.
 Let G = (V,E) be a directed graph with edge costs cij .
 A tour of G is a directed simple cycle that included every vertex in V.
 The cost of a tour is the sum of the cost of the edges on the tour.
 The traveling salesperson is finding a minimum tour of cost.
3
EXAMPLE
 We have to route a postal van to pick up mails from mail boxes located
at n different sites.
 An n+1 vertex graph can be used to represents the situation.
 One vertex represents the post office from which the postal van stars
and to which it must return.
 The route taken by the postal van is a tour, and we are finding a “ tour
of minimum length “. 4
Virudhunagr
Thirumangalam
Madurai Kanniyakumari
Start
&
End
 A path starts and ends at vertex .
5
 The path from vertex k to vertex 1 goes through each
vertex in V – { 1, k } exactly once.
 Let g( i , s ) be the length of a shortest path starting at vertex i,
going through all vertices in s, and terminating at vertex 1.
 The function g( 1, V – {1}) is the length of an optimal salesperson
tour.
g(i , s) = min { Cij + g( j, s – { j }) }
 The g values can be obtained by using
g(i , ᶲ) = Ci1 , 1 ≤ i ≤ n
g(i , s) for all s of size.
EXAMPLE
Consider the directed graph
1 2
4 3
0 10 15 20
5 0 9 10
6 13 0 12
8 8 9 0
7
1
2 3
4
3 4 2 4 2 3
4 3 4 2 3 2
0 10 15 20
5 0 9 10
6 13 0 12
8 8 9 0
8
 g (i , s) = min { C1k + g ( k, s – { k } ) }
 g (1 , {2,3,4}) = min { C1k + g ( k, { 2,3,4 } – { k } ) }
 g (2 , ᶲ ) = 5
 g (3 , ᶲ ) = 6
 g (4 , ᶲ ) = 8
 g (3 , ᶲ ) = 6
 g (4 , ᶲ ) = 8
 g (2 , {3}) = 15
 g (2 , {4}) = 18
 g (3 , {2}) = 18
 g (3 , {4}) = 20
 g (4 , {2}) = 13
 g (4 , {3}) = 15
 g (2 , {3,4}) = 25
 g (3 , {2,4}) = 25
 g (4 , {2,3}) = 23
 g (1 , {2,3,4}) = min { C12 + g(2 , {3,4}), C13 + g(3 , {2,4}), C14 + g(4 , {2,4}) }
 g (1 , {2,3,4}) = min {(10+25), (15+25), (20+23)}
 g (1 , {2,3,4}) = min { 35, 40, 43 }
g (1 , {2,3,4}) = min { 35 } Shortest Path {1,2,4,3,1}
9

More Related Content

What's hot

Alg 2 : multiply ing & factoring
Alg 2 : multiply ing & factoringAlg 2 : multiply ing & factoring
Alg 2 : multiply ing & factoring
paksukur
 
More multiplication properties of exponents
More multiplication properties of exponents More multiplication properties of exponents
More multiplication properties of exponents
chrystal_brinson
 
Conversion from infix to prefix using stack
Conversion from infix to prefix using stackConversion from infix to prefix using stack
Conversion from infix to prefix using stack
Haqnawaz Ch
 

What's hot (20)

Tsp branch and-bound
Tsp branch and-boundTsp branch and-bound
Tsp branch and-bound
 
Exercise
ExerciseExercise
Exercise
 
JUEC 初中 (2013 Past Year)
JUEC 初中 (2013 Past Year)JUEC 初中 (2013 Past Year)
JUEC 初中 (2013 Past Year)
 
ailet maths question
ailet maths questionailet maths question
ailet maths question
 
Completing the square v002
Completing the square v002Completing the square v002
Completing the square v002
 
Alg 2 : multiply ing & factoring
Alg 2 : multiply ing & factoringAlg 2 : multiply ing & factoring
Alg 2 : multiply ing & factoring
 
Lecture28 tsp
Lecture28 tspLecture28 tsp
Lecture28 tsp
 
Class notes precalc
Class notes precalcClass notes precalc
Class notes precalc
 
More multiplication properties of exponents
More multiplication properties of exponents More multiplication properties of exponents
More multiplication properties of exponents
 
Finding volume of Easter Egg by integration
Finding volume of Easter Egg by integrationFinding volume of Easter Egg by integration
Finding volume of Easter Egg by integration
 
Chap10alg
Chap10algChap10alg
Chap10alg
 
1 fichas refuerzo operaciones combinadas numeros
1 fichas refuerzo operaciones combinadas numeros1 fichas refuerzo operaciones combinadas numeros
1 fichas refuerzo operaciones combinadas numeros
 
Logistic Management Statistic Project (Comparison of JNU port and Mumbai Port...
Logistic Management Statistic Project (Comparison of JNU port and Mumbai Port...Logistic Management Statistic Project (Comparison of JNU port and Mumbai Port...
Logistic Management Statistic Project (Comparison of JNU port and Mumbai Port...
 
Mates2
Mates2Mates2
Mates2
 
4
44
4
 
Budynas sm ch01
Budynas sm ch01Budynas sm ch01
Budynas sm ch01
 
algebraic expressions class viii Hindi version sushma
algebraic expressions class viii Hindi version sushmaalgebraic expressions class viii Hindi version sushma
algebraic expressions class viii Hindi version sushma
 
Textbook problems worked out
Textbook problems worked outTextbook problems worked out
Textbook problems worked out
 
Conversion from infix to prefix using stack
Conversion from infix to prefix using stackConversion from infix to prefix using stack
Conversion from infix to prefix using stack
 
20 days-of-2d-cad-exercises-part-i
20 days-of-2d-cad-exercises-part-i20 days-of-2d-cad-exercises-part-i
20 days-of-2d-cad-exercises-part-i
 

Similar to Traveling salesperson

Skiena algorithm 2007 lecture15 backtracing
Skiena algorithm 2007 lecture15 backtracingSkiena algorithm 2007 lecture15 backtracing
Skiena algorithm 2007 lecture15 backtracing
zukun
 

Similar to Traveling salesperson (20)

Unit 3 daa
Unit 3 daaUnit 3 daa
Unit 3 daa
 
algorithm Unit 3
algorithm Unit 3algorithm Unit 3
algorithm Unit 3
 
module4_dynamic programming_2022.pdf
module4_dynamic programming_2022.pdfmodule4_dynamic programming_2022.pdf
module4_dynamic programming_2022.pdf
 
Graph Analytics and Complexity Questions and answers
Graph Analytics and Complexity Questions and answersGraph Analytics and Complexity Questions and answers
Graph Analytics and Complexity Questions and answers
 
On Cubic Graceful Labeling
On Cubic Graceful LabelingOn Cubic Graceful Labeling
On Cubic Graceful Labeling
 
Goldberg-Coxeter construction for 3- or 4-valent plane maps
Goldberg-Coxeter construction for 3- or 4-valent plane mapsGoldberg-Coxeter construction for 3- or 4-valent plane maps
Goldberg-Coxeter construction for 3- or 4-valent plane maps
 
Elliptic Curve Cryptography
Elliptic Curve CryptographyElliptic Curve Cryptography
Elliptic Curve Cryptography
 
Kumegawa russia
Kumegawa russiaKumegawa russia
Kumegawa russia
 
735
735735
735
 
On the Odd Gracefulness of Cyclic Snakes With Pendant Edges
On the Odd Gracefulness of Cyclic Snakes With Pendant EdgesOn the Odd Gracefulness of Cyclic Snakes With Pendant Edges
On the Odd Gracefulness of Cyclic Snakes With Pendant Edges
 
DISTANCE TWO LABELING FOR MULTI-STOREY GRAPHS
DISTANCE TWO LABELING FOR MULTI-STOREY GRAPHSDISTANCE TWO LABELING FOR MULTI-STOREY GRAPHS
DISTANCE TWO LABELING FOR MULTI-STOREY GRAPHS
 
The International Journal of Engineering and Science (IJES)
The International Journal of Engineering and Science (IJES)The International Journal of Engineering and Science (IJES)
The International Journal of Engineering and Science (IJES)
 
Some New Prime Graphs
Some New Prime GraphsSome New Prime Graphs
Some New Prime Graphs
 
Magicness in Extended Duplicate Graphs
Magicness  in Extended Duplicate GraphsMagicness  in Extended Duplicate Graphs
Magicness in Extended Duplicate Graphs
 
Skiena algorithm 2007 lecture15 backtracing
Skiena algorithm 2007 lecture15 backtracingSkiena algorithm 2007 lecture15 backtracing
Skiena algorithm 2007 lecture15 backtracing
 
workbook_full_solutions_2.pdf
workbook_full_solutions_2.pdfworkbook_full_solutions_2.pdf
workbook_full_solutions_2.pdf
 
ODD GRACEFULL LABELING FOR THE SUBDIVISON OF DOUBLE TRIANGLES GRAPHS
ODD GRACEFULL LABELING FOR THE SUBDIVISON OF DOUBLE TRIANGLES GRAPHSODD GRACEFULL LABELING FOR THE SUBDIVISON OF DOUBLE TRIANGLES GRAPHS
ODD GRACEFULL LABELING FOR THE SUBDIVISON OF DOUBLE TRIANGLES GRAPHS
 
Radix-3 Algorithm for Realization of Type-II Discrete Sine Transform
Radix-3 Algorithm for Realization of Type-II Discrete Sine TransformRadix-3 Algorithm for Realization of Type-II Discrete Sine Transform
Radix-3 Algorithm for Realization of Type-II Discrete Sine Transform
 
Radix-3 Algorithm for Realization of Type-II Discrete Sine Transform
Radix-3 Algorithm for Realization of Type-II Discrete Sine TransformRadix-3 Algorithm for Realization of Type-II Discrete Sine Transform
Radix-3 Algorithm for Realization of Type-II Discrete Sine Transform
 
Set 1 mawar
Set 1 mawarSet 1 mawar
Set 1 mawar
 

Recently uploaded

Heat Units in plant physiology and the importance of Growing Degree days
Heat Units in plant physiology and the importance of Growing Degree daysHeat Units in plant physiology and the importance of Growing Degree days
Heat Units in plant physiology and the importance of Growing Degree days
Brahmesh Reddy B R
 
Warming the earth and the atmosphere.pptx
Warming the earth and the atmosphere.pptxWarming the earth and the atmosphere.pptx
Warming the earth and the atmosphere.pptx
GlendelCaroz
 
GENETICALLY MODIFIED ORGANISM'S PRESENTATION.ppt
GENETICALLY MODIFIED ORGANISM'S PRESENTATION.pptGENETICALLY MODIFIED ORGANISM'S PRESENTATION.ppt
GENETICALLY MODIFIED ORGANISM'S PRESENTATION.ppt
SyedArifMalki
 
Nanoparticles for the Treatment of Alzheimer’s Disease_102718.pptx
Nanoparticles for the Treatment of Alzheimer’s Disease_102718.pptxNanoparticles for the Treatment of Alzheimer’s Disease_102718.pptx
Nanoparticles for the Treatment of Alzheimer’s Disease_102718.pptx
ssusera4ec7b
 

Recently uploaded (20)

THE FUNDAMENTAL UNIT OF LIFE CLASS IX.ppt
THE FUNDAMENTAL UNIT OF LIFE CLASS IX.pptTHE FUNDAMENTAL UNIT OF LIFE CLASS IX.ppt
THE FUNDAMENTAL UNIT OF LIFE CLASS IX.ppt
 
Polyethylene and its polymerization.pptx
Polyethylene and its polymerization.pptxPolyethylene and its polymerization.pptx
Polyethylene and its polymerization.pptx
 
EU START PROJECT. START-Newsletter_Issue_4.pdf
EU START PROJECT. START-Newsletter_Issue_4.pdfEU START PROJECT. START-Newsletter_Issue_4.pdf
EU START PROJECT. START-Newsletter_Issue_4.pdf
 
PHOTOSYNTHETIC BACTERIA (OXYGENIC AND ANOXYGENIC)
PHOTOSYNTHETIC BACTERIA  (OXYGENIC AND ANOXYGENIC)PHOTOSYNTHETIC BACTERIA  (OXYGENIC AND ANOXYGENIC)
PHOTOSYNTHETIC BACTERIA (OXYGENIC AND ANOXYGENIC)
 
Micropropagation of Madagascar periwinkle (Catharanthus roseus)
Micropropagation of Madagascar periwinkle (Catharanthus roseus)Micropropagation of Madagascar periwinkle (Catharanthus roseus)
Micropropagation of Madagascar periwinkle (Catharanthus roseus)
 
Vital Signs of Animals Presentation By Aftab Ahmed Rahimoon
Vital Signs of Animals Presentation By Aftab Ahmed RahimoonVital Signs of Animals Presentation By Aftab Ahmed Rahimoon
Vital Signs of Animals Presentation By Aftab Ahmed Rahimoon
 
An Overview of Active and Passive Targeting Strategies to Improve the Nano-Ca...
An Overview of Active and Passive Targeting Strategies to Improve the Nano-Ca...An Overview of Active and Passive Targeting Strategies to Improve the Nano-Ca...
An Overview of Active and Passive Targeting Strategies to Improve the Nano-Ca...
 
GBSN - Microbiology (Unit 5) Concept of isolation
GBSN - Microbiology (Unit 5) Concept of isolationGBSN - Microbiology (Unit 5) Concept of isolation
GBSN - Microbiology (Unit 5) Concept of isolation
 
Heat Units in plant physiology and the importance of Growing Degree days
Heat Units in plant physiology and the importance of Growing Degree daysHeat Units in plant physiology and the importance of Growing Degree days
Heat Units in plant physiology and the importance of Growing Degree days
 
X-rays from a Central “Exhaust Vent” of the Galactic Center Chimney
X-rays from a Central “Exhaust Vent” of the Galactic Center ChimneyX-rays from a Central “Exhaust Vent” of the Galactic Center Chimney
X-rays from a Central “Exhaust Vent” of the Galactic Center Chimney
 
TransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRings
TransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRingsTransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRings
TransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRings
 
Warming the earth and the atmosphere.pptx
Warming the earth and the atmosphere.pptxWarming the earth and the atmosphere.pptx
Warming the earth and the atmosphere.pptx
 
Introduction and significance of Symbiotic algae
Introduction and significance of  Symbiotic algaeIntroduction and significance of  Symbiotic algae
Introduction and significance of Symbiotic algae
 
ANITINUTRITION FACTOR GYLCOSIDES SAPONINS CYANODENS
ANITINUTRITION FACTOR GYLCOSIDES SAPONINS CYANODENSANITINUTRITION FACTOR GYLCOSIDES SAPONINS CYANODENS
ANITINUTRITION FACTOR GYLCOSIDES SAPONINS CYANODENS
 
Adaptive Restore algorithm & importance Monte Carlo
Adaptive Restore algorithm & importance Monte CarloAdaptive Restore algorithm & importance Monte Carlo
Adaptive Restore algorithm & importance Monte Carlo
 
FORENSIC CHEMISTRY ARSON INVESTIGATION.pdf
FORENSIC CHEMISTRY ARSON INVESTIGATION.pdfFORENSIC CHEMISTRY ARSON INVESTIGATION.pdf
FORENSIC CHEMISTRY ARSON INVESTIGATION.pdf
 
GENETICALLY MODIFIED ORGANISM'S PRESENTATION.ppt
GENETICALLY MODIFIED ORGANISM'S PRESENTATION.pptGENETICALLY MODIFIED ORGANISM'S PRESENTATION.ppt
GENETICALLY MODIFIED ORGANISM'S PRESENTATION.ppt
 
GBSN - Biochemistry (Unit 8) Enzymology
GBSN - Biochemistry (Unit 8) EnzymologyGBSN - Biochemistry (Unit 8) Enzymology
GBSN - Biochemistry (Unit 8) Enzymology
 
Nanoparticles for the Treatment of Alzheimer’s Disease_102718.pptx
Nanoparticles for the Treatment of Alzheimer’s Disease_102718.pptxNanoparticles for the Treatment of Alzheimer’s Disease_102718.pptx
Nanoparticles for the Treatment of Alzheimer’s Disease_102718.pptx
 
Manganese‐RichSandstonesasanIndicatorofAncientOxic LakeWaterConditionsinGale...
Manganese‐RichSandstonesasanIndicatorofAncientOxic  LakeWaterConditionsinGale...Manganese‐RichSandstonesasanIndicatorofAncientOxic  LakeWaterConditionsinGale...
Manganese‐RichSandstonesasanIndicatorofAncientOxic LakeWaterConditionsinGale...
 

Traveling salesperson

  • 1. TRAVELING SALESPERSON PROBLEM M.NIVETHITHA, DEPARTMENT OF INFORMATION TECHNOLOGY, V.V.VANNIYAPERUMAL COLLEGE FOR WOMEN, VIRUDHUNAGAR.
  • 2. DYNAMIC PROGRAMMING 2  Dynamic programming is an algorithm design method that can be used when the solution to a problem can be viewed as the result of a sequence of decisions. PRINCIPAL OF OPTIMALITY  Principal of optimality states that an optimal sequence of decisions.
  • 3. TRAVELING SALESPERSON PROBLEM DEFINITION  The traveling salesperson problem is finding a minimum tour of length.  Let G = (V,E) be a directed graph with edge costs cij .  A tour of G is a directed simple cycle that included every vertex in V.  The cost of a tour is the sum of the cost of the edges on the tour.  The traveling salesperson is finding a minimum tour of cost. 3
  • 4. EXAMPLE  We have to route a postal van to pick up mails from mail boxes located at n different sites.  An n+1 vertex graph can be used to represents the situation.  One vertex represents the post office from which the postal van stars and to which it must return.  The route taken by the postal van is a tour, and we are finding a “ tour of minimum length “. 4 Virudhunagr Thirumangalam Madurai Kanniyakumari Start & End
  • 5.  A path starts and ends at vertex . 5  The path from vertex k to vertex 1 goes through each vertex in V – { 1, k } exactly once.  Let g( i , s ) be the length of a shortest path starting at vertex i, going through all vertices in s, and terminating at vertex 1.  The function g( 1, V – {1}) is the length of an optimal salesperson tour. g(i , s) = min { Cij + g( j, s – { j }) }  The g values can be obtained by using g(i , ᶲ) = Ci1 , 1 ≤ i ≤ n g(i , s) for all s of size.
  • 6. EXAMPLE Consider the directed graph 1 2 4 3 0 10 15 20 5 0 9 10 6 13 0 12 8 8 9 0
  • 7. 7 1 2 3 4 3 4 2 4 2 3 4 3 4 2 3 2 0 10 15 20 5 0 9 10 6 13 0 12 8 8 9 0
  • 8. 8  g (i , s) = min { C1k + g ( k, s – { k } ) }  g (1 , {2,3,4}) = min { C1k + g ( k, { 2,3,4 } – { k } ) }  g (2 , ᶲ ) = 5  g (3 , ᶲ ) = 6  g (4 , ᶲ ) = 8  g (3 , ᶲ ) = 6  g (4 , ᶲ ) = 8  g (2 , {3}) = 15  g (2 , {4}) = 18  g (3 , {2}) = 18  g (3 , {4}) = 20  g (4 , {2}) = 13  g (4 , {3}) = 15  g (2 , {3,4}) = 25  g (3 , {2,4}) = 25  g (4 , {2,3}) = 23  g (1 , {2,3,4}) = min { C12 + g(2 , {3,4}), C13 + g(3 , {2,4}), C14 + g(4 , {2,4}) }  g (1 , {2,3,4}) = min {(10+25), (15+25), (20+23)}  g (1 , {2,3,4}) = min { 35, 40, 43 } g (1 , {2,3,4}) = min { 35 } Shortest Path {1,2,4,3,1}
  • 9. 9