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

Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
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
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
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
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
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
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 

Recently uploaded (20)

Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
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...
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
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
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
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
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 

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.