Traveling Salesman Problem

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 20

TRAVELING

SALESMAN
PROBLEM
TRAVELING SALESMAN
PROBLEM
The Travelling Salesman Problem (TSP) is a
combinatorial problem that deals with finding the
shortest and most efficient route to follow for
reaching a list of specific destinations.
1. Nearest Neighbor Algorithm
POPULAR SOLUTIONS TO TRAVELLING
2. The Branch & Bound Method
SALESMAN PROBLEM
3. The brute-force approach
• is a type of greedy algorithm which
means that at every stage of the
algorithm we pick the best possible
edge to use.
NEAREST
NEIGHBOR • The simplest and easiest to understand
of the TSP solutions.
ALGORITHM
• The key to this method is to always
visit the nearest destination and then go
back to the first city when all other
nodes/cities are visited.
NEAREST NEIGHBOR ALGORITHM A

8
7

11
E B

15 12
6
8

D 5 C
NEAREST NEIGHBOR ALGORITHM A

8
7

11
E B

15 12
6
8

D 5 C
NEAREST NEIGHBOR ALGORITHM A

8
7

11
E B

15 12
6
8

D 5 C
• is a type of greedy algorithm which
means that at every stage of the
algorithm we pick the best possible
edge to use.
THE BRANCH &
BOUND • For each city i, 1≤i ≤ n, find the sum si of the distances from city i to
the two nearest cities; compute the sum s of these n numbers, divide
the result by 2, and, if all the distances are integers, round up the

METHOD result to the nearest integer:

Lb=[s/2]
THE BRANCH & BOUND METHOD

A 5 B
2 9
3 7

D
1 C

A
B 
C
D
THE BRANCH & BOUND METHOD

A 5 B
2 9
3 7

D
1 C

A AC+AD= 5
B  BA+BC= 12
C  CD+CA= 3
D  DC+DA= 4
24
24/2=12
THE BRANCH & BOUND METHOD A
LB=12
A 5 B
2 9 AB AC AD
3 7 LB= LB= LB=

D
1 C

A AC+AD= 5
A
B  BA+BC= 12
B 
C  CD+CA= 3
C
D  DC+DA= 4
24 D

24/2=12
THE BRANCH & BOUND METHOD A
LB=12
A 5 B
2 9 AB AC AD
3 7 LB= 13 LB= 12 LB= 12

D ACB ACD
1 C
LB= 18 LB= 12

A AC+AD= 5
A
B  BA+BC= 12
B 
C  CD+CA= 3
C
D  DC+DA= 4
24 D

24/2=12
• A brute force approach is an approach
that finds all the possible solutions to
THE BRUTE- find a satisfactory solution to a given
problem.
FORCE • The brute force solution is simply to
APPROACH calculate the total distance for every
possible route and then select the
shortest one.
THE BRUTE-FORCE APPROACH

2
A B

7
8
5
3

D
10 C
THE BRUTE-FORCE APPROACH A

2
A B
B C D
7
8
5 C D B D B C
3

D C D B C B
D
10 C

A A A A A A
THE BRUTE-FORCE APPROACH A
2 5
7
2
A B
B C D
7 3 8 3 10 8 10
8
5 C D B D B C
3
10 10 8 8 3 3

D C D B C B
D 2
10 C 5 7 5 2 7

A A A A A A

20 27 23 27 23 20
THE BRUTE-FORCE APPROACH

2
A B

7
8
5
3

D
10 C
• The Christofides Algorithm is an approximation algorithm that
offers an approximate solution to the TSP.

OTHER SOLUTIONS TO TRAVELLING • The Held–Karp algorithm — sometimes called the Bellman–Held–
SALESMAN PROBLEM Karp algorithm — measures the distances between all cities listed.

• Closest Insertion algorithm is similar to the Nearest Neighbor


Algorithm in the sense that they are both greedy algorithms.
Real-Life Applications of Travelling Salesman Problem
Last Mile Delivery
REFERENCES:

https://www.upperinc.com/guides/travelling-salesman-problem/
https://getcircuit.com/teams/blog/what-is-the-traveling-salesman-problem
https://www.mathematics.pitt.edu/sites/default/files/TSP.pdf
https://www.javatpoint.com/brute-force-approach
https://youtu.be/aaaVm6uUY5A
https://www.youtube.com/watch?v=aaaVm6uUY5A

You might also like