9

It seems odd to me that the TSP denies the possibility of repeated cities. The goal of this traveling salesman is to go as fast as possible and visit all of the cities, right? So what if it is faster to travel through a city you have already been to?

Raphael
  • 73,212
  • 30
  • 182
  • 400
danmcardle
  • 238
  • 1
  • 5

5 Answers5

3

It doesn't matter exactly how you define it because it's just a way of modelling a real-world problem. In TSP, you just have a set of cities and the cost of travelling between each pair of them. That doesn't exclude the possibility that, in the real world situation you're modelling, the best route between B and C might go through A. If that was the case then, yes, the route that is modeled as ABCA in TSP may very well really involve driving through A an extra time on the way from B to C but such detail is abstracted away in the TSP model.

David Richerby
  • 82,470
  • 26
  • 145
  • 239
2

I agree that the constraint looks odd, and for many practical situations, it is not relevant. As pointed out by David in his answer, if you can alter the modeling yourself, then it does not really matter. But given a non-modifiable instance, it will make a difference, because general TSP with this constraint is not approximable within any constant factor, while relaxing the single-visit constraint seems to make it approximable within factor 2 (even though it is not metric). Unless I miss something, by standard arguments, you may first build a minimum spanning tree (of cost say $c$), then visit this tree with the euler tour technique. Clearly, the total cost of your tour is then $2 c$ (twice every edge). By contradiction, if there existed a tour of cost less than $c$, then this tour could be used to infer an MST of cost less than $c$, which is a contradiction.

1

Given any tour with repetitions, you can come up with a shorter tour that doesn't repeat any city. For example, consider a tour of the form $$ \cdots \to A \to \cdots \to X \to A \to Y \to \cdots, $$ which visits $A$ twice. You can take a shortcut on your second visit to $A$, going straight from $X$ to $Y$: $$ \cdots \to A \to \cdots \to X \to Y \to \cdots. $$

It might be that the shortest way from $X$ to $Y$ goes through $A$, but that is already encapsulated in the edge $X \to Y$. You can think of a mention of $A$ not as "passing through" $A$ but rather "stopping at" $A$. You need only stop at $A$ once, though you might pass through $A$ several times.

Actual algorithms for TSP could have this step of "taking shortcuts", for example Christofides's algorithm. See for example this description or that shorter account.

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514
0

If repetitions are allowed, then you just go examine all connections X -> A -> Y, and if that is shorter than X -> Y then you replace the length of X -> Y with the length of X -> A -> Y, and solve the resulting problem with the standard algorithm. I think you have to repeat the replacement process until there are no changes, because if you find a shorter connection X -> Y this might mean that now X -> Y -> Z is shorter than X -> Y.

Keep track of which connections you changed, go through the connections in the solution, and if the solution contains X -> Y then you replace this with X -> A -> Y.

PS. I think my idea is great, but I'm not very sure at the moment that it is correct. Because X -> A -> Y instead of X -> Y is not just a shortcut, it also covers city A.

gnasher729
  • 32,238
  • 36
  • 56
0

There's no general answer to this, except "people aren't stupid." They'll apply the solution that is appropriate to their situation. Rarely are people concerned with the traveling salesperson problem itself. Eveb in the classical instance, a real world salesperson would be more concerned with the problem of maximizing their income over a given time period within a specific set of constraints. In this instance of the problem, total distance traveled is only one of a number of different factors that go into finding the optimal answer.

Alecto
  • 564
  • 4
  • 13