Skip to content

in GraphHopper class set minOneWayNetworkSize to 200 - #1723

Closed
karussell wants to merge 2 commits into
masterfrom
minonewaynw200
Closed

karussell wants to merge 2 commits into
masterfrom
minonewaynw200

Conversation

@karussell

@karussell karussell commented Sep 10, 2019 •

Copy link
Copy Markdown
Member

We currently have

  prepare.min_network_size: 200
  prepare.min_one_way_network_size: 200

in config-example.yml and so we need to make it consistent in the GraphHopper class too. Unfortunately many tests need a change as the do not expect the PrepareRoutingSubnetworks to kick in. To make it a bit convenient I introduced GraphHopper.forTesting, but I'm unsure if we should introduce this there or better create a GraphHopperOSMTest class with this method instead.

@easbar

easbar commented Sep 11, 2019 •

Copy link
Copy Markdown
Member

I think either way is somehow acceptable, but I have a slight preference for not putting the method into GraphHopper. forTesting() sounds like we are supposed to use it when testing something, but this is not the case (rather the other way around, it should only be used for old tests (or for tests with small graphs where we do not want subnetwork removal). Maybe create a createHopper(EncodingManager, location, datareaderfile) (or similar) method in GraphHopperOSMTest ? The hopper creation is duplicated quite often in this test, so maybe now is the time to put this into a separate method (and put minnetwork=200 there). And maybe in some other cases we can adjust the test expectations to make the tests work with the default settings ?

@karussell

karussell commented Sep 11, 2019 •

Copy link
Copy Markdown
Member Author

I have a slight preference for not putting the method into GraphHopper. forTesting()

Yeah, after thinking over this I agree and will create a new class with just different defaults, to avoid too much friction when creating tests.

Maybe create a createHopper(EncodingManager, location, datareaderfile) (or similar) method in GraphHopperOSMTest ?

Ah, this was confusing. I more meant a new class that just extends GraphHopperOSM and is for Test (GraphHopperOSMForTest :) ?). Will try to find something simple.

And maybe in some other cases we can adjust the test expectations to make the tests work with the default settings ?

This won't be possible as smaller unit tests will always have too few nodes.

@michaz

michaz commented Sep 14, 2019 •

Copy link
Copy Markdown
Member

Why do you even create a new class? Now it looks like there's something special about subnetwork pruning, and you should always test GraphHopper without it.

Can't you just set this parameter to 0 on the instance, with a config flag, only on the required tests? I think there's nothing wrong with copy-pasting it. Copy-paste is okay when every single case is special anyway, which is the case here. Hiding it behind a class like "ForTest" just makes it look like a clever generalization of something, rather than just setting a parameter that happens to be required.

Or is it possible to create a special config file that is used for those tests instead of a class?

@michaz

michaz commented Sep 14, 2019

Copy link
Copy Markdown
Member

Or is the problem that all the example networks just completely disappear because they are small?

Then maybe go all the way and make the change we talked about: Let the "oneWay"-pruner behave like the regular one (not delete the biggest component, ..), and maybe even remove the other one? Or is that too hairy?

@karussell

Copy link
Copy Markdown
Member Author

Or is the problem that all the example networks just completely disappear because they are small?

Yes.

Let the "oneWay"-pruner behave like the regular one (not delete the biggest component, ..), and maybe even remove the other one?

Yeah, you are right: keeping the biggest component should be done even it is is smaller than the config.

@karussell karussell added this to the 0.14 milestone Sep 17, 2019
@karussell karussell modified the milestones: 1.0, 2.0 Mar 31, 2020
@michaz michaz closed this May 21, 2020
@michaz

michaz commented May 21, 2020 •

Copy link
Copy Markdown
Member

Superseded by #2042 .

@karussell karussell modified the milestones: 2.0, 1.0 May 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants