Traveling Salesman problem in Streets and Trips


The Virtual Earth / Live Maps blog has recently created a post about route optimization and why S&T has it yet the online sites do not.
 
I saw this post on SlashGeo yesterday asking about solving the traveling salesman problem in online maps, and more specifically why no one has done it. I think there are a few reasons starting with the fact that route optimization isn’t something most of us need to do very often. but probably more importantly, when done correctly route optimization is pretty cpu intensive and most web users of online mapping software wouldn’t want to wait for the results. For in-city trips, not so bad, but spread your stops over a larger area and it can be costly. You can cut corners by eliminating a number of possibilities with fast crow-flies estimates, but that’s cheating and will yield crappy results. Any online mapping site could provide this functionality, but i’m not sure anyone would be happy with the results or perf.

As for solving via a Web API, this is also possible but would take a lot of real-time. if your optimization code sits close to the routing engine you can solve much more quickly, but for the number of remote calls needed latency kills. Most applications that call for this type of functionality (logistics, delivery, etc…) have their own optimization code that needs to consider more than just time and distance (its cheaper to run a truck with a full take of gas downhill for instance)

But for the rest of us, there’s Streets and Trips :-) S&T solves the traveling salesman problem quite well and is a popular and easy to use feature especially among business travelers. To use it, just add your stops to a route, hit the ‘optimize stops’ button on the directions panel, then wait while S&T crunches away. When its done your stops are presented in optimal order. You can even specify stop restrictions such as the time of day you need to be at a particular location! Below are screen shots of the process.

DEVELOPER NOTE: MapPoint 200X has the same functionality built in and is exposed via our API making MapPoint a popular choice in logistics and fleet management applications. Check it out if you need to add this type of calculation to your apps.

Here’s a look at how to solve the traveling salesman problem with Streets and Trips or MapPoint 200X:

1. Add Your stops. Here I am traveling around Portland. The trip starts at my hotel and ends at the airport. In between I have 6 stops to make.

image

2. Optionally Set Restrictions on stops. I want to leave my Hotel at 9am and be at 148th Ave at noon for lunch. the other stops are flexible. Oh, and I need to finish at the airport.

image

3. Optionally set other global options. The optimizer can consider many factors that you can control such as rest stops and your personal tolerance for being late.

image

4. Hit the optimize Stops Button. For this trip consisting of 8 stops in the same city, it took about 8 seconds on my modest laptop.

image

image

Here are the re-ordered stops:
image

5. Calculate directions. Now that your stops are optimized, you probably want Streets and Trips to give you directions between all of them. Hit the ‘Get Directions’ button.

image

If you have a GPS device connected to your laptop, S&T will also give you voice assisted navigation instructions as you drive.

This entry was posted in How To. Bookmark the permalink.

7 Responses to Traveling Salesman problem in Streets and Trips

  1. Smokey says:

    Most times when I optimize 20 to 30 stops it will bring me in a circle back close to the first stop.  I’d prefer if it went straight out.  Sometimes it will bypass a stop within a couple of blocks and have you coming back to it later in the day.

  2. crazyst says:

    I use S&T for trip planning and in competition where routing efficiency is key. I don’t use it as a GPS and I have purchase every version of S&T since 2004. It’s frustrating though to keep hoping for simple planning tweaks that seem to get ignored. Since this thread is on the salesman routing issue (which is very close to my use) I thought I would post some comments/feedback here. This is just a small list of features I would like to see added to make planning/routing easier.1. The program estimates fuel stops and even marks them yet there is no way to let the program know when you’re getting fuel so after the first suggested fuel stop it’s useless. Allow a check box on the scheduled stop dialog to say that you are fueling up at that stop and let the fuel estimator start over from that point.2. Optimize stops is great for the most part but as you stated not many people use it. However S&T still insists on rearranging stops when you’re entering them into your route without doing anything. Then you spend a lot of time rearranging the stops with the arrow keys which is a major pain. So here are two suggestions, one’s easy, one’s hard. One, allow the user to turn off the feature that has S&T auto arrange your stops as you put them in. The second would be to also allow you to click and drag the stops in the route planner window instead of having to click the arrow keys all the time to move the stops. Can you move them using the arrow keys on the keyboard? Even that would be quicker. If I want to optimize the stops I’ll do it when I click "Optimize Stops" so have a feature that allows me to just do it myself.Thanks,Curt

  3. T8tube.com says:

    so good

  4. George says:

    It would be really nice if you could select multiple push-pins and delete them. It is extremely annoying having to delete them one at a time.

Comments are closed.