pgRouting / pgrouting

Repository contains pgRouting library. Development branch is "develop", stable branch is "master"
https://pgrouting.org
GNU General Public License v2.0
1.17k stars 368 forks source link

pgr_astar returns one null route II #297

Closed noenest closed 8 years ago

noenest commented 9 years ago

Dear developers,

We have installed pgRouting to perform searches on the European cartography.

After successfully installing the software and the cartography (version details below), we perform a simple query using the A* algorithm to find the shortest path between two nodes in different cities within the same country. Unfortunately, it not working. The query follows:

SELECT seq, id1 AS node, id2 AS edge, cost FROM pgr_astar( 'SELECT id, source, target, cost, x1, y1, x2, y2, reverse_cost FROM eu_2po_4pgr WHERE ST_dwithin(geom_way::geography, (SELECT geography(ST_makeLine(geom_way)) FROM vista_vertice_table WHERE source IN (8324560, 14246280)), 500)', 8324560, 14246280, false, false);

The result is always:

psql:pruebas/prueba31-astar.sql:1: ERROR: Error computing path: (null)

The same problem appears with bidirectional A*, but not with Dijkstra or bidirectional Dijkstra.

We are using Ubuntu 14, with PostgreSQL 9.3.6, postgis 2.1.2, and pgrouting 2.0.0. Our system has 32Gb of RAM, and the configuration file for PostgreSQL has been created using pgtune.

It is very important for our research to solve this issue. Any help will be greatly appreciated.

Thank you very much!


The node numbers are very large, this can be a problem in some cases if the they are sparsely assigned. For example is there a large difference between (max(nodeid) - min(nodeid)) and count(nodeid). You might try renumbering you nodes.

ERROR: Error computing path: (null)

Is not a real helpful message. The null means that something bad happened and we did not have a chance to assign an error message to it. Typically this is an out of memory request.

Also can you try pgr_trsp() and let us know if that works.

It would be helpful if you can make a smaller test case that reproduces this problem then we can debug that. How many edges in:

select count(*) from eu_2po_4pgr where st_dwithin(geom_way::geography, (select geography(st_makeLine(geom_way)) from vista_vertice_table where source in (8324560, 14246280)), 500);

You could dump those to shapefile then someone could use that to make a similar test case.


I have some questions.

As to the node numbers, I got the following results for multiple queries:

difference between (max(nodeid) - min(nodeid)) and count(nodeid) when the nodes are in very distant cities within the same country:

(25478853 - 168719) - 4526 = 25305608

difference between (max(nodeid) - min(nodeid)) and count(nodeid) when the nodes are in nearby cities within the same country:

(23459170 - 2775613) - 607 = 20682950

difference between (max(nodeid) - min(nodeid)) and count(nodeid) when the nodes are in the same city:

(24464701 - 2775613) - 1114 = 21687974

In the first two cases mentioned error occurs. In the latter case the query returns the path .

I dont know how interpret this result or how try renumbering nodes and that achievement with this.

On the other hand, I tried pgr_trsp() and works, but the result for the cost is always zero. Why this happens? It has also happened to me with pgr_bdDijkstra.

And finally, why the A * algorithm has these problems and Dijsktra algorithm runs without modifying the base query?

Thanks!!

dkastl commented 9 years ago

I think this is duplicate to #296

woodbri commented 9 years ago

It is a dup but the other one was closed when this was opened, so we should keep this one open has it has more content in it. Not sure why the second one was opened, but we need to keep one opened, so reopening this one.

dkastl commented 9 years ago

I see. I also saw the other one open. That's why I closed this one, because the other one I had formatted a few queries already.

cvvergara commented 8 years ago

made a complete rewrite of aStar on version 2.3 if this problem persists, please open a new issue