-
-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default value of strict in pgr_dijkstraTRSP #813
Comments
I think strict should default to true. The reason being is that if I provide a restriction table, then I expect it to be honored and I don't want the code to silently ignore the the restrictions in some cases. It is one thing if I'm interactively running a query and a notice is presented to me that I can read, but more users will integrate pgRouting into things like web services where there is only code and no human eyes other than the web user seeing results. If the route fails in that case then the web user needs to complain to the developer that there is a problem so the developer can then look into whether it is a data problem or an algorithm problem. I'm not sure I would include the strict option at all as I think it should always be strict, but it might be a useful debugging tool. If I don't care about restrictions, then it is easy enough to not pass in the restriction table. In the big picture, I believe the value of TRSP is to provide real world routes that people can drive. Think Google or OSRM driving directions. We need good routes that can turned into driving directions in the future. |
I agree with Steve. If there is no valid route, then there is no route ;-) However, there should be a way to run TRSP with no restrictions, but then a user knows this. What would be use cases for a |
Case Here: I quote
I understand that: if there is no other route possible, the algorithm will use the restriction |
About:
Then the user might want to use I must say that @vidhan13j07 is considering the case when the restrictions query returns an empty set.
|
btw, the name he is using is |
Can we first define, what we understand, when we say It seems you thought of restrictions with some sort of "cost penalty", so the algorithm would only consider such a turn, when there is no other "cheaper" way. This is how we would apply costs to edges, that we try to avoid. Or, we see restrictions as "not possible", such as no bicycles on highways (at least where I live) or one-way streets. In pgRouting we can just exclude them, when we select the network data (works for highways for example) or we can set costs very high (which is probably similar to the I think it would be good to support both:
Maybe we the word "restrictions" was confusing, because you think of "strictly forbidden". |
If we want to include turn costs along with the turn restrictions, another alternative approach could be to include |
I agree with @dkastl the there needs to be come clarification about restrictions vs turn costs. I view restrictions as absolute, but costs as being allowed. If the cost is say -1, then this should be considered an absolute restriction, but a cost of 100 would just add 100 to the cost of the the route taking that turn path. I still do not see a valid need for a strict option. |
@vidhan13j07 this sounds like a good approach, if we follow the way one-way restrictions are handled. So |
Re-STRICT-ions ... as the word says ;-) |
@vidhan13j07 +1 I agree with the -1 as restriction or cost (=penalty) |
Shall we somewhere (also in the documentation) define the terminology?
|
There is no need for a penalty, the algorithm he intends to implement does not use any kind of cost, its simply forbidden. He is clear mentioning what may be called a corner case:
I took the liberty of putting the word all in bold. which means that he intends to find a path that does not use a (manouver) restriction, and preferable to be the shortest. In the case that there is no such path he is suggesting the In case of being "strict", no path is returned in the corner case. |
I give a +1 to make |
@sankepallyrohithreddy, if it's like you explain and penalty costs care not used but only restrictions, then my (and probably Steve's) position is, that the result should be empty. It makes no sense to me to apply restrictions and then return a result, that actually violates a restriction. Second argument: I think it is going to become hard to define, possible to become a source for bugs. |
To me it makes sense: I am an ambulance I need to reach my destination or my patient dies.
Third case: no need to load twice the graph, gets a route that has the minimal amount of restrictions. |
Answering to this:
You can review all of our gitter conversation, there is no mention about "turn cost" so I think you are the ones to explain to him, and to me, what you mean with "turn cost".
and its used like this:
|
Please tell me more about the "turn cost" there is no such thing in osm restrictions |
About:
he is not doing a "Via" version, he is doing a one to one version. And using dijkstra underneath, which by does not do a U turn (go and comeback using the same edge) |
I really appreciate all of your comments.
From @sankepallyrohithreddy comment
without forgetting @sankepallyrohithreddy suggestion
I am making Current pgtap unit tests:
The both files tests pass on travis |
@cvvergara I will try to concentrate on the case "restricted", so no cost penalty just the case maneuver is allowed or not allowed, "yes" or "no". For the
That said, what does it mean to us in terms of "work":
And all we gain is saving an additional query for a corner case, that in normal scenarios will not happen. You see, I'm not convinced ;-) Furthermore, with the introduction of a In my opinion the advantage of saving a query in a very rare case isn't really worth it. |
The case of an ambulance or other special vehicle is a vehicle class problem and should be handled by the user's input. This problem refers to the fact that different classes of vehicles have different restrictions that apply. The user needs to supply the appropriate set of restrictions for that vehicle class that it is routing. Lets say you have a no right turn restriction and you allow the ambulance to violate it, but the reason for the restriction is that there are concrete barriers preventing the turn. There are restrictions for logical reasons, legal reasons, physical reasons and restrictions by vehicle class like emergency, regular, over-sized, delivery, etc. Some data sets differentiate these and some do not. We should not make assumptions about them in the code. It is the users responsibility to select which apply for any given query. While OSM may not include "turn costs", it is convenient to build this into the code so that you can say there is additional cost for following a path thru a restriction. This can be used to penalize access to toll roads, to adding costs for making left hand turns in a right side drive county, or penalizing sharp turns for tractor tailor rigs, etc. It adds no more complexity to the code than adding strict=false except that you are only allowed to take a "restricted" path that has a cost greater then 0. A -1 cost would still be forbidden. |
His question is not about "how the restrictions table looks like" or what "should or should not have the restrictions table" for other topics not being "strict" parameter default value, please open a new issue. I will close this issue, because from all our comments he took a decision about the default value he will be using. |
I guess I'm late for this discussion. I would go with default strict = true I agree with @cvvergara that in some cases like ambulance driving you are allowed to violate restrictions but still want to violate the least to prevent accidents. |
Reopened. This is a discussion and it is not clear what if any decisions have been made regarding these topics. @vidhan13j07 should summarize and close when he is comfortable that he has the answers he needs and summarize that. |
@robe2 strict=true is a bad way to deal with this case. read discussion about vehicle classes. You would not want to route a vehicle thru a restriction that had a physical barrier like concrete Jersey barriers and if you routed it that way and the drive followed that path, then the recovery route might be much longer than the alternative. |
@woodbri |
The case of an ambulance or other special vehicle is a vehicle class problem and should be handled by the user's input. This problem refers to the fact that different classes of vehicles have different restrictions that apply. The user needs to supply the appropriate set of restrictions for that vehicle class that it is routing. Lets say you have a no right turn restriction and you allow the ambulance to violate it, but the reason for the restriction is that there are concrete barriers preventing the turn. There are restrictions for logical reasons, legal reasons, physical reasons and restrictions by vehicle class like emergency, regular, over-sized, delivery, etc. Some data sets differentiate these and some do not. We should not make assumptions about them in the code. It is the users responsibility to select which apply for any given query. |
Copied from above. |
Marking as invalid as the flag is not used on the new |
Work has been done for TRSP on develop branch for version 3.4 (due to be released on September/October 2022: For further similar problems with TRSP functions please open a new issue with the specific function name. |
I am adding a
strict
parameter topgr_dijkstraTRSP
.Suppose that all possible routes from the given source and destination passes through a restriction.
false
: when all paths found use a restriction, put the shortest onetrue
: EMPTY SET when all paths found use a restrictionWhat is better as default value
true
orfalse
forstrict
?The text was updated successfully, but these errors were encountered: