4

The most common heuristics to solve the TSP problem (in particular the Kernighan–Lin heuristic) require to work on a randomly generated tour and to improve the solution starting from that. However, the only way I came up with to do that is to generate a random permutation of the vertices and to check if it is a solution or not.

For large instances of the problem (for example 1000 vertices) this process can take a while. Is there another smart way to generate a random tour for TSP problem faster?? Note that I'm looking for a tour, no matter the cost, and not an optimal solution.

Thanks in advance

skaffman
  • 398,947
  • 96
  • 818
  • 769
skd
  • 1,865
  • 1
  • 21
  • 29
  • _generate a random permutation of the vertices and to check if it is a solution or not._ Why do you need to check if it a solution? Unless the graph is incomplete a random permutation is always a Hamiltonian cycle (if you consider the first and last vertex in the permutation to be connected). – Thorkil Holm-Jacobsen Dec 23 '14 at 10:49

3 Answers3

2

If you're just looking for any tour, you can use Breadth or Depth First Search to generate a path while marking the nodes visited.

1

You could just create an array which contains ths problem's cities and then randomly shuffle that array (there are methods that could do this). The resulting array is in fact a random permutation.

0

You want to use a space-filling-curve.

Micromega
  • 12,486
  • 7
  • 35
  • 72