-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Use millisecond precision in A* traversal #6436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
b9774c1
0f7eb0c
f9a8e90
022707f
1cdaca7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -136,11 +136,10 @@ public State[] traverse(State s0) { | |
| ? this.travelTime | ||
| : (preferences.street().elevator().hopCost() * this.levels) | ||
| ); | ||
| s1.incrementTimeInSeconds( | ||
| this.travelTime > 0 | ||
| ? this.travelTime | ||
| : (int) (preferences.street().elevator().hopTime() * this.levels) | ||
| ); | ||
| int seconds = this.travelTime > 0 | ||
| ? this.travelTime | ||
| : (int) (preferences.street().elevator().hopTime() * this.levels); | ||
| s1.incrementTimeInMilliseconds(1000L * seconds); | ||
|
||
| return s1.makeStateArray(); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,7 +117,9 @@ public State makeState() { | |
| // check that time changes are coherent with edge traversal | ||
| // direction | ||
| if ( | ||
| traversingBackward ? (child.getTimeDeltaSeconds() > 0) : (child.getTimeDeltaSeconds() < 0) | ||
| traversingBackward | ||
| ? (child.getTimeDeltaMilliseconds() > 0) | ||
| : (child.getTimeDeltaMilliseconds() < 0) | ||
| ) { | ||
| LOG.trace( | ||
| "Time was incremented the wrong direction during state editing. {}", | ||
|
|
@@ -173,16 +175,20 @@ public void incrementWeight(double weight) { | |
| * is inferred from the direction of traversal. This is the only element of state that runs | ||
| * backward when traversing backward. | ||
| */ | ||
| public void incrementTimeInSeconds(int seconds) { | ||
| if (seconds < 0) { | ||
| public void incrementTimeInMilliseconds(long milliseconds) { | ||
| if (milliseconds < 0) { | ||
| LOG.warn( | ||
| "A state's time is being incremented by a negative amount while traversing edge " + | ||
| child.getBackEdge() | ||
| ); | ||
| defectiveTraversal = true; | ||
| return; | ||
| } | ||
| child.time += (traversingBackward ? -seconds : seconds); | ||
| child.time_ms += (traversingBackward ? -milliseconds : milliseconds); | ||
| } | ||
|
|
||
| public void incrementTimeInSeconds(long seconds) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Btw does this need to be long? |
||
| incrementTimeInMilliseconds(1000L * seconds); | ||
| } | ||
|
|
||
| public void incrementWalkDistance(double length) { | ||
|
|
@@ -362,7 +368,11 @@ public void setCarPickupState(CarPickupState carPickupState) { | |
| } | ||
|
|
||
| public void setTimeSeconds(long seconds) { | ||
| child.time = seconds; | ||
| child.time_ms = 1000 * seconds; | ||
| } | ||
|
|
||
| public void setTimeMilliseconds(long milliseconds) { | ||
| child.time_ms = milliseconds; | ||
| } | ||
|
|
||
| /* PUBLIC GETTER METHODS */ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.