Recently, I wanted to test pgRouting ver. 2.0. I created the database structure with osm2po and imported UK map from http://download.geofabrik.de/europe.html. The data was imported correctly. When I execute a sample query in order to find the shortest path with dijkstra algorithm I receive the result in ~70 sec. When I do the same with astar algorigthm I get the result in over 145 sec. Theoritically, the result of astar should be faster than dijkstra's one but it's not.
Queries I execute:
--Dijkstra
SELECT seq, id1 AS node, id2 AS edge, cost FROM pgr_dijkstra('SELECT id::integer, source::integer, target::integer, cost::double precision AS cost FROM hh_2po_4pgr'::text, 60, 80, false, false);
--Astar
SELECT seq, id1 AS node, id2 AS edge, cost FROM pgr_astar('SELECT id AS id, source::integer, target::integer, cost::double precision AS cost, x1, y1, x2, y2 FROM hh_2po_4pgr', 60, 80, false, false);
I checked the Astar implementation in pgRouting and it seems that it uses this heuristic: (|dx|+|dy|)/2.
Am I doing something wrong in my queries or there is something wrong with pgr_astar() implementation in pgRouting?
أكثر...
Queries I execute:
--Dijkstra
SELECT seq, id1 AS node, id2 AS edge, cost FROM pgr_dijkstra('SELECT id::integer, source::integer, target::integer, cost::double precision AS cost FROM hh_2po_4pgr'::text, 60, 80, false, false);
--Astar
SELECT seq, id1 AS node, id2 AS edge, cost FROM pgr_astar('SELECT id AS id, source::integer, target::integer, cost::double precision AS cost, x1, y1, x2, y2 FROM hh_2po_4pgr', 60, 80, false, false);
I checked the Astar implementation in pgRouting and it seems that it uses this heuristic: (|dx|+|dy|)/2.
Am I doing something wrong in my queries or there is something wrong with pgr_astar() implementation in pgRouting?
أكثر...