Archive for June, 2011

The Dynamic Programming Algorithm for the Travelling Salesman Problem

Friday, June 24th, 2011

A reader asked me for some information on how the dynamic programming algorithm for the TSP works. I was surprised to find that a Google search found no good resources. Wikipedia merely acknowledges its existence: “One of the earliest applications of dynamic programming is the Held–Karp algorithm that solves the problem in time O(n22n).” (more…)

OptiMap for Google Maps v3 released

Friday, June 3rd, 2011

Manhattan with 100 destinations

After being “almost ready” for way too long, the next version of OptiMap, based on Google Maps API version 3, is now launched. While I have tested most aspects of the application, there are most likely bugs, since the update touched almost all areas of the code. There are some improvements too, however:

  • More robust address lookups (a lot of people experienced a “failed to geocode” error when entering many addresses. This was due to too many requests in a short period of time, and a queue-system has been added to avoid this from happening. The lookups may take slightly longer due to this.
  • Progress indicator for directions lookups. Because version 3 of the Google Maps API only allows 10 waypoints in a single request (down from 25 in the previous version), this part is now a bit slower, so a progress indicator is needed.
  • Tuning of the solver code based on faster browsers becoming more common. This should improve the quality of the solutions for cases with more than 15 locations.

Please help me solve any bugs that you may encounter by posting a comment on this site. Information that will be helpful when locating the bug includes:

  • Browser (with version if possible)
  • List of addresses or locations and a description of how to reproduce the bug
  • The output that you see (error message, why you think the solution is wrong etc.)