Skip to content

bug in enforceHeadingByEdgeId ? #885

Closed

Description

@kodonnell
@param incoming if true, incoming edge is unfavored, else outgoing edge

Am I correct in that this is not true? As far as I can see, incoming is not used, and both the incoming and outgoing edge are unfavoured.

Use is for map-matching issue 70

Activity

  1. karussell commented on Nov 24, 2016

    @karussell
    Member

    Looks like this is indeed not implemented. We need a unit test for this :)

  2. added this to the 0.9 milestone on Nov 24, 2016
  3. kodonnell commented on Nov 24, 2016

    @kodonnell
    ContributorAuthor

    We need a unit test for this :)

    I can do a basic one to check it e.g. sets the right edge to unfavoured, but I don't think I understand it well enough to test it while routing. Is that OK?

  4. karussell commented on Nov 24, 2016

    @karussell
    Member

    I don't think I understand it well enough to test it while routing

    Please keep asking :) !

    See e.g. FastestWeightingTest.testWeightWrongHeading, QueryGraphTest.testEnforceHeading, GraphHopperIT.testMonacoStraightVia and GraphHopperOSMTest.testGetPathsDirectionEnforcement*

  5. kodonnell commented on Nov 24, 2016

    @kodonnell
    ContributorAuthor

    Hmmm, I think I/we may have misinterpreted the intention of this, and that it is only mean to be used at the start/end of a route. In in the case

         v1    v2 
     A------X------B
    

    with nodes A,B and virtual node X, and virtual edges v1 and v2, we'd call enforceHeadingByEdgeId(X, v1, ...) to enforce a heading left to right (i.e. X->B). This works by making v1 unfavored in both directions and hence v2 is the only option. If we wanted to enforce the reverse direction (X->A), then we'd use enforceHeadingByEdgeId(X, v2, ...). This is the current behaviour and I believe how it is currently used. Therefore I think the incoming parameter is completely redundant and can be removed. It might also pay to rename it to something like unfavorBothDirectionsOnVirtualEdge, which more clearly reflects its purpose.

    The only case where the incoming parameter could be useful is if we want to enforce a heading along a route, in which case we'd then have to unfavor the same direction on both v1 and v2 (instead of both directions on only one).

    Thoughts @karussell?

    Cc @stefanholder

  6. karussell commented on Nov 24, 2016

    @karussell
    Member

    Yes, this is ugly. In GraphHopper the graph is bidirectional but for every virtual node we create for virtual edges to replace the single real edge. Also we are using this method only via incoming=false

    So either we make this method work more generic or refactor it, yes.

  7. stefanholder commented on Nov 25, 2016

    @stefanholder
    Contributor

    In GraphHopper the graph is bidirectional but for every virtual node we create for virtual edges to replace the single real edge.

    So virtual edges are always unidirectional?

  8. karussell commented on Nov 26, 2016

    @karussell
    Member

    Yes, this made the implementation of the QueryGraph a lot easier as one has to deal with lots of edge cases, see #115. But as we have now many tests in place we could try to make it bidirectional too.

  9. stefanholder commented on Nov 28, 2016

    @stefanholder
    Contributor

    we could try to make it bidirectional too

    It's not really an issue right now in map matching issue 70.

    If the routing algorithms would support routing from arbitrary positions on edges we wouldn't even need this whole virtual node/virtual edge/QueryGraph business. @karussell, did you consider this before?

  10. karussell commented on Nov 28, 2016

    @karussell
    Member

    If the routing algorithms would support routing from arbitrary positions on edges we wouldn't even need this
    whole virtual node/virtual edge/QueryGraph business. @karussell, did you consider this before?

    Yes, sure (see the first comment in #115). But then the problem just moves to the algorithms. And the plan was and is to have many algorithms supported, where we abstract away the complexity of the real world as much as possible.

  11. karussell commented on Nov 28, 2016

    @karussell
    Member

    It's not really an issue right now in map matching issue 70

    What do you mean here?

  12. stefanholder commented on Nov 28, 2016

    @stefanholder
    Contributor

    What do you mean here?

    To implement prevention of inner-link U-turns, I don't see a problem with the fact that virtual edges are always unidirectional.

  13. karussell commented on Nov 29, 2016

    @karussell
    Member

    To implement prevention of inner-link U-turns, I don't see a problem with the fact that virtual edges are always unidirectional.

    I also do not see a problem, but it is special compared to the other behaviour. And so not really expected.

    Once again regarding:

    If the routing algorithms would support routing from arbitrary positions on edges we wouldn't even need this whole virtual node/virtual edge/QueryGraph business. @karussell, did you consider this before?

    I think we can still delegate the work to the Dijkstra algorithm (using the 'raw' Graph) and e.g. create one special routing algorithm or Dijkstra version for map matching. But handling one ways and multiple requests on one edge made the implementation of QueryGraph very hairy and I expect similar problems for a complete solution inside the algorithm. Also we make replacing the routing algorithm near to impossible then.

  14. stefanholder commented on Nov 29, 2016

    @stefanholder
    Contributor

    I also do not see a problem, but it is special compared to the other behaviour. And so not really expected.

    Let's continue the discussion of direction of virtual edges in graphhopper/map-matching#83.

    But handling one ways and multiple requests on one edge made the implementation of QueryGraph very hairy

    As you wrote here, couldn't we just just route between two real edges using edge based traversal?

  15. karussell commented on Nov 29, 2016

    @karussell
    Member

    As you wrote here, couldn't we just just route between two real edges using edge based traversal?

    Even if you get routing to work (although especially multiple points on one real edge will make problems!) ... how do you handle partial geometries, distance, etc then? We can use edge based traversal already with the QueryGraph without the needs to change the algorithm

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions