[pgrouting-users] pgr_tsp() not working -- what I am missing?
René Fournier
m5 at renefournier.com
Thu Jul 17 22:03:44 PDT 2014
So, after finally getting pgRouting installed (thanks guys for the tips), I’ve encountered my first problem. I’m trying to solve the travelling salesman problem with a number of locations, e.g.:
alba3=# SELECT id::integer, location_lng::float AS x, location_lat::float AS y FROM addresses where territory_id = 76 ORDER BY id;
id | x | y
--------+-------------+-----------
169 | -114.130995 | 51.039266
1946 | -114.122258 | 51.026517
2693 | -114.135513 | 51.031368
3080 | -114.12952 | 51.037816
3601 | -114.138326 | 51.037731
3819 | -114.135513 | 51.031326
3831 | -114.128151 | 51.033531
4001 | -114.139744 | 51.031526
5918 | -114.134081 | 51.031903
64222 | -114.122329 | 51.030329
74248 | -114.13445 | 51.025564
99867 | -114.145568 | 51.033872
104685 | -114.134065 | 51.036855
131470 | -114.138351 | 51.036562
131504 | -114.125255 | 51.031422
231023 | -114.12083 | 51.038339
398043 | -114.125218 | 51.031422
414612 | -114.122333 | 51.033205
535239 | -114.145643 | 51.034149
(19 rows)
And then I use the function as documented:
alba3=# SELECT seq, id1, id2, round(cost::numeric, 2) AS cost
alba3-# FROM pgr_tsp
alba3-# ('SELECT id::integer, location_lng::float AS x, location_lat::float AS y FROM addresses where territory_id = 76 ORDER BY id', 1);
seq | id1 | id2 | cost
-----+-----+-----+------
(0 rows)
alba3=#
(And nothing.) Any ideas why?
Best regards,
René Fournier
More information about the Pgrouting-users
mailing list