Solving the Travelling Salesman Problem in ruby (50+ locations)
This might be what you are looking for:
Warning:
this site gets flagged by firefox as attack site - but I doesn't appear to be. In fact I used it before without a problem
[Check revision history for URL]
rubyquiz seems to be down ( has been down for a bit) however you can still check out WayBack machine and archive.org to see that page:
http://web.archive.org/web/20100105132957/http://rubyquiz.com/quiz142.html
Best way to implement a map for TSP
This is well-traveled territory. :)
"Itinerary for a Traveling Salesman (#142) - by Morton Goldberg
A salesman wants to call on his customers, each of which is located in a different city. He asks you to prepare an itinerary for him that will minimize his driving miles. The itinerary must take him to each city exactly once and return him to his starting point. Can you write a Ruby program to generate such an itinerary?
This problem is famous and known to be NP-complete. So how can you be expected to solve it as a weekend Ruby Quiz project? It's unreasonable isn't it? Yes, it is, unless the conditions are relaxed somewhat."
See the complete page plus multiple solutions in the sidebar on rubyquiz
Travelling salesman with a few constraints
A traveling salesman problem can be formulated as a integer programming problem (this link gives a formulation) or a constraint programming problem, so you can use any MIP or CP solver such as CBC or Gecode to solve the TSP problem with any extra constraints you want to add. However, if you need to plot the results on Google Maps, you'll have to do it manually using the Google Maps API.
If you prefer a web-based solution then you can use NEOS server for optimization which provides access to a variety of solvers via XML-RPC API. As an additional advantage this method allows submitting problems in a high-level modeling language such as AMPL rather than dealing with low-level solver APIs directly.
Related Topics
Safe Navigation Equivalent to Rails Try for Hashes
How to Create a Symbol from a String That Has Whitespaces
Does Ruby Support Unicode and How Does It Work
Does Concurrency Happen Even When Only One Thread Is in a Thread Pool
Automatic Logging of Datamapper Queries
Rails 3: User Created Custom Forms
Error Installing Gem: Couldn't Reserve Space for Cygwin's Heap, Win32 Error 487
Simple Regex -- Replace Underscore with a Space
Split Array Up into N-Groups of M Size
Sleep Until Condition Is True in Ruby
What Is the Point of Object#Presence in Rails
Import SASS Partial Over Http Instead of Filesystem
Memory Usage Increase with Ruby 2.1 Versus Ruby 2.0 or 1.9
Run a Ruby Library from the Command-Line
Is There a Function Like String#Scan, But Returning Array of Matchdatas