Closed zimmicz closed 8 years ago
@zimmicz I wonder if you can install 2.1, and do a build installation. from https://github.com/pgRouting/pgrouting click on the download button and follow this instructions: http://docs.pgrouting.org/2.1/doc/src/installation/build.html#for-linux
Hoped I could get away without building :) I'll try asap. Is it possible to have two different versions of pgrouting, or do i have to remove 2.0? Thanks.
Update: built pgrouting 2.1 and updated the extension with ALTER EXTENSION pgrouting UPDATE TO "2.1.0";
. The result of tsp is still the same.
You should be able to do:
create extension pgrouting version 2.0.0;
--or
create extension pgrouting version 2.1.0;
Two comments on your pgr_trsp query:
@zimmicz I think for the moment we don't have a package for ubuntu, so it has to be built
@woodbri
@cvvergara see my update above, I upgraded to 2.1.0, still no luck. Is there something wrong with the query itself?
@zimmicz Sorry miss read the problem as trsp not tsp.
So for tsp, you give it a list of locations like you are doing. What it returns, is an optimized list of vertices (based on Euclidean distances) of the solution. It does not return routes only a list of node ids. If you want the routes for the solution, you will need to iterate through pairs of the ordered vertices and compute the routes.
@woodbri Oh that's so obvious! I'm such a dumbhead :-/ Given any number of nodes, tsp gives me the order of their visit, but it doesn't give edges to go through. So the next step should probably be to send the matrix into the dijkstra or another algorithm, to get the result, right?
@woodbri Yeah, trsp and tsp are quite annoying for reading... I always also get messed up. I will suggest name change for future versions. If someone likes short naming they can just wrap it in a function.
@zimmicz So you got an order say: 140657, 140777, 248013, 20559 was your result
pgr_dijkstra( <edges_sql>, 140657, 140777);
pgr_dijkstra( <edges_sql>, 140777, 248013);
pgr_dijkstra( <edges_sql>, 248013, 20559);
pgr_dijstraViaVertices( <edges_sql> , ARRAY[140657, 140777, 248013, 20559])
Thank you, I'm closing this.
You can probably do something like this:
select * from pgr_dijkstra( <edges_sql>::text, (SELECT array_agg(id) as ids
FROM pgr_tsp('{{0,1,2,3},{1,0,4,5},{2,4,0,6},{3,5,6,0}}'::float8[],1,2)));
where you put in real data for your vertices.
Hi, I'm a pgRouting newbie with postgres 9.4, postgis 2.2 and pgrouting 2.0 installed. I used osm2pgrouting to import data for the Czech Republic and used the default mapconfig xml.
Everything went fine, I got
osm_ways
andosm_ways_vertices_pgr
tables. I tried the dijkstra algorithm first with the following sql statement:Worked fine and the result viewed in QGIS was correct. However, when I run he traveling salesman problem algorithm, I got really weird result.
See the screenshot below, those squares represent edges. Note that all the points lie near to each other (thus the only one being displayed), yet edges from different locations come as a result. When I checked one of the displaced edges, neither
target
norsource
were of the same value as my initialWHERE
condition.Am I missing something?