Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As a previous answer mentioned, this problem is the NP-complete Traveling Salesperson Problem.</p> <p>There is a better method than the one you use. The state-of-the-art TSP solver is due to <a href="http://www.tsp.gatech.edu/concorde.html" rel="nofollow noreferrer">Georgia Tech's Concorde solver</a>. If you can't simply use their freely available program in your own or use their API, I can describe the basic techniques they use.</p> <p>To solve the TSP, they start with a greedy heuristic called the Lin-Kernighan heuristic to generate an upper bound. Then they use branch-and-cut on a mixed integer programming formulation of the TSP. This means they write a series of linear and integer constraints which, when solved, gives you the optimal path of the TSP. Their inner loop calls a linear programming solver such as Qsopt or Cplex to get a lower bound.</p> <p>As I mentioned, this is the state-of-the-art so if you're looking for a better way to solve the TSP than what you're doing, here is the best. They can handle over 10,000 cities in a few seconds, especially on the symmmetric, planar TSP (which I suspect is the variant you're working on).</p> <p>If the number of waypoints you need to eventually handle is small, say on the order of 10 to 15, then you may be able to do a branch-and-bound search using the <A href="http://en.wikipedia.org/wiki/Minimum_spanning_tree" rel="nofollow noreferrer">minimum spanning tree heuristic</a>. This is a textbook exercise in many introductory AI courses. More waypoints than that you will probably outlive the actual running time of the algorithm, and you will have to use Concorde instead.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload