Skip to content
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

core: fix and reintroduce pathfinding heuristic #8145

Merged
merged 1 commit into from
Jul 24, 2024
Merged

Conversation

eckter
Copy link
Contributor

@eckter eckter commented Jul 22, 2024

Fix #7200

Change summary:

  1. Revert the removal of the heuristic
  2. Use remaining time instead of remaining distance
  3. Use faster maths to compute geographic distance
  4. Speed up the "block location -> geo point" method (see comments)
  5. Remove old geo computation + external lib dependency

When running the benchmark, average process time per train goes from 40s to 25s. (note: this includes more than just the pathfinding). No extra error.

While tested I compared the old and new distance methods. The new one is less accurate, but it's not off by more than 0.1%.

@eckter eckter requested a review from a team as a code owner July 22, 2024 12:50
@eckter eckter requested a review from Khoyo July 22, 2024 12:50
@codecov-commenter
Copy link

codecov-commenter commented Jul 22, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 97.18310% with 2 lines in your changes missing coverage. Please review.

Project coverage is 28.16%. Comparing base (9e63378) to head (a9ec24c).
Report is 8 commits behind head on dev.

Files Patch % Lines
...osrd/api/pathfinding/RemainingDistanceEstimator.kt 94.59% 1 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##                dev    #8145      +/-   ##
============================================
+ Coverage     28.12%   28.16%   +0.03%     
- Complexity     2112     2120       +8     
============================================
  Files          1296     1299       +3     
  Lines        158648   158758     +110     
  Branches       3164     3176      +12     
============================================
+ Hits          44620    44714      +94     
- Misses       112126   112141      +15     
- Partials       1902     1903       +1     
Flag Coverage Δ
core 75.42% <97.18%> (+0.14%) ⬆️
editoast 70.39% <ø> (-0.01%) ⬇️
front 9.98% <ø> (+<0.01%) ⬆️
gateway 2.03% <ø> (ø)
railjson_generator 87.49% <ø> (ø)
tests 73.18% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Contributor

@Erashin Erashin left a comment

Choose a reason for hiding this comment

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

LGTM. For other optional reviewers, I suggest comparing this commit with 1122145, where the remaining distance classes were previously removed.

It was too slow to be worth using, and needed
to be adapted to return times instead of distances
@eckter eckter force-pushed the ech/fix-heuristic branch from e092e40 to a9ec24c Compare July 23, 2024 13:31
@eckter eckter requested a review from Khoyo July 23, 2024 13:55
Copy link
Contributor

@Khoyo Khoyo left a comment

Choose a reason for hiding this comment

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

LGTM

@eckter eckter added this pull request to the merge queue Jul 24, 2024
Merged via the queue into dev with commit bc19cf5 Jul 24, 2024
20 checks passed
@eckter eckter deleted the ech/fix-heuristic branch July 24, 2024 07:35
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.

core: pathfinding heuristic is too expensive to compute
4 participants