Skip to content

Use random speeds for random graphs to restore behavior before #2202 - #2212

Merged
easbar merged 1 commit into
masterfrom
random_speeds
Dec 14, 2020
Merged

easbar merged 1 commit into
masterfrom
random_speeds

Conversation

@easbar

@easbar easbar commented Dec 14, 2020

Copy link
Copy Markdown
Member

In #2202 we 'broke' GHUtility#buildRandomGraph because

  1. if speed!=null the calls to random.nextDouble for fwd/bwdSpeed were skipped (so we e.g. got different distances for the same seed), even though previously these calls were executed even for randomSpeedEnc!=null.

  2. we accidentally disabled the random speed generation by passing speed=60d in places where we previously passed randomSpeedEnc=null (which meant that random speeds should be enabled). Where we previously passed randomSpeedEnc!=null we now need to pass speed=null and where we previously passed randomSpeedEnc=null we now need to pass speed=60 (at least for car).

Also c.f. this comment: #2202 (comment)

@easbar
easbar requested a review from karussell December 14, 2020 08:44
@easbar

easbar commented Dec 14, 2020

Copy link
Copy Markdown
Member Author

Btw do you label all PRs (issues?) until 3.0 as 'milestone 3.0'?

@karussell

Copy link
Copy Markdown
Member

if speed!=null the calls to random.nextDouble for fwd/bwdSpeed were skipped

Oh, no. Sorry for breaking this :) and thanks for fixing this!

we accidentally disabled the random speed generation by passing speed=60d in places where we previously passed randomSpeedEnc=null

Are you sure? Previously e.g. in DirectedBidirectionalDijkstraTest.java we used randomSpeedEnc!=null:

- GHUtility.buildRandomGraph(graph, rnd, numNodes, 2.2, true, true, encoder.getAverageSpeedEnc(), 0.7, 0.8, 0.8);
+ GHUtility.buildRandomGraph(graph, rnd, numNodes, 2.2, true, true, encoder.getAccessEnc(), encoder.getAverageSpeedEnc(), 60d, 0.7, 0.8, 0.8);

Btw do you label all PRs (issues?) until 3.0 as 'milestone 3.0'?

Yes

@easbar easbar added this to the 3.0 milestone Dec 14, 2020
@easbar

easbar commented Dec 14, 2020

Copy link
Copy Markdown
Member Author

Are you sure? Previously e.g. in DirectedBidirectionalDijkstraTest.java we used randomSpeedEnc!=null:

Argh, this was a typo. Yes in DirectedBidirectionalDijkstraTest (and most others) we used randomSpeedEnc!=null which meant we were using random speeds, so now we need to set speed==null. randomSpeedEnc!=null meant: "There is a random speed encoder, so let's use random speeds". So my above sentence should be:

"we accidentally disabled the random speed generation by passing speed=60d in places where we previously passed randomSpeedEnc!=null (which meant that random speeds should be enabled)"

@easbar

easbar commented Dec 14, 2020

Copy link
Copy Markdown
Member Author

Btw do you label all PRs (issues?) until 3.0 as 'milestone 3.0'?

Also those that got opened some time ago but were fixed/closed for 3.0, like #1972?

@karussell

Copy link
Copy Markdown
Member

"we accidentally disabled the random speed generation by passing speed=60d in places where we previously passed randomSpeedEnc!=null (which meant that random speeds should be enabled)"

Ah, ups. Then I indeed misread the code and did it not accidentally.

Also those that got opened some time ago but were fixed/closed for 3.0, like #1972?

Yes, I tag every thing that will be added or fixed in 3.0. So that we can easily search what improved or changed for this version.

@easbar
easbar merged commit ef2c592 into master Dec 14, 2020
@easbar
easbar deleted the random_speeds branch December 14, 2020 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants