# Does there exist a travelling salesmen generating algorithm?

I'm curious if somebody has already figured this out. Is there an efficient algorithm that will generate (in $\mathbb{R}^2$) a sequence of points in such a way that the solution to the travelling salesmen problem is known a priori, and such that we have a uniform distribution on the set of points? For example, I can think of an algorithm that will generate such a sequence by plotting a polygon, and the minimum distance would be the points going around the outside of the polygon, but the distribution on point-sets from this algorithm is highly biased.

So I would hope for an efficient algorithm that generates a set of points in $[0,1]^2$ (and its corresponding TSP solution), with equal probability to any set of points, i.e., each point has iid uniform distribution on $[0,1]^2$. You could interpret "efficient" as "polynomial time".

PS: I strongly suspect that no algorithm could exist because if so, I imagine the problem would be solvable, so in this case, is there a database somewhere with a large number of solutions for randomly generated sets of points?

• But TSP is solvable, so yes, there is an algorithm: just generate sets of points, brute-force solves TSP on them and outputs the set and solution. I suspect you need to insert "efficient" or "in polynomial time" in a few places in your question. And, as you say, it looks like the solution for convex point sets is trivial so those could be output efficiently: why isn't that an answer? Are you looking for an algorithm that outputs all possible point sets and their solutions? Also note that the problem on random inputs might look very different: it's possible for a problem to be easy... – David Richerby Aug 3 '18 at 13:36
• with equal probability to any set of points in $\mathbb{R}^2$ This isn't defined. – Reinstate Monica Aug 3 '18 at 13:37
• Also there are ways to generate (instance, solution) pairs efficiently even if it is likely hard to compute the solution from the instance. For example, if the problem is factorization, you can choose random factors and multiply them whereas there is no known efficient way to obtain the factors from the product. So I believe the intuition in your PS is flawed. – Reinstate Monica Aug 3 '18 at 13:38
• So what you are asking for is a test generator for the TSP problem, an algorithm that produces problems with known solutions, so you can test whether a TSP solver does indeed find the shortest tour. I could imagine that such an algorithm can only efficiently find problems that are easy to solve. – gnasher729 Aug 3 '18 at 23:59
• Regarding your PS, sometimes we can "plant" a solution in such a way that someone who doesn't know the planted solution can't find it. This is the situation for the planted clique problem, in which we construct an instance with known maximum clique, but for appropriate parameters, this clique will be hard to find. – Yuval Filmus Aug 26 '18 at 16:08

For posterity and because I never received any answers in the end: my best guess is $\forall x_0 \in [0,1]^2$ was to pick any point $x_1 \in [0,1]^2$, then generate a second point $x_2$ such that the interior angle between the line between $x_0$ and $x_1$ is greater than 90$^{\circ}$ and less than 180$^{\circ}$. Now I can see two paths forward, one is to make a sort of quasi convex structure (obviously not every solution) by alternating whether the angles are interior or exterior and staying within the bounds. The solution is then $x_{0,...,n}$ for the minimum path.
The second possibility would be to put restrictions on the distance from the last point to the next point, (say halving each time) and again requiring the angle to be constrained, but perhaps this time we can loosen the constraint to greater than 90$^{\circ}$ and less than 270$^{\circ}$ and just require that we cannot cross a line we've already made. I can't guarantee this algorithm will always generate the correct solution, however I can guarantee that it won't generate all points in $[0,1]^2$, so the question remains unfortunately unanswered.