Question

The Traveling Salesman problem (TSP) is famous. Given a list of cities and the distances in between them, the task is to find

0 0
Add a comment Improve this question Transcribed image text
Answer #1

(a) Travelling Salesman Problem:

Given a set of cities and distance between every pair of cities, the problem is to find the shortest possible route or path that visits each city exactly once and returns to the starting point.

The problem is a famous NP hard problem in combinatorial optimization. Time complexity of travelling salesman is not polynomial but it is exponential. So, the problem is not solvable in polynomial time and hence, it comes under NP hard type problem.

Algorithm:

n=numbers of cities

m= n x n matrix of distances between cities

min=(infinity)

for all possible tours, do:

find the length of the tour

if length<min

min=length

store tour

Worst case (big O) time complexity of the given algorithm:

Solution to Travelling salesman problem:

Consider city 1 as the starting point and ending point.
Generate all (n-1)! Permutations of given cities.
Calculate cost of every permutation or tour and keep track of minimum cost permutation.
Return the permutation or tour with minimum cost.
Let the given set of cities be {1, 2, 3, 4,….n}. Let us consider city 1 as starting and ending point of output. For every other city i (other than 1), we find the minimum cost path with city 1 as the starting point, i as the ending point and all cities appearing exactly once.

Let the cost of this route be cost(i), the cost of corresponding cycle would be cost(i) + dist(i,1) where dist(i, 1) is the distance from city i to 1. Finally, we got the minimum of all [cost(i) + dist(i, 1)] values.

To calculate cost (i) of route using Dynamic Programming, we need to have some recursive relation in terms of sub-problems. Let us define a term C(S, i) be the cost of the minimum cost route visiting each city in set S exactly once, starting at 1 and ending at i.

We start with all subsets of size 2 and calculate the cost C(S, i) for all subsets where S is the subset, then we calculate cost C(S, i) for all subsets S of size 3 and so on. Note that city 1 must be present in every subset. Calculate by following method:

If size of S is 2, then S must be {1, i},

C(S, i) = dist(1, i)

Else if size of S is greater than 2.

C(S, i) = min { cost C(S-{i}, j) + dis(j, i)} where j belongs to S, j != i and j != 1.

For a set of size n, we consider n-2 subsets each of size n-1 such that all subsets don’t have nth in them. So, total no. of subproblems are:

Add a comment
Know the answer?
Add Answer to:
The Traveling Salesman problem (TSP) is famous. Given a list of cities and the distances in betwe...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ data structure problem. (Thanks) Traveling Salesman Problem Exercise Consider 5 cities of interest, namely a)...

    C++ data structure problem. (Thanks) Traveling Salesman Problem Exercise Consider 5 cities of interest, namely a) Reno, b) San Francisco, c) Salt Lake City, d) Seattle, and e) Las Vegas. Use information on the road network and derive the miles from one city to the other. Then on that basis, conduct the following:  Create a graph with each of its vertices correspond to one of these cities and its edges being weighted by the associated weights. Note that if...

  • How can I get started in this program for this DelivC?

    SpecificationStart with your Java program "prog340" which implements Deliverables A and B.This assignment is based on the definition of the Traveling Salesperson Problem (the TSP): Given a set of cities, you want to find the shortest route that visits every city and ends up back at the original starting city. For the purposes of this problem, every city will be directly reachable from every other city (think flying from city to city).Your goal is to use a non-genetic local search...

  • Please help me with this answer. Performance Comparison for Dijkstra Algorithm and Bellman-Ford Algorithm Problem Description...

    Please help me with this answer. Performance Comparison for Dijkstra Algorithm and Bellman-Ford Algorithm Problem Description The shortest path problem is one of most important problems in graph theory and computer science in general. Shortest path problem is one of typical optimization problems. Given a graph G = (V,E), the goal is to nd a minimum cost path from s → t, s,t ∈ V . This variant is called one-to-one shortest path problem. Other variants are one-to-all (compute shortest...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT