pgr_astar and impossible edges (e.g., locked doors)

孤者浪人 提交于 2019-12-11 17:45:39

问题


I'm using postgresql / PostGIS with pgrouting and I need to compute the shortest path. In a previous version of pgrouting, I was using shortest_path_astar. In my routing graph I had impossible segments, such as locked doors. I used:

SELECT id FROM shortest_path_astar('SELECT edge_id AS id, vertex_id1 AS source, vertex_id2 AS target, ' || '(CASE WHEN door = ''S'' THEN -1.0  ELSE  (length)  )  END)::float8 AS cost, ' || '(CASE WHEN door_rev = ''S'' THEN -1.0  ELSE  (length)  )  END )::float8 AS reverse_cost, ' || 'x1, y1, x2, y2 FROM edges', origin_node, destination_node, TRUE, TRUE)

Basically: when door is closed (door = ''S''), I fixed the cost to -1. It worked fine till the new version of this function, pgr_astar. With pgr_astar instead of shortest_path_astar, this query crashes the server.

How can I change my function to avoid the crash?


回答1:


Can you post a simple test case that reproduces this crash in the issue tracker: https://github.com/pgRouting/pgrouting/issues

cost: -1 should work should work.




回答2:


I finally used pgr_bdAstar, bi-directional A* Shortest Path.



来源:https://stackoverflow.com/questions/20271054/pgr-astar-and-impossible-edges-e-g-locked-doors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!