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
Ah, sure! Can we remove the tests as we would get an exception then? (I know in general tests cannot hurt but they mean execution time and migration time)
The tests should still be fine even when adding the check. I think the test that compares random requests between the algorithms is useful either with or without issue #1960 (and worth the execution time). The one with the fixed values, well I would also keep it (to make sure we are not in a situation where all algos went wrong)
Thinking about this again I really think the issue we are having here is that the algorithms do not consider the traversal mode when calculating the weights. That is why we now have to be careful not to pass a weighting that calculates turn costs into a graph algorithm that runs node-based. We noticed this here for LM #1960, but its also the same for isochrones and spt: #1967.
There is no prevOrNextEdgeId parameter in Weighting anymore. The only thing we can do with a Weighting is to calculate edge and turn weights separately. We have a utility method GHUtility#calcWeightWithTurnWeight that calculates the sum of edge and turn weights and thus has a prevOrNextEdgeId parameter, but I see no use case that calls this method in a meaningful way when running node-based. Even before #1863 where we made this change we were passing NO_EDGE sometimes to indicate we do not want turn costs. Similarly I think all we have to do here is exclude the turn weight calculation if !traversalMode.isEdgeBased(). The alternative would be to make sure that either the traversal mode is edge-based or the weighting does not support turn costs whenever we create a routing algorithm object. But what could we do this waỳ that we cannot do when we explicitly exclude the turn weights in the algorithms?
Hm and what is more ugly: We cannot use a weighting with turn costs with algorithms running node based or the turn costs are ignored when running an algorithm node-based? (I'm not sure tbh)
Hm, now I think its better to be strict and not allow weightings with turn costs for node-based rather than ignoring the turn costs 'silently' -> #1974
Activity
easbar commentedon Mar 24, 2020
I'm not sure about fixing #1960 in a different way, I think I would rather add
to Weighting and then use this check in Landmarkstorage to make sure the weighting is not using turn costs (right now this error will go unnoticed)
karussell commentedon Mar 24, 2020
Ah, sure! Can we remove the tests as we would get an exception then? (I know in general tests cannot hurt but they mean execution time and migration time)
easbar commentedon Mar 24, 2020
The tests should still be fine even when adding the check. I think the test that compares random requests between the algorithms is useful either with or without issue #1960 (and worth the execution time). The one with the fixed values, well I would also keep it (to make sure we are not in a situation where all algos went wrong)
easbar commentedon Mar 24, 2020
And I think in general tests can hurt :) (because of execution time and even more so migration time)
karussell commentedon Mar 24, 2020
Ok
Isn't this covered from the many other tests?
easbar commentedon Mar 24, 2020
No, because they usually focus on the algorithms and do not use the
GraphHopperclass.easbar commentedon Mar 24, 2020
Ah sorry you meant the one with the fixed values? Yes you are right that one isn't so special and we can probably remove it.
easbar commentedon Mar 28, 2020
Thinking about this again I really think the issue we are having here is that the algorithms do not consider the traversal mode when calculating the weights. That is why we now have to be careful not to pass a weighting that calculates turn costs into a graph algorithm that runs node-based. We noticed this here for LM #1960, but its also the same for isochrones and spt: #1967.
There is no
prevOrNextEdgeIdparameter inWeightinganymore. The only thing we can do with aWeightingis to calculate edge and turn weights separately. We have a utility methodGHUtility#calcWeightWithTurnWeightthat calculates the sum of edge and turn weights and thus has aprevOrNextEdgeIdparameter, but I see no use case that calls this method in a meaningful way when running node-based. Even before #1863 where we made this change we were passing NO_EDGE sometimes to indicate we do not want turn costs. Similarly I think all we have to do here is exclude the turn weight calculation if!traversalMode.isEdgeBased(). The alternative would be to make sure that either the traversal mode is edge-based or the weighting does not support turn costs whenever we create a routing algorithm object. But what could we do this waỳ that we cannot do when we explicitly exclude the turn weights in the algorithms?Hm and what is more ugly: We cannot use a weighting with turn costs with algorithms running node based or the turn costs are ignored when running an algorithm node-based? (I'm not sure tbh)
easbar commentedon Mar 29, 2020
Hm, now I think its better to be strict and not allow weightings with turn costs for node-based rather than ignoring the turn costs 'silently' -> #1974