Skip to content

Instantly share code, notes, and snippets.

View dapotts's full-sized avatar

Dave Potts dapotts

  • Golem Software
  • Everywhere
View GitHub Profile
@dapotts
dapotts / atspmat.sql
Created August 1, 2013 17:02
Keywords Postgis PGRoute Traveliing Salesman problem Asymmetric traveling salesman Error checking Wrapper functions for the pgroute pgr_tsp function Add support for using a random vertext range eg 1,2,45,30 instead off having to use the range 1-5 A solution to the Asymmetric traveling salesman problem An error checking function for checking for …
--
-- A solution to the Asymmetric traveling salesman problem
-- using pgr_tsp.
--
-- Solution is to rewrite the distance matrix in to inverse copy and
-- link the two copies of a town together by a zero link route.
--
-- See http://en.wikipedia.org/wiki/Traveling_salesman_problem#Solving_by_conversion_to_symmetric_TSP
-- for the details.
--
postgres sql