Travelling
Salesman
Algorithm
Presented By
Md Sadman Sakib
Our team members who have
contributed their best.
Siam 2023-1-60-
119
Redoan Islam
2023-1-60-
118
Rakibul Islam
2023-1-60-
226
Introducti
on
Introduction
The Traveling Salesman Problem (TSP) is an optimization algorithm
for finding the shortest route to visit all cities exactly once and
return to the starting point. The aim is to minimize the total travel
cost or distance. This algorithm uses recursive backtracking to solve
the problem by exploring all possible paths and selecting the one
with the minimum cost. This approach ensures efficiency for small
datasets by eliminating unnecessary paths early which reduced the
computational burden. The output includes the optimal path and its
corresponding minimal travel cost, providing an ideal solution for
the given set of cities.
Flowcha
rt
Flowchart
Graphical
Representati
on
Graphical Representation
For 4 cities
The cost matrix is:
0 4 1 3
4 0 2 1
1 2 0 5
3 1 5 0
The shortest path is,
1 -> 3 -> 2 -> 4 -> 1
Time
Complexit
y
Time
Complexity
Recursive Calls:
The algorithm makes recursive calls for all subsets of cities.
Number of States: 2n ⋅n
All possible subsets of cities = : 2n
iteration through all cities for each subset = n
complexity = O( n⋅2n )
Path Reconstruction:
Reconstructing the optimal path requires a single loop over the cities.
complexity = O(n)
Final Complexity = O( n⋅2n )
Comparis
on
Why This Algorithm Is
Effective
Advantages:
Optimal Solution: Uses Dynamic Programming (DP) to guarantee the minimal
cost path compared to heuristic methods.
Reduced Redundancy: Memorization ensures subproblems are solved only
once, improving efficiency over brute-force approaches .
Deterministic Output: Always provides the correct result, making it reliable
for exact solutions.
Why This Algorithm Is
Effective
Limitations:
Time Complexity: 𝑂(𝑛⋅2𝑛), making it computationally expensive for
large 𝑛.
Space Complexity: Requires 𝑂(𝑛⋅2𝑛), which can be restrictive for
systems with limited memory.
Scalability: Unsuitable for real-world problems involving hundreds of
cities due to exponential growth in complexity.
Conclusion
The Travelling Salesman Problem (TSP) aims to find the shortest route visiting all
cities exactly once and returning to the start. Dynamic programming and
approximation algorithms offer efficient solutions for varying problem sizes. TSP is
widely used in logistics, networking, and route planning, balancing theory and
practical applications.
Thank
You