Have you used a traveling salesman algorithm to solve a problem?

EvilTeach picture EvilTeach · Nov 5, 2008 · Viewed 8.4k times · Source

I studied TSP in college in the context of NP Completeness. I have never actually had a situation where it would apply to a practical problem. A little bit of research shows that it has been used to pick the cheapest path to move a drill around, that is making holes in circuit boards. That is pretty much all I could find.

Are you using it? What other practical applications does the TSA have?

Answer

Hugh Allen picture Hugh Allen · Nov 5, 2008

I was once given the task of writing a program to fill a rectangular area fairly uniformly with a "squiggle" - a curved line which doesn't self-intersect. My first attempt was to generate random points within the rectangle and try to find a tour of them (not necessarily the absolute shortest). Unfortunately this approach just didn't work very well and I abandoned it.

I did solve the problem in the end though:

alt text

My successful method was not related to the TSP but for the curious I will summarize it:

Start with a single line segment. Now loop: if a line is "too long", divide it in two. Move each point a bit at random, but make points repel each other. End the loop when little progress can be made. There are details but hopefully you get the idea.

Of course this produces an angular path (which would have been acceptable) but it is easy to turn the corners into smooth arcs.

And yes I did keep the code.