Skip to content

add hasTurnCosts to Weighting #1965

Closed

Description

@karussell

We need to fix #1960 in a different way to avoid issues with e.g. customized GraphHopper classes that override createWeighting.

Activity

  1. added this to the 1.0 milestone on Mar 24, 2020
  2. easbar commented on Mar 24, 2020

    @easbar
    Member

    I'm not sure about fixing #1960 in a different way, I think I would rather add

    boolean hasTurnCosts() {
        return turnCostProvider != NO_TURN_COST_PROVIDER;
    }

    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)

  3. karussell commented on Mar 24, 2020

    @karussell
    MemberAuthor

    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)

  4. easbar commented on Mar 24, 2020

    @easbar
    Member

    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)

  5. easbar commented on Mar 24, 2020

    @easbar
    Member

    And I think in general tests can hurt :) (because of execution time and even more so migration time)

  6. karussell commented on Mar 24, 2020

    @karussell
    MemberAuthor

    Ok

    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)

    Isn't this covered from the many other tests?

  7. easbar commented on Mar 24, 2020

    @easbar
    Member

    No, because they usually focus on the algorithms and do not use the GraphHopper class.

  8. easbar commented on Mar 24, 2020

    @easbar
    Member

    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.

  9. easbar commented on Mar 28, 2020

    @easbar
    Member

    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)

  10. easbar commented on Mar 29, 2020

    @easbar
    Member

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions