Skip to content

Fix rounding error in street routing - #6484

Merged
tkalvas merged 9 commits into
opentripplanner:dev-2.xfrom
HSLdevcom:fix-rounding-error-in-astar
Mar 3, 2025
Merged

Fix rounding error in street routing#6484
tkalvas merged 9 commits into
opentripplanner:dev-2.xfrom
HSLdevcom:fix-rounding-error-in-astar

Conversation

@tkalvas

@tkalvas tkalvas commented Feb 24, 2025

Copy link
Copy Markdown
Contributor

fix inaccuracy in state reversal which generates rounding errors in creating the reversed path for arriveBy queries

Summary

Explain in one or two sentences what this PR achieves.

Issue

Fixes #6481

Unit tests

Added a bit of testing for the reversal code to work accurately no matter what the millisecond part of the time in the request.

Changelog

Not needed, bug fix for a new fix.

Bumping the serialization version id

No.

…reating the reversed path for arriveBy queries
@tkalvas
tkalvas requested a review from a team as a code owner February 24, 2025 13:23
@tkalvas tkalvas mentioned this pull request Feb 24, 2025
@tkalvas
tkalvas marked this pull request as draft February 24, 2025 13:25
…ange to work with changed arriveBy time rounding logic
@codecov

codecov Bot commented Feb 26, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 45.45455% with 6 lines in your changes missing coverage. Please review.

Project coverage is 70.13%. Comparing base (30c1fa5) to head (0240eda).
Report is 67 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
.../opentripplanner/routing/impl/GraphPathFinder.java 14.28% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6484      +/-   ##
=============================================
+ Coverage      70.10%   70.13%   +0.02%     
+ Complexity     18273    18269       -4     
=============================================
  Files           2077     2077              
  Lines          77658    77620      -38     
  Branches        7827     7820       -7     
=============================================
- Hits           54443    54439       -4     
+ Misses         20438    20402      -36     
- Partials        2777     2779       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tkalvas
tkalvas marked this pull request as ready for review February 26, 2025 10:33
@tkalvas
tkalvas marked this pull request as draft February 26, 2025 10:36
@tkalvas

tkalvas commented Feb 26, 2025

Copy link
Copy Markdown
Contributor Author

Ok, now I no longer change anything of note. I'm not sure where the problem originates from.

@tkalvas
tkalvas marked this pull request as ready for review February 26, 2025 10:39
@tkalvas

tkalvas commented Feb 26, 2025

Copy link
Copy Markdown
Contributor Author

The truncation was wrong, so the check is wrong, and there never was anything actually incorrect.

@vpaturet
vpaturet self-requested a review February 26, 2025 11:59
@vpaturet vpaturet added the Entur Test This is currently being tested at Entur label Feb 26, 2025
@optionsome optionsome changed the title fix rounding error in A* Fix rounding error in street routing Feb 26, 2025
@optionsome optionsome added the !Bug Apply to issues describing a bug and PRs witch fixes it. label Feb 26, 2025
@optionsome optionsome added this to the 2.7 (next release) milestone Feb 26, 2025
…eRequest datetime to be an exact number of seconds. Backward and forward searches will now not match unless the request datetime is an exact number of seconds.
@tkalvas
tkalvas requested a review from optionsome February 27, 2025 13:42
@tkalvas
tkalvas marked this pull request as draft February 27, 2025 13:47
@tkalvas

tkalvas commented Feb 27, 2025

Copy link
Copy Markdown
Contributor Author

There's still a place where I have to round the input time to a whole second in RouteRequest, I'll do it today, and then undraft the pr.

@tkalvas
tkalvas marked this pull request as ready for review February 27, 2025 13:54
Comment thread application/src/main/java/org/opentripplanner/street/search/state/State.java Outdated
@tkalvas
tkalvas requested a review from optionsome February 27, 2025 15:37
) {
OTPRequestTimeoutException.checkForTimeout();
Instant reqTime = request.dateTime().truncatedTo(ChronoUnit.SECONDS);
Instant reqTime = request.dateTime().truncatedTo(ChronoUnit.MILLIS);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it necessary to truncate again here? It seems that the unit tests pass even without truncating.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has become unnecessary due to later changes. I'm taking it out.

@tkalvas
tkalvas requested a review from vpaturet March 3, 2025 08:34
@tkalvas
tkalvas merged commit ec39bd9 into opentripplanner:dev-2.x Mar 3, 2025
@tkalvas
tkalvas deleted the fix-rounding-error-in-astar branch March 3, 2025 14:47
t2gran pushed a commit that referenced this pull request Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

!Bug Apply to issues describing a bug and PRs witch fixes it. Entur Test This is currently being tested at Entur

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rounding error in A*

3 participants