Skip to content

Refactor LocationIndexMatch.findNClosest #997

Closed

Description

@kodonnell

As per the discussion in #994 (and links therein), we probably need to consider the purpose of LocationIndexMatch.findNClosest, and consequently rename and refactor - at the moment it's just a direct port from map-matching, and includes some known 'bugs' (which are listed as TODOs in the code). It probably won't be used outside of map-matching, so it's probably not an urgent fix.

@karussell - maybe you can give some direction for what you'd like to see here?

Activity

  1. karussell commented on Mar 22, 2017

    @karussell
    Member

    @karussell - maybe you can give some direction for what you'd like to see here?

    Here is a quick list (?)

    • What you find ugly or what you do not understand :)
    • I'm good with renaming it to findWithinRadius
    • Maybe we give it a limit parameter here, e.g. for map matching to return only 3 close results but with different edgeId? I now also understand my old code ;) and why I didn't use a PriorityQueue because this would increase unlimited and we just need the best X and list.add&sort should be faster for dense areas.
    • Is the maxIteration thing solvable via GraphHopper.maxRegionSearch?
    • rename GHIntHashSet set = new GHIntHashSet(); to maybe nodeSet?
    • understand&fix what @boldtrn discussed here
    • faster pruning e.g. if a leaf and its parent does not exist the neighboring leaf should not be requested (not sure if this optimization is possible though)
  2. boldtrn commented on Mar 22, 2017

    @boldtrn
    Member

    we just need the best X

    I thought the method would return all edges in the radius?

  3. kodonnell commented on Mar 23, 2017

    @kodonnell
    ContributorAuthor

    Sounds good, thanks @karussell. So you're happy with the intention of the method to be to find all edges within a given radius? It does mean breaking logic for map-matching as we won't be including some out-of-radius (but in-9-tiles) candidates - but I suspect that's a relatively rare occurrence, and one could argue shouldn't happen anyway. So I'd be happy with that for map-matching.

  4. karussell commented on Mar 23, 2017

    @karussell
    Member

    find X vs. find all: if 'find all' is similar fast I'm for this as this makes the lookup useful for other stuff.

    It does mean breaking logic for map-matching as we won't be including some out-of-radius (but in-9-tiles) candidates

    What do you mean here @kodonnell ?

  5. kodonnell commented on Mar 24, 2017

    @kodonnell
    ContributorAuthor

    What do you mean here @kodonnell ?

    The current behaviour includes features that we may remove in the more general one - specifically:

    1. if no results are found in radius, return no results. (Currently, in this case, we'll return one from within the nine tiles even if it's outside the radius.)
    2. (not) sorting the results - can't remember if this is required by map-matching or not.

    The first will definitely result in some differences in some cases (though as above, pretty rare, and I think it's probably incorrect in it's current state).

  6. karussell commented on Mar 25, 2017

    @karussell
    Member

    Ok. Would you mind to run a measurement how many results we get per request if we include all and if this is slower than the current approach? (as the result is hold in an ArrayList this should be slightly slower for increasing this, but we save time as we do not need to sort the list)

  7. kodonnell commented on Mar 28, 2017

    @kodonnell
    ContributorAuthor

    The first will definitely result in some differences in some cases ... pretty rare ...

    Eating my hat - I just spent hours trying to figure out why my sequence wasn't breaking (see map-matching). It turned out it was because of this - the route didn't 'break' because map-matching pulled in candidates from well outside the gps accuracy. Silly me.

    Ok. Would you mind to run a measurement how many results we get per request if we include all and if this is slower than the current approach? (as the result is hold in an ArrayList this should be slightly slower for increasing this, but we save time as we do not need to sort the list)

    At this stage I don't think I'll take this one on, sorry (we're starting to build our house).

  8. karussell commented on Sep 10, 2018

    @karussell
    Member

    Closing as duplicate of #1324 (I think, if not please reopen)

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions