Replies: 2 comments 1 reply
-
Negative costs are not valid in Dijkstra's method (or A*). To make something like this work, added costs/penalties would need to be applied to all edges that are not favored, with the favored edges having "normal, positive" costs. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Thanks for your advices. I'll try to add some const e.g. 100 to each edge in EdgeCost, and then will be safe to substract something in TransitionCost. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi @kevinkreiser and others.
To prefer pedestrian crosswalks in pedestrian routes with type:Blind, I had to penalize roads intersections which became less preferred than nearby crosswalks (discussion #4636).
It generally works as expected, but a drawback is that for routes without crosswalks on map, the roads intersections also are penalized, leading to non-optimal routes.
Would it be possible to revert this problem, by giving possibility of setting negative value of penalty for preferred features (crosswalks in my case)?
It would not impact routes without crosswalks by penalizing roads intersections, and would also prefer variants with crosswalks if available.
Also it would give a possibility of setting normal crosswalk penalty to e.g. -20, and crosswalks with traffic lights (more preferred) to e.g. -30.
I checked that it seems to work fine in PedestrianCost::TransitionCost, but there is a possibility that for short routes, whole cost of such route will be less than 0, leading to Valhalla stops responding (checked on big penalty negative value).
No idea what should I change (probably in cost comparing algorithms) to avoid it, and if such approach would be possible at all.
If so, it could give possibilities of adding _prefer parameters, as a opposite of _penalty parameters for end-users in many use cases, not only mine.
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions