SlideShare a Scribd company logo
1 of 16
TRAVELLING SALESMAN
PROBLEM
PRESENTED BY:
Sidra Tahir (2018-BI-010)
Mariam Sajid (2018-BI-006)
(Data structure & algorithm)
WHAT IS TRAVELLING SALESMAN
PROBLEM?
The concept of Travelling
Salesman Problem TSP
is simple,
• It reflects a salesman's
problems that has to pass
through all the cities given
and return to its origin
with the shortest distance
to be travel.
Symmetric TSP with 4 cities
Asymmetric TSP with 4 cities
EXAMPLE
Is there a route that takes you through every city
and back to the start point ‘A’ for less than 520?
EXAMPLE (Continued)
The solution is
ABCGFDEA
100+120+50+30+40+90+70=500
EXAMPLE
A B C D E
A - 2 5 7 1
B 6 - 3 8 2
C 8 7 - 4 7
D 12 4 6 - 5
E 1 3 2 8 -
THE MOST IMPORTANT RULES
1. No city is to be visited twice before the tour
of all cities in completed.
2. Going to city i to i, is not permitted.
• E.g.: A->B->A
(no visiting can be repeated)
A B
STEP-BY-STEP RULES
STEP# 1: The row reduction:
In every row, we will find a minimum value and then we will minus
the rest of the values of that particular row, by that minimum value.
A B C D E
A - 1 4 6 0
B 4 - 1 6 0
C 4 3 - 0 3
D 8 0 2 - 1
E 0 2 1 7 -
A B C D E
A - 2 5 7 1
B 6 - 3 8 2
C 8 7 - 4 7
D 12 4 6 - 5
E 1 3 2 8 -
THE QUESTION ONE THE ROW REDUCTIVE ONE
STEP-BY-STEP RULES(CONTINUED)
STEP# 2: The column reduction:
In, the updated row reduction table’s every column, we will find a
minimum value and then we will minus the rest of the values of
that particular column, by that minimum value.
A B C D E
A - 1 4 6 0
B 4 - 1 6 0
C 4 3 - 0 3
D 8 0 2 - 1
E 0 2 1 7 -
A B C D E
A - 1 3 6 0
B 4 - 0 6 0
C 4 3 - 0 3
D 8 0 1 - 1
E 0 2 0 7 -
THE ROW REDUCTIVE ONE THE COLUMN REDUCTIVE ONE
STEP-BY-STEP RULES(CONTINUED)
Now we will have the modified Matrix.
STEP# 3: Next, we will see the zeros of every row and make them assigned [].
STEP# 4: We will now see if the rows containing zero’s columns has another
zero below it, then that zero will be crossed.
STEP# 5: Same goes for the columns too.
(This will be repeated until all the zeros aren't assigned or crossed)
A B C D E
A - 1 3 6 [0]
B 4 - [0] 6 0
C 4 3 - [0] 3
D 8 [0] 1 - 1
E [0] 2 0 7 -
THE COLUMN REDUCTIVE ONE
A B C D E
A - 1 3 6 0
B 4 - 0 6 0
C 4 3 - 0 3
D 8 0 1 - 1
E 0 2 0 7 -
THE ASSIGNED & CROSSED ONE
STEP-BY-STEP RULES(CONTINUED)
• STEP# 6: We will see if the matrix is an optimal
solution for the TSP or not.
(And it is not an optimal solution for TSP)
A B C D E
A - 1 3 6 [0]
B 4 - [0] 6 0
C 4 3 - [0] 3
D 8 [0] 1 - 1
E [0] 2 0 7 -
THE ASSIGNED & CROSSED ONE
STEP-BY-STEP RULES(CONTINUED)
STEP# 7: (For rows)
• We will prefer zero’s next highest and assign it and we’ll cross the extra zero in that
row.
• Now we will cross the zero of that assigned number’s column.
• Two zeroes in a row will be neglected.
• Next we will come to other rows. But there we will assign the zero.
• If there isn’t any zero then our priority will be one.
A B C D E
A - 1 3 6 [0]
B 4 - [0] 6 0
C 4 3 - [0] 3
D 8 [0] 1 - 1
E [0] 2 0 7 -
A B C D E
A - [1] 3 6 0
B 4 - 0 6 0
C 4 3 - [0] 3
D 8 0 1 - 1
E 0 2 0 7 -
THE PREVIOUS ONE THE NEW ONE
STEP-BY-STEP RULES(CONTINUED)
STEP# 8: (For column)
• The first zero will be assigned.
• And the rest of the zero in that row or the
assigned zero, will be crossed.
A B C D E
A - [1] 3 6 0
B 4 - 0 6 0
C 4 3 - [0] 3
D 8 0 1 - 1
E 0 2 0 7 -
A B C D E
A - [1] 3 6 0
B 4 - [0] 6 0
C 4 3 - [0] 3
D 8 0 1 - [1]
E [0] 2 0 7 -
THE PREVIOUS ONE THE NEW ONE
FINAL ROUTES
• In the final route, we have;
A->B, B->C, C->D, D->E, E->A
A B C D E
A - [1] 3 6 0
B 4 - [0] 6 0
C 4 3 - [0] 3
D 8 0 1 - [1]
E [0] 2 0 7 -
THE FINAL ROUTE ONE
CALCULATION OF THE COST
• A->B = 2
• B->C = 3
• C->D = 4
• D->E = 5
• E->A = 1
• TOTAL= 15 Rs/-
A B C D E
A - 2 5 7 1
B 6 - 3 8 2
C 8 7 - 4 7
D 12 4 6 - 5
E 1 3 2 8 -
THE QUESTION ONE
APPLICATIONS OF TSP
Transportation:
• School bus routes
• Service calls
• Delivering meals
Manufacturing:
• An industrial robot that drills holes in printed
circuit boards VLSI (microchip).
Layout communication:
• Planning new telecommunication
networks.
THANKYOU

More Related Content

What's hot

January 15, 2015
January 15, 2015January 15, 2015
January 15, 2015khyps13
 
1-25/10 Interior and Exterior Angles
1-25/10 Interior and Exterior Angles1-25/10 Interior and Exterior Angles
1-25/10 Interior and Exterior AnglesBrandeis High School
 
Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]
Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]
Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]Karthik Karunanithy
 
2.7.6 Coordinate Plane Quads
2.7.6 Coordinate Plane Quads2.7.6 Coordinate Plane Quads
2.7.6 Coordinate Plane Quadssmiller5
 
Identifying slope and y intercept
Identifying slope and y interceptIdentifying slope and y intercept
Identifying slope and y interceptrobertleichner
 
Graph Theory: Planarity & Dual Graph
Graph Theory: Planarity & Dual GraphGraph Theory: Planarity & Dual Graph
Graph Theory: Planarity & Dual GraphAshikur Rahman
 
11.3 slope of a line
11.3 slope of a line11.3 slope of a line
11.3 slope of a lineGlenSchlee
 
8.4 polygons 1
8.4 polygons 18.4 polygons 1
8.4 polygons 1bweldon
 
Chapter 2 polygons ii [compatibility mode]
Chapter 2   polygons ii [compatibility mode]Chapter 2   polygons ii [compatibility mode]
Chapter 2 polygons ii [compatibility mode]Khusaini Majid
 
Graphing inequalities in two variables
Graphing inequalities in two variablesGraphing inequalities in two variables
Graphing inequalities in two variablesJessica Garcia
 
Slopepowerpoint
SlopepowerpointSlopepowerpoint
Slopepowerpointwerhuotor
 
Billiards the diamond system-lâm quang tuấn
Billiards the diamond system-lâm quang tuấnBilliards the diamond system-lâm quang tuấn
Billiards the diamond system-lâm quang tuấnLam Quang Tuan
 
9.1 Properties of Polygons
9.1 Properties of Polygons9.1 Properties of Polygons
9.1 Properties of Polygonssmiller5
 
TechMathI - 3.1 - Lines in space
TechMathI - 3.1 - Lines in spaceTechMathI - 3.1 - Lines in space
TechMathI - 3.1 - Lines in spacelmrhodes
 
6.6 Graphing Inequalities In Two Variables
6.6 Graphing Inequalities In Two Variables6.6 Graphing Inequalities In Two Variables
6.6 Graphing Inequalities In Two Variablesguestd1dc2e
 

What's hot (18)

January 15, 2015
January 15, 2015January 15, 2015
January 15, 2015
 
1-25/10 Interior and Exterior Angles
1-25/10 Interior and Exterior Angles1-25/10 Interior and Exterior Angles
1-25/10 Interior and Exterior Angles
 
Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]
Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]
Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]
 
2.7.6 Coordinate Plane Quads
2.7.6 Coordinate Plane Quads2.7.6 Coordinate Plane Quads
2.7.6 Coordinate Plane Quads
 
Identifying slope and y intercept
Identifying slope and y interceptIdentifying slope and y intercept
Identifying slope and y intercept
 
Polygons
PolygonsPolygons
Polygons
 
Graph Theory: Planarity & Dual Graph
Graph Theory: Planarity & Dual GraphGraph Theory: Planarity & Dual Graph
Graph Theory: Planarity & Dual Graph
 
11.3 slope of a line
11.3 slope of a line11.3 slope of a line
11.3 slope of a line
 
8.4 polygons 1
8.4 polygons 18.4 polygons 1
8.4 polygons 1
 
Polygon presentation
Polygon  presentation Polygon  presentation
Polygon presentation
 
Chapter 2 polygons ii [compatibility mode]
Chapter 2   polygons ii [compatibility mode]Chapter 2   polygons ii [compatibility mode]
Chapter 2 polygons ii [compatibility mode]
 
Graphing inequalities in two variables
Graphing inequalities in two variablesGraphing inequalities in two variables
Graphing inequalities in two variables
 
Slopepowerpoint
SlopepowerpointSlopepowerpoint
Slopepowerpoint
 
Billiards the diamond system-lâm quang tuấn
Billiards the diamond system-lâm quang tuấnBilliards the diamond system-lâm quang tuấn
Billiards the diamond system-lâm quang tuấn
 
9.1 Properties of Polygons
9.1 Properties of Polygons9.1 Properties of Polygons
9.1 Properties of Polygons
 
TechMathI - 3.1 - Lines in space
TechMathI - 3.1 - Lines in spaceTechMathI - 3.1 - Lines in space
TechMathI - 3.1 - Lines in space
 
TIN 2013
TIN 2013TIN 2013
TIN 2013
 
6.6 Graphing Inequalities In Two Variables
6.6 Graphing Inequalities In Two Variables6.6 Graphing Inequalities In Two Variables
6.6 Graphing Inequalities In Two Variables
 

Similar to Travelling salesman problem

matrix algebra
matrix algebramatrix algebra
matrix algebrakganu
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithmsKaviya452563
 
Hungarian Assignment Problem
Hungarian Assignment ProblemHungarian Assignment Problem
Hungarian Assignment ProblemVivekSaurabh7
 
3. Boolean Algebra.pptx
3. Boolean Algebra.pptx3. Boolean Algebra.pptx
3. Boolean Algebra.pptxNaveenPunia5
 
TSP-MIN.-SPANNING-TREE.pptx
TSP-MIN.-SPANNING-TREE.pptxTSP-MIN.-SPANNING-TREE.pptx
TSP-MIN.-SPANNING-TREE.pptxKimmyGalupo
 
chp-1-matrices-determinants1.ppt
chp-1-matrices-determinants1.pptchp-1-matrices-determinants1.ppt
chp-1-matrices-determinants1.pptMichealMicheal11
 
chp-1-matrices-determinants1 (2).ppt
chp-1-matrices-determinants1 (2).pptchp-1-matrices-determinants1 (2).ppt
chp-1-matrices-determinants1 (2).pptrushikumar17
 
Number system and codes
Number system and codesNumber system and codes
Number system and codesAbhiraj Bohra
 
Determinants and matrices.ppt
Determinants and matrices.pptDeterminants and matrices.ppt
Determinants and matrices.pptSauravDash10
 
Matrices ,Basics, Determinant, Inverse, EigenValues, Linear Equations, RANK
Matrices ,Basics, Determinant, Inverse, EigenValues, Linear Equations, RANKMatrices ,Basics, Determinant, Inverse, EigenValues, Linear Equations, RANK
Matrices ,Basics, Determinant, Inverse, EigenValues, Linear Equations, RANKWaqas Afzal
 
Introduction of determinant
Introduction of determinantIntroduction of determinant
Introduction of determinantPankaj Das
 
Simple Linear Regression: Step-By-Step
Simple Linear Regression: Step-By-StepSimple Linear Regression: Step-By-Step
Simple Linear Regression: Step-By-StepDan Wellisch
 
Oct8 - 131 slid
Oct8 - 131 slidOct8 - 131 slid
Oct8 - 131 slidTak Lee
 
Form 4 Add Maths Chapter 6 Linear Law
Form 4 Add Maths Chapter 6 Linear LawForm 4 Add Maths Chapter 6 Linear Law
Form 4 Add Maths Chapter 6 Linear LawBrilliantAStudyClub
 
Decision Science.pdf
Decision Science.pdfDecision Science.pdf
Decision Science.pdfpandeyaman577
 
Presentation (1) sooraj.R.pptx
Presentation (1) sooraj.R.pptxPresentation (1) sooraj.R.pptx
Presentation (1) sooraj.R.pptxAkshay712352
 
Bezier Curve in Computer Graphics.docx
Bezier Curve in Computer Graphics.docxBezier Curve in Computer Graphics.docx
Bezier Curve in Computer Graphics.docxbcanawakadalcollege
 

Similar to Travelling salesman problem (20)

matrix algebra
matrix algebramatrix algebra
matrix algebra
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
UNIT V.pptx
UNIT V.pptxUNIT V.pptx
UNIT V.pptx
 
Hungarian Assignment Problem
Hungarian Assignment ProblemHungarian Assignment Problem
Hungarian Assignment Problem
 
3. Boolean Algebra.pptx
3. Boolean Algebra.pptx3. Boolean Algebra.pptx
3. Boolean Algebra.pptx
 
TSP-MIN.-SPANNING-TREE.pptx
TSP-MIN.-SPANNING-TREE.pptxTSP-MIN.-SPANNING-TREE.pptx
TSP-MIN.-SPANNING-TREE.pptx
 
chp-1-matrices-determinants1.ppt
chp-1-matrices-determinants1.pptchp-1-matrices-determinants1.ppt
chp-1-matrices-determinants1.ppt
 
chp-1-matrices-determinants1 (2).ppt
chp-1-matrices-determinants1 (2).pptchp-1-matrices-determinants1 (2).ppt
chp-1-matrices-determinants1 (2).ppt
 
Number system and codes
Number system and codesNumber system and codes
Number system and codes
 
Determinants and matrices.ppt
Determinants and matrices.pptDeterminants and matrices.ppt
Determinants and matrices.ppt
 
Matrices ,Basics, Determinant, Inverse, EigenValues, Linear Equations, RANK
Matrices ,Basics, Determinant, Inverse, EigenValues, Linear Equations, RANKMatrices ,Basics, Determinant, Inverse, EigenValues, Linear Equations, RANK
Matrices ,Basics, Determinant, Inverse, EigenValues, Linear Equations, RANK
 
Introduction of determinant
Introduction of determinantIntroduction of determinant
Introduction of determinant
 
Simple Linear Regression: Step-By-Step
Simple Linear Regression: Step-By-StepSimple Linear Regression: Step-By-Step
Simple Linear Regression: Step-By-Step
 
Oct8 - 131 slid
Oct8 - 131 slidOct8 - 131 slid
Oct8 - 131 slid
 
Form 4 Add Maths Chapter 6 Linear Law
Form 4 Add Maths Chapter 6 Linear LawForm 4 Add Maths Chapter 6 Linear Law
Form 4 Add Maths Chapter 6 Linear Law
 
Decision Science.pdf
Decision Science.pdfDecision Science.pdf
Decision Science.pdf
 
Simplex method
Simplex methodSimplex method
Simplex method
 
Presentation (1) sooraj.R.pptx
Presentation (1) sooraj.R.pptxPresentation (1) sooraj.R.pptx
Presentation (1) sooraj.R.pptx
 
Number Systems.ppt
Number Systems.pptNumber Systems.ppt
Number Systems.ppt
 
Bezier Curve in Computer Graphics.docx
Bezier Curve in Computer Graphics.docxBezier Curve in Computer Graphics.docx
Bezier Curve in Computer Graphics.docx
 

Recently uploaded

Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 

Recently uploaded (20)

Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 

Travelling salesman problem

  • 1. TRAVELLING SALESMAN PROBLEM PRESENTED BY: Sidra Tahir (2018-BI-010) Mariam Sajid (2018-BI-006) (Data structure & algorithm)
  • 2. WHAT IS TRAVELLING SALESMAN PROBLEM? The concept of Travelling Salesman Problem TSP is simple, • It reflects a salesman's problems that has to pass through all the cities given and return to its origin with the shortest distance to be travel. Symmetric TSP with 4 cities Asymmetric TSP with 4 cities
  • 3. EXAMPLE Is there a route that takes you through every city and back to the start point ‘A’ for less than 520?
  • 4. EXAMPLE (Continued) The solution is ABCGFDEA 100+120+50+30+40+90+70=500
  • 5. EXAMPLE A B C D E A - 2 5 7 1 B 6 - 3 8 2 C 8 7 - 4 7 D 12 4 6 - 5 E 1 3 2 8 -
  • 6. THE MOST IMPORTANT RULES 1. No city is to be visited twice before the tour of all cities in completed. 2. Going to city i to i, is not permitted. • E.g.: A->B->A (no visiting can be repeated) A B
  • 7. STEP-BY-STEP RULES STEP# 1: The row reduction: In every row, we will find a minimum value and then we will minus the rest of the values of that particular row, by that minimum value. A B C D E A - 1 4 6 0 B 4 - 1 6 0 C 4 3 - 0 3 D 8 0 2 - 1 E 0 2 1 7 - A B C D E A - 2 5 7 1 B 6 - 3 8 2 C 8 7 - 4 7 D 12 4 6 - 5 E 1 3 2 8 - THE QUESTION ONE THE ROW REDUCTIVE ONE
  • 8. STEP-BY-STEP RULES(CONTINUED) STEP# 2: The column reduction: In, the updated row reduction table’s every column, we will find a minimum value and then we will minus the rest of the values of that particular column, by that minimum value. A B C D E A - 1 4 6 0 B 4 - 1 6 0 C 4 3 - 0 3 D 8 0 2 - 1 E 0 2 1 7 - A B C D E A - 1 3 6 0 B 4 - 0 6 0 C 4 3 - 0 3 D 8 0 1 - 1 E 0 2 0 7 - THE ROW REDUCTIVE ONE THE COLUMN REDUCTIVE ONE
  • 9. STEP-BY-STEP RULES(CONTINUED) Now we will have the modified Matrix. STEP# 3: Next, we will see the zeros of every row and make them assigned []. STEP# 4: We will now see if the rows containing zero’s columns has another zero below it, then that zero will be crossed. STEP# 5: Same goes for the columns too. (This will be repeated until all the zeros aren't assigned or crossed) A B C D E A - 1 3 6 [0] B 4 - [0] 6 0 C 4 3 - [0] 3 D 8 [0] 1 - 1 E [0] 2 0 7 - THE COLUMN REDUCTIVE ONE A B C D E A - 1 3 6 0 B 4 - 0 6 0 C 4 3 - 0 3 D 8 0 1 - 1 E 0 2 0 7 - THE ASSIGNED & CROSSED ONE
  • 10. STEP-BY-STEP RULES(CONTINUED) • STEP# 6: We will see if the matrix is an optimal solution for the TSP or not. (And it is not an optimal solution for TSP) A B C D E A - 1 3 6 [0] B 4 - [0] 6 0 C 4 3 - [0] 3 D 8 [0] 1 - 1 E [0] 2 0 7 - THE ASSIGNED & CROSSED ONE
  • 11. STEP-BY-STEP RULES(CONTINUED) STEP# 7: (For rows) • We will prefer zero’s next highest and assign it and we’ll cross the extra zero in that row. • Now we will cross the zero of that assigned number’s column. • Two zeroes in a row will be neglected. • Next we will come to other rows. But there we will assign the zero. • If there isn’t any zero then our priority will be one. A B C D E A - 1 3 6 [0] B 4 - [0] 6 0 C 4 3 - [0] 3 D 8 [0] 1 - 1 E [0] 2 0 7 - A B C D E A - [1] 3 6 0 B 4 - 0 6 0 C 4 3 - [0] 3 D 8 0 1 - 1 E 0 2 0 7 - THE PREVIOUS ONE THE NEW ONE
  • 12. STEP-BY-STEP RULES(CONTINUED) STEP# 8: (For column) • The first zero will be assigned. • And the rest of the zero in that row or the assigned zero, will be crossed. A B C D E A - [1] 3 6 0 B 4 - 0 6 0 C 4 3 - [0] 3 D 8 0 1 - 1 E 0 2 0 7 - A B C D E A - [1] 3 6 0 B 4 - [0] 6 0 C 4 3 - [0] 3 D 8 0 1 - [1] E [0] 2 0 7 - THE PREVIOUS ONE THE NEW ONE
  • 13. FINAL ROUTES • In the final route, we have; A->B, B->C, C->D, D->E, E->A A B C D E A - [1] 3 6 0 B 4 - [0] 6 0 C 4 3 - [0] 3 D 8 0 1 - [1] E [0] 2 0 7 - THE FINAL ROUTE ONE
  • 14. CALCULATION OF THE COST • A->B = 2 • B->C = 3 • C->D = 4 • D->E = 5 • E->A = 1 • TOTAL= 15 Rs/- A B C D E A - 2 5 7 1 B 6 - 3 8 2 C 8 7 - 4 7 D 12 4 6 - 5 E 1 3 2 8 - THE QUESTION ONE
  • 15. APPLICATIONS OF TSP Transportation: • School bus routes • Service calls • Delivering meals Manufacturing: • An industrial robot that drills holes in printed circuit boards VLSI (microchip). Layout communication: • Planning new telecommunication networks.