# Different Ways Of Solving The Travelling Salesperson Problem

1209 Words5 Pages
Title Comparison of different techniques to solve the Travelling Salesperson Problem. Abstract In this paper, we will be explaining three ways of solving the Travelling Salesperson Problem namely the brute force method, the dynamic programming method and the branch and bound method. We will then be doing a qualitative comparison of these three methods and see which one is better for solving this problem. Introduction Let us first define the Travelling Salesperson Problem. The problems asks us that given a set of cities and the distances between each of the cities, which path through the cities gives us the minimum distance travelled such that each city is visited only once and at the end of the path we return to the starting city. This…show more content…
For a problem with n cities this approach would take us O(n!) time. We have n cities to choose from initially. (n-1) choices for the 2nd city, (n-2) choices for the third city and so on. This gives the total number of paths to be n*(n-1)*(n- 2)......(1) = n!. Hence the time taken to solve this problem will be some multiple of n!. This approach makes solving this problem even for a very small amount of cities impractical. ￼ The Dynamic Programming Method The dynamic programming method improves on the brute force method by storing the minimum cost of sub paths to avoid computing those values again and again significantly improving the time complexity. When solving a problem with dynamic programming, we define the solution with the help of a recursive relation with explains how the problem is solved step by step. For travelling salesperson problem the recursive relation to find the shortest path starting from city “1” where the set of the cities is V is as follows: G(1,V-{1}) = min { C(1,k) + G(k, V-{k,1})} where k is from the set V-{1} C(i,j) gives the cost of travelling from city i to city j. So, as explained by this recursive relation, we select a city to start with and then recursively find the distances of sub paths and keep selecting the minimum. Since we store the minimum costs of all the sub paths, the complexity of this algorithm will be the total number of sub problems that we have to solve. To find the minimum cost path starting from