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: improve stdcm heuristic using actual remaining distance #7417

Merged
merged 2 commits into from
May 17, 2024

Conversation

eckter
Copy link
Contributor

@eckter eckter commented May 15, 2024

Fix #6605

The implementation could be improved in some ways but it seems good enough and simple enough for now.

Average execution time is divided by roughly 2, same for std.
Execution time goes slightly up for the fastest requests.

Only one request goes above 100s now, it reaches the timeout limit (120s) but actually stops naturally with a "no path found" just before the exception would be raised.

The preprocessing only takes ~ 5% of the execution time, so we have quite a lot of margin to improve it further later on.

Benchmark on realistic requests (everything is in seconds, describe is from pandas):

old.time.describe()

count 303.000000
mean 8.215783
std 20.534878
min 1.708356
25% 1.905426
50% 2.161869
75% 3.846870
max 123.005467
Name: time, dtype: float64

new.time.describe()

count 303.000000
mean 4.904902
std 11.438471
min 1.705818
25% 2.036432
50% 2.208790
75% 2.850309
max 120.813108
Name: time, dtype: float64

(new.time - old.time).describe()

count 303.000000
mean -3.310882
std 14.979293
min -120.109074
25% -0.550600
50% -0.024111
75% 0.159067
max 33.703450
Name: time, dtype: float64

@eckter eckter requested a review from Erashin May 15, 2024 10:29
@eckter eckter requested a review from a team as a code owner May 15, 2024 10:29
@codecov-commenter
Copy link

codecov-commenter commented May 15, 2024

Codecov Report

Attention: Patch coverage is 94.73684% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 29.39%. Comparing base (f6e3e93) to head (0a5742b).

Files Patch % Lines
...cf/osrd/stdcm/graph/EngineeringAllowanceManager.kt 33.33% 0 Missing and 2 partials ⚠️
.../src/main/kotlin/fr/sncf/osrd/graph/Pathfinding.kt 50.00% 0 Missing and 1 partial ⚠️
...c/main/kotlin/fr/sncf/osrd/stdcm/STDCMHeuristic.kt 98.73% 0 Missing and 1 partial ⚠️
.../main/kotlin/fr/sncf/osrd/stdcm/graph/STDCMEdge.kt 0.00% 1 Missing ⚠️

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

Additional details and impacted files
@@            Coverage Diff            @@
##                dev    #7417   +/-   ##
=========================================
  Coverage     29.38%   29.39%           
+ Complexity     2012     2008    -4     
=========================================
  Files          1173     1174    +1     
  Lines        145276   145356   +80     
  Branches       2828     2845   +17     
=========================================
+ Hits          42693    42730   +37     
- Misses       100917   100957   +40     
- Partials       1666     1669    +3     
Flag Coverage Δ
core 75.06% <94.73%> (-0.14%) ⬇️
editoast 72.41% <ø> (-0.03%) ⬇️
front 9.80% <ø> (ø)
gateway 2.41% <ø> (ø)
railjson_generator 87.49% <ø> (ø)
tests 83.96% <ø> (ø)

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.

@eckter eckter force-pushed the ech/improve-stdcm-heuristic branch from 73c9f29 to 5ca1614 Compare May 15, 2024 11:30
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.

Good job.

@eckter eckter force-pushed the ech/improve-stdcm-heuristic branch 3 times, most recently from 60ba8ff to ad638e0 Compare May 17, 2024 12:06
@eckter eckter force-pushed the ech/improve-stdcm-heuristic branch from ad638e0 to 0a5742b Compare May 17, 2024 12:22
@eckter eckter added this pull request to the merge queue May 17, 2024
Merged via the queue into dev with commit 044e181 May 17, 2024
17 checks passed
@eckter eckter deleted the ech/improve-stdcm-heuristic branch May 17, 2024 13:24
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.

Improve STDCM heuristic
3 participants