简体   繁体   中英

pgr_trsp - applying restrictions with no consideration to their cost

I'm trying to solve a common problem which is railway routing, thus enforcing several turn restrictions, eg: "Cannot go from EDGE A to EDGE B via NODE c"

Trains cannot do sharp turns and other stuff, so what I have now is a list of source and target edges that I dont want to present in my shortest path result. The problem is that the way pgr_trsp works right now, we have weighted restrictions, which is not ideal because those turns can NEVER happen, not based on their weights but by the simple fact that it is impossible for a train to maneuver like that, under normal conditions and speed.

My question is, is there any possibility of ignoring the weight and just to check if the turn is allowed or not ? Am I missing something on the documentation or any attribute that specifies that ?

pgr_trsp(
    sql text,
    source_eid integer,
    source_pos double precision,
    target_eid integer,
    target_pos double precision,
    directed boolean,
    has_reverse_cost boolean,
    turn_restrict_sql text DEFAULT NULL::text)

Maybe setting the weight to some specific/magical value perhaps ?

The expected result is if there are no valid paths that intersect the valid maneuvers, then no output should be expected.

I'm not sure if that is implemented. Try setting the cost to -1 and see if that works.

Otherwise all you can do is set the cost to a really high number which will force it to find a lower cost alternative route. Then you will need to check the results and if the high cost turn was included then you need to realize that the requested route is not possible without taking an impossible turn, so treat that as no route was found.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM