SlideShare a Scribd company logo
Traveling salesman
What are the differences between 'Backtracking'
and 'Branch & Bound' Algorithm techniques?
Backtracking
[1] It is used to find all possible
solutions available to the problem.
[2] It traverse tree by DFS (Depth First
Search).
[3] It realizes that it has made a bad
choice & undoes the last choice by
backing up.
[4] It search the state space tree until it
found a solution.
[5] It involves feasibility function
Branch-and-Bound
[1] It is used to solve optimization problem.
[2] It may traverse the tree in any manner,
DFS or BFS.
[3] It realizes that it already has a better
optimal solution that the pre-solution leads to
so it abandons that pre-solution.
[4] It completely searches the state space tree
to get optimal solution.
[5] It involves bounding function.
Here is the state space tree for n=4 (Using Branch And Bound)
What is traveling salesman problem?
• Let us look at a situation that there are 5 cities,
which are represented as NODES.
• There is a Person at NODE-1
• This person has to reach each nodes one and only
ones and come back to original (starting) position
• This process has to occur with minimum cost or
minimum distance travelled.
• Note that starting point can start with any Node. For
Example:
1-2-4-5-3-1
1-5-2-3-4-1
How to compute the cost of each node?
• A row/column is said to be reduce iff it contains at least one zero and
all remaining entries are non-negative.
• A matrix is reduced iff every row and column is reduced.
Rules of reduced cost matrix :
1. Change all entries in row i and column j from A to inf
2. Set A[j,1] to inf
3. Reduce all rows and columns in the resulting except for rows and
column containing only inf.
4. Cost Function C(s)=C(R)+A[i,j]+ r [r – total reduce value]
-10
-2
-2
-3
-4
REDUCTION (ROW)
INF 20 30 10 11
15 INF 16 4 2
3 5 INF 2 4
19 6 18 INF 3
16 4 7 16 INF
-1 -3
COLUMN REDUCTION
TOTAL REDUCTION = (10+2+2+3+4)+(1+3)
= 25
INF 10 17 0 1
12 INF 11 2 0
1 3 INF 0 2
15 3 12 INF 0
11 0 3 12 INF
INF 10 17 0 1
12 INF 11 2 0
0 3 INF 0 2
15 3 12 INF 0
11 0 0 12 INF
Thank you all…….

More Related Content

What's hot

DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSGayathri Gaayu
 
Breadth First Search & Depth First Search
Breadth First Search & Depth First SearchBreadth First Search & Depth First Search
Breadth First Search & Depth First Search
Kevin Jadiya
 
Complexity of Algorithm
Complexity of AlgorithmComplexity of Algorithm
Complexity of Algorithm
Muhammad Muzammal
 
Restoring & Non-Restoring Division Algorithm By Sania Nisar
Restoring & Non-Restoring Division Algorithm By Sania NisarRestoring & Non-Restoring Division Algorithm By Sania Nisar
Restoring & Non-Restoring Division Algorithm By Sania Nisar
Sania Nisar
 
8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back trackingTech_MX
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
Chankey Pathak
 
DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-Systems
Venkata Sreeram
 
Instruction format
Instruction formatInstruction format
Instruction format
Sanjeev Patel
 
Time space trade off
Time space trade offTime space trade off
Time space trade off
anisha talwar
 
Bottom up parser
Bottom up parserBottom up parser
Bottom up parser
Akshaya Arunan
 
Methods for handling deadlock
Methods for handling deadlockMethods for handling deadlock
Methods for handling deadlock
sangrampatil81
 
Data structure ppt
Data structure pptData structure ppt
Data structure ppt
Prof. Dr. K. Adisesha
 
Algorithm and pseudocode conventions
Algorithm and pseudocode conventionsAlgorithm and pseudocode conventions
Algorithm and pseudocode conventions
saranyatdr
 
Instruction Set Architecture
Instruction Set ArchitectureInstruction Set Architecture
Instruction Set Architecture
Dilum Bandara
 
Multi Head, Multi Tape Turing Machine
Multi Head, Multi Tape Turing MachineMulti Head, Multi Tape Turing Machine
Multi Head, Multi Tape Turing Machine
Radhakrishnan Chinnusamy
 
Presentation on risc pipeline
Presentation on risc pipelinePresentation on risc pipeline
Presentation on risc pipeline
Arijit Chakraborty
 

What's hot (20)

DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
 
Breadth First Search & Depth First Search
Breadth First Search & Depth First SearchBreadth First Search & Depth First Search
Breadth First Search & Depth First Search
 
Complexity of Algorithm
Complexity of AlgorithmComplexity of Algorithm
Complexity of Algorithm
 
Restoring & Non-Restoring Division Algorithm By Sania Nisar
Restoring & Non-Restoring Division Algorithm By Sania NisarRestoring & Non-Restoring Division Algorithm By Sania Nisar
Restoring & Non-Restoring Division Algorithm By Sania Nisar
 
8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back tracking
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-Systems
 
Instruction format
Instruction formatInstruction format
Instruction format
 
Memory management
Memory managementMemory management
Memory management
 
Time space trade off
Time space trade offTime space trade off
Time space trade off
 
Bottom up parser
Bottom up parserBottom up parser
Bottom up parser
 
Methods for handling deadlock
Methods for handling deadlockMethods for handling deadlock
Methods for handling deadlock
 
Semaphores
SemaphoresSemaphores
Semaphores
 
AVL Tree
AVL TreeAVL Tree
AVL Tree
 
Data structure ppt
Data structure pptData structure ppt
Data structure ppt
 
Algorithm and pseudocode conventions
Algorithm and pseudocode conventionsAlgorithm and pseudocode conventions
Algorithm and pseudocode conventions
 
Instruction Set Architecture
Instruction Set ArchitectureInstruction Set Architecture
Instruction Set Architecture
 
Multi Head, Multi Tape Turing Machine
Multi Head, Multi Tape Turing MachineMulti Head, Multi Tape Turing Machine
Multi Head, Multi Tape Turing Machine
 
Presentation on risc pipeline
Presentation on risc pipelinePresentation on risc pipeline
Presentation on risc pipeline
 
Virtual memory ppt
Virtual memory pptVirtual memory ppt
Virtual memory ppt
 

Viewers also liked

Travelling Salesperson Problem-Branch & Bound
Travelling Salesperson Problem-Branch & BoundTravelling Salesperson Problem-Branch & Bound
Travelling Salesperson Problem-Branch & Bound
SharmilaChidaravalli
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
Myrian Santos
 
Branch & bound
Branch & boundBranch & bound
Branch & bound
kannanchirayath
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
Nv Thejaswini
 
Branch and bounding : Data structures
Branch and bounding : Data structuresBranch and bounding : Data structures
Branch and bounding : Data structures
Kàŕtheek Jåvvàjí
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound technique
ishmecse13
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound technique
ishmecse13
 
Back tracking and branch and bound class 20
Back tracking and branch and bound class 20Back tracking and branch and bound class 20
Back tracking and branch and bound class 20Kumar
 

Viewers also liked (9)

Travelling Salesperson Problem-Branch & Bound
Travelling Salesperson Problem-Branch & BoundTravelling Salesperson Problem-Branch & Bound
Travelling Salesperson Problem-Branch & Bound
 
Branch&bound at
Branch&bound atBranch&bound at
Branch&bound at
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
 
Branch & bound
Branch & boundBranch & bound
Branch & bound
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
 
Branch and bounding : Data structures
Branch and bounding : Data structuresBranch and bounding : Data structures
Branch and bounding : Data structures
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound technique
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound technique
 
Back tracking and branch and bound class 20
Back tracking and branch and bound class 20Back tracking and branch and bound class 20
Back tracking and branch and bound class 20
 

Similar to Travelling Salesman

Branch and Bound.pptx
Branch and Bound.pptxBranch and Bound.pptx
Branch and Bound.pptx
JoshipavanEdduluru1
 
designanalysisalgorithm_unit-v-part2.pptx
designanalysisalgorithm_unit-v-part2.pptxdesignanalysisalgorithm_unit-v-part2.pptx
designanalysisalgorithm_unit-v-part2.pptx
arifimad15
 
Data structure - traveling sales person and mesh algorithm
Data structure - traveling sales person and mesh algorithmData structure - traveling sales person and mesh algorithm
Data structure - traveling sales person and mesh algorithm
lavanya marichamy
 
Search algorithms for discrete optimization
Search algorithms for discrete optimizationSearch algorithms for discrete optimization
Search algorithms for discrete optimization
Sally Salem
 
Sure interview algorithm-1103
Sure interview algorithm-1103Sure interview algorithm-1103
Sure interview algorithm-1103Sure Interview
 
Data Structure Marge sort Group 5 pptx so
Data Structure Marge sort Group 5 pptx soData Structure Marge sort Group 5 pptx so
Data Structure Marge sort Group 5 pptx so
Salma368452
 
Cs1123 4 variables_constants
Cs1123 4 variables_constantsCs1123 4 variables_constants
Cs1123 4 variables_constantsTAlha MAlik
 
Exploring Algorithms
Exploring AlgorithmsExploring Algorithms
Exploring AlgorithmsSri Prasanna
 
Performance Analysis of OFDM Transceiver with Folded FFT and LMS Filter
Performance Analysis of OFDM Transceiver with Folded FFT and LMS FilterPerformance Analysis of OFDM Transceiver with Folded FFT and LMS Filter
Performance Analysis of OFDM Transceiver with Folded FFT and LMS Filter
idescitation
 
Programming in c by pkv
Programming in c by pkvProgramming in c by pkv
Programming in c by pkv
Pramod Vishwakarma
 
Programming
ProgrammingProgramming
Programming
Sean Chia
 
Linear Programing.pptx
Linear Programing.pptxLinear Programing.pptx
Linear Programing.pptx
AdnanHaleem
 
Framework for Extensible, Asynchronous Task Scheduling (FEATS) in Fortran
Framework for Extensible, Asynchronous Task Scheduling (FEATS) in FortranFramework for Extensible, Asynchronous Task Scheduling (FEATS) in Fortran
Framework for Extensible, Asynchronous Task Scheduling (FEATS) in Fortran
Patrick Diehl
 
Control Flow Graphs
Control Flow GraphsControl Flow Graphs
Control Flow Graphs
daimk2020
 
Control Flow Graphs
Control Flow GraphsControl Flow Graphs
Control Flow Graphs
daimk2020
 
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docxINFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
carliotwaycave
 
Assignment Problem
Assignment ProblemAssignment Problem
Assignment Problem
Nakul Bhardwaj
 
qadm-ppt-150918102124-lva1-app6892.pdf
qadm-ppt-150918102124-lva1-app6892.pdfqadm-ppt-150918102124-lva1-app6892.pdf
qadm-ppt-150918102124-lva1-app6892.pdf
Hari31856
 

Similar to Travelling Salesman (20)

Skyline queries
Skyline queriesSkyline queries
Skyline queries
 
Branch and Bound.pptx
Branch and Bound.pptxBranch and Bound.pptx
Branch and Bound.pptx
 
designanalysisalgorithm_unit-v-part2.pptx
designanalysisalgorithm_unit-v-part2.pptxdesignanalysisalgorithm_unit-v-part2.pptx
designanalysisalgorithm_unit-v-part2.pptx
 
Data structure - traveling sales person and mesh algorithm
Data structure - traveling sales person and mesh algorithmData structure - traveling sales person and mesh algorithm
Data structure - traveling sales person and mesh algorithm
 
Search algorithms for discrete optimization
Search algorithms for discrete optimizationSearch algorithms for discrete optimization
Search algorithms for discrete optimization
 
Sure interview algorithm-1103
Sure interview algorithm-1103Sure interview algorithm-1103
Sure interview algorithm-1103
 
Data Structure Marge sort Group 5 pptx so
Data Structure Marge sort Group 5 pptx soData Structure Marge sort Group 5 pptx so
Data Structure Marge sort Group 5 pptx so
 
Cs1123 4 variables_constants
Cs1123 4 variables_constantsCs1123 4 variables_constants
Cs1123 4 variables_constants
 
Exploring Algorithms
Exploring AlgorithmsExploring Algorithms
Exploring Algorithms
 
Performance Analysis of OFDM Transceiver with Folded FFT and LMS Filter
Performance Analysis of OFDM Transceiver with Folded FFT and LMS FilterPerformance Analysis of OFDM Transceiver with Folded FFT and LMS Filter
Performance Analysis of OFDM Transceiver with Folded FFT and LMS Filter
 
Programming in c by pkv
Programming in c by pkvProgramming in c by pkv
Programming in c by pkv
 
Programming
ProgrammingProgramming
Programming
 
Linear Programing.pptx
Linear Programing.pptxLinear Programing.pptx
Linear Programing.pptx
 
Framework for Extensible, Asynchronous Task Scheduling (FEATS) in Fortran
Framework for Extensible, Asynchronous Task Scheduling (FEATS) in FortranFramework for Extensible, Asynchronous Task Scheduling (FEATS) in Fortran
Framework for Extensible, Asynchronous Task Scheduling (FEATS) in Fortran
 
Control Flow Graphs
Control Flow GraphsControl Flow Graphs
Control Flow Graphs
 
Control Flow Graphs
Control Flow GraphsControl Flow Graphs
Control Flow Graphs
 
Team 4
Team 4Team 4
Team 4
 
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docxINFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
 
Assignment Problem
Assignment ProblemAssignment Problem
Assignment Problem
 
qadm-ppt-150918102124-lva1-app6892.pdf
qadm-ppt-150918102124-lva1-app6892.pdfqadm-ppt-150918102124-lva1-app6892.pdf
qadm-ppt-150918102124-lva1-app6892.pdf
 

Travelling Salesman

  • 2. What are the differences between 'Backtracking' and 'Branch & Bound' Algorithm techniques? Backtracking [1] It is used to find all possible solutions available to the problem. [2] It traverse tree by DFS (Depth First Search). [3] It realizes that it has made a bad choice & undoes the last choice by backing up. [4] It search the state space tree until it found a solution. [5] It involves feasibility function Branch-and-Bound [1] It is used to solve optimization problem. [2] It may traverse the tree in any manner, DFS or BFS. [3] It realizes that it already has a better optimal solution that the pre-solution leads to so it abandons that pre-solution. [4] It completely searches the state space tree to get optimal solution. [5] It involves bounding function.
  • 3. Here is the state space tree for n=4 (Using Branch And Bound)
  • 4. What is traveling salesman problem? • Let us look at a situation that there are 5 cities, which are represented as NODES. • There is a Person at NODE-1 • This person has to reach each nodes one and only ones and come back to original (starting) position • This process has to occur with minimum cost or minimum distance travelled. • Note that starting point can start with any Node. For Example: 1-2-4-5-3-1 1-5-2-3-4-1
  • 5. How to compute the cost of each node? • A row/column is said to be reduce iff it contains at least one zero and all remaining entries are non-negative. • A matrix is reduced iff every row and column is reduced. Rules of reduced cost matrix : 1. Change all entries in row i and column j from A to inf 2. Set A[j,1] to inf 3. Reduce all rows and columns in the resulting except for rows and column containing only inf. 4. Cost Function C(s)=C(R)+A[i,j]+ r [r – total reduce value]
  • 6. -10 -2 -2 -3 -4 REDUCTION (ROW) INF 20 30 10 11 15 INF 16 4 2 3 5 INF 2 4 19 6 18 INF 3 16 4 7 16 INF -1 -3 COLUMN REDUCTION TOTAL REDUCTION = (10+2+2+3+4)+(1+3) = 25 INF 10 17 0 1 12 INF 11 2 0 1 3 INF 0 2 15 3 12 INF 0 11 0 3 12 INF INF 10 17 0 1 12 INF 11 2 0 0 3 INF 0 2 15 3 12 INF 0 11 0 0 12 INF
  • 7.
  • 8.
  • 9.