You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example CustomWeighting calculates weight = seconds/priority + distanceCost. If seconds and priority are both zero this yields NaN. This can for example happen if distance is zero. For GH v1.0 this yields an error during CH preparation, see this forum discussion: https://discuss.graphhopper.com/t/custom-weighting-stable-version/6488/3, but the error was fixed in #2132 (GH versions 2.0+ do not throw an error). However, the weight can still be NaN. We probably should return zero weight in case distance is zero, or maybe distance=0/priority=0 should rather be infinity?
I'm not sure if I actually saw an error with the NaN value, but I probably just noticed this when reading the code. Anyway, the commit you linked to must have fixed it, because the distance==priority==0 case is now handled explicitly.
Activity
karussell commentedon Sep 14, 2022
I think we faced this issue recently: ce461d2 - did this fix what you mentioned here?
easbar commentedon Sep 22, 2022
I'm not sure if I actually saw an error with the
NaNvalue, but I probably just noticed this when reading the code. Anyway, the commit you linked to must have fixed it, because the distance==priority==0 case is now handled explicitly.