Skip to content

Make multiple CH-prepared profiles possible #464

Closed

Description

@karussell

Currently only one profile can be CH-prepared and therefor faster. For this change eveything is in place via #111 and #339 both implemented in PR #447.

  • access bits won't be necessarily on the first&second bit of the encoder.flags now anymore. But for shortcut weights we need them there.
  • how to get these routing graphs - via getGraph(Graph.class, new Weighting, new FlagEncoder)?
  • do multiple CH-preparations based on different weightings/flagencoders
  • we need a separate per-request parameter to force none-CH requests like flexibility=true. This possibility should be disabled by default like jsonp is disabled for request stability reasons.
  • how to handle multiple routing factories for ch and none-ch in GraphHopper class
  • make config possible in Java API and in config.properties
  • remove TODOs and remove warning in config.properties regarding multiple profiles with enabled CH

Once we have this we need #86 and the bug mentioned in #318 which will get a lot more urgent.

Usage

Via config.properties:

  • Specify multiple profiles e.g. graph.flagEncoders=car,bike
  • Use prepare.chWeighting=fastest (currently the default)

Or via Java API:

hopper.setCHEnable(true); // currently the default
hopper.setCHWeighting("fastest");  // currently the default
hopper.setEncodingManager(carFlagEncoder, bikeFlagEncoder);

Then do a normal import and you should see two CH preparations going on:

2015-07-27 14:49:29,472 [main] INFO  com.graphhopper.GraphHopper - 1/2 calling prepare.doWork for FASTEST|car ... (totalMB:955, usedMB:283)
2015-07-27 14:49:30,879 [main] INFO  com.graphhopper.routing.ch.PrepareContractionHierarchies - 0, updates:0, nodes: 158 254, shortcuts:0, dijkstras:354 316, t(dijk):0.6, t(period):0.0, t(lazy):0.0, t(neighbor):0.0, meanDegree:1, algo:2MB, totalMB:955, usedMB:293
...
2015-07-27 14:49:52,309 [main] INFO  com.graphhopper.routing.ch.PrepareContractionHierarchies - took:22, new shortcuts: 99799, PREPARE+FASTEST|car, car, dijkstras:2272753, t(dijk):15.8, t(period):6.71, t(lazy):3.58, t(neighbor):6.39, meanDegree:0, initSize:158254, periodic:20, lazy:10, neighbor:20, totalMB:957, usedMB:85

2015-07-27 14:49:52,309 [main] INFO  com.graphhopper.GraphHopper - 2/2 calling prepare.doWork for FASTEST|bike ... (totalMB:957, usedMB:85)
2015-07-27 14:49:55,216 [main] INFO  com.graphhopper.routing.ch.PrepareContractionHierarchies - 0, updates:0, nodes: 158 254, shortcuts:0, dijkstras:819 501, t(dijk):1.36, t(period):0.0, t(lazy):0.0, t(neighbor):0.0, meanDegree:1, algo:2MB, totalMB:957, usedMB:95
...
2015-07-27 14:50:49,523 [main] INFO  com.graphhopper.routing.ch.PrepareContractionHierarchies - took:57, new shortcuts: 183998, PREPARE+FASTEST|bike, bike, dijkstras:4726956, t(dijk):46.95, t(period):24.06, t(lazy):5.42, t(neighbor):14.02, meanDegree:1, initSize:158254, periodic:20, lazy:10, neighbor:20, totalMB:957, usedMB:172

Activity

  1. karussell commented on Jul 24, 2015

    @karussell
    MemberAuthor

    This is now compiling, all tests running through and working for one profile at least. More profiles cause routing problems Connection between locations not found for the additional profiles even for short distances and if it is routing causing strange artifacts. To be investigated.

  2. karussell commented on Jul 24, 2015

    @karussell
    MemberAuthor

    See branch https://github.com/graphhopper/graphhopper/tree/issue_464

    Looks that some integration tests are not passing, will investigate next week.

  3. karussell commented on Jul 27, 2015

    @karussell
    MemberAuthor

    It is working now! Please test and report problems!

    I added a usage description in the top comment entry. This leads to huge RAM savings for multiple profiles and also import time savings as the import has to be done only once. Furthermore to an easier setup.

    Example 3 profiles (car, bike2, foot):
    50g RAM used for import, imported in 22h, resulting storage is 34g ~= RAM used for running
    vs. old behaviour:
    42g RAM used for import, imported in 26h, resulting storage is 57g ~= RAM used for running

    I.e. an additional CH profile is 5g to 8g large.

  4. added this to the 0.5 milestone on Jul 27, 2015
  5. karussell commented on Jul 27, 2015

    @karussell
    MemberAuthor

    further improvements to be done:

    • add weighting of ch also to graph.toString + toDetailsString
    • Weighting comparison by reference or by string both sometimes ugly, see // TODO too loose matching?
    • should we really allow RoutingAlgorithmFactory overwriting in putAF? no
    • ensure already in Weighting class file name friendly names! so that file name is really identical to weighting name?
    • assert correct encoder in the methods isForward/isBackward of the two edge iterator implementations in CHGraph, see // TODO assert correct encoder
  6. added a commit that references this issue on Jul 27, 2015
  7. karussell commented on Aug 4, 2015

    @karussell
    MemberAuthor

    All problems fixed. Or at least an issue created (#490, #491, #492)

  8. added a commit that references this issue on Aug 4, 2015
  9. karussell commented on Aug 4, 2015

    @karussell
    MemberAuthor

    Merged

  10. devemux86 commented on Aug 4, 2015

    @devemux86
    Contributor

    👍

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