Archive for the ‘Programming’ Category

OptiMap version 4 is here

Wednesday, January 25th, 2012

New user interface

Hold down shift while pressing reload to make sure the page fully reloads if OptiMap appears broken.

The first thing you’ll notice is a complete makeover of the user interface. The functionality has grown considerably since I first posted OptiMap in 2007, and the controls were scattered randomly around. Now, they are organized into neat little drawers on the left, in the order you are likely to be using them. (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.)

The Commodities Gadget

Saturday, November 28th, 2009

And here is the Google Gadgets version of the Commodities Widget. It supports exactly the same chains of commodities as the mac version:

  • Energy: Crude oil, natural gas, heating oil and gasoline
  • Softs: Sugar, coffee, cocoa and cotton
  • Grains: Corn, soybeans and wheat
  • Metals: Gold, silver and copper
  • Currencies: US dollar index, Euro, British Pound, Swiss Franc, Yen and Canadian dollars.
  • Stock indices: Dow Jones Industrial futures, S&P 500 futures and NASDAQ.

Use the ‘+Google’ button under the embedded gadget above to add it to your iGoogle page. From your iGoogle page, you can click the down triangle in the upper right corner of the gadget and then ‘edit settings’ to select what to chart. You can also click the chart to go to the corresponding page at with a bigger chart, more options and info.

The Commodities Widget

Friday, November 27th, 2009

Commodities widget

I know it’s been a while, but the sequel to the broken Oil Price Widget is now here. The new widget not only shows the oil price, it shows a set of other futures, currencies and indices as well. I named it the Commodities Widget, even though some of the things it shows are not strictly commodities.

The new data source is They are probably the web’s best free source for futures contracts. Clicking on any chart in the widget will bring you to the corresponding page with more details and longer-term charts.

Download: Commodities Widget.

Instructions: Mac OS X 10.4 Tiger or higher is required. If you’re using Safari, click the download link. When the widget download is complete, Show Dashboard, click the Plus sign to display the Widget Bar and click the widget’s icon in the Widget Bar to open it. If you’re using a browser other than Safari, click the download link. When the widget download is complete, unarchive it and place it in /Library/Widgets/ in your home folder. Show Dashboard, click the Plus sign to display the Widget Bar and click the widget’s icon in the Widget Bar to open it.

A Shiny New Engine for OptiMap

Saturday, February 28th, 2009

OptiMap, the free TSP solver for Google Maps, used to guarantee the optimal solution for up to 9 locations only. That number has now been increased to 15. If you had more than that number of locations, you would get a solution close to the optimal (often the optimal).

The new OptiMap uses the dynamic programming solution to the TSP for problems of size 10 – 15. I tested various values for the cutoff in different browsers, and I could have set it differently. The main problem with the dynamic programming solution is its memory footprint. It uses O(n * 2^n) memory, which gets problematic around n = 15 in JavaScript (n being the number of locations, of course). This is especially true on smaller devices like smartphones. It would probably work well with n = 18 on most desktop computers and browsers, but I haven’t gotten around to making a dedicated smartphone version yet.

There is also a noticable difference between different browsers in JavaScript execution speed. Safari 4 is the fastest browser I tried so far. I haven’t tested Google Chrome yet, but I suspect it is also in the super-fast category. Once Opera comes with its Carakan JavaScript engine, I will run a speed test on OptiMap and publish the results here. Maybe I should set n automatically based on the user’s browser?