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

Refine allowance tolerances #6404

Merged
merged 2 commits into from
Feb 6, 2024
Merged

Conversation

Castavo
Copy link
Contributor

@Castavo Castavo commented Jan 19, 2024

In this PR I offer two changes:

  • Change the way we distribute tolerance (today, with too many stops, we can exceed the wanted tolerance, I offer to distribute the tolerance between each section, proportionally to their travel time)
  • Change the order in which we compute allowance ranges (today it's from less restrictive to more restrictive, I offer to compute from shortest to largest)

The first commit changes two tests that highlights why I offer to change those behaviors (a test with a short allowance range and a very bug value will fail, and a test with many stops on a path, on top of an allowance accumulates approximation errors)
The next two fix those problems
The last one updates all tests regarding allowances to change the tolerances in assertEquals to be more restrictive

All of those are not atomic, so I'll squash them before merging

EDIT: distributing allowance tolerance according to section relative time makes for a more accurate computation but will make some particular allowances fail (since we'll demand high precision on small ranges (thus a small range with very high allowance value and very high imposed speed will fail). If that's not okay, we may distribute tolerance with a function that favors small values)

Copy link

codecov bot commented Jan 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5895b87) 79.55% compared to head (8eb223e) 28.01%.

Additional details and impacted files
@@              Coverage Diff              @@
##                dev    #6404       +/-   ##
=============================================
- Coverage     79.55%   28.01%   -51.54%     
- Complexity     2169     2170        +1     
=============================================
  Files           338     1032      +694     
  Lines         12796   127750   +114954     
  Branches       1775     2603      +828     
=============================================
+ Hits          10180    35793    +25613     
- Misses         1925    90442    +88517     
- Partials        691     1515      +824     
Flag Coverage Δ
core 78.53% <100.00%> (-0.01%) ⬇️
editoast 75.39% <ø> (?)
front 8.62% <ø> (?)
gateway 2.50% <ø> (?)
railjson_generator 87.25% <ø> (ø)
tests 81.95% <ø> (?)

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.

@Castavo Castavo added area:core Work on Core Service kind:refacto-task Task related to Refactorization Epic labels Jan 19, 2024
@Castavo Castavo force-pushed the bpt/core/refine-allowance-tolerances branch from 3a54198 to e47c3bc Compare January 19, 2024 10:49
@Castavo Castavo marked this pull request as ready for review January 19, 2024 11:00
@Castavo Castavo requested a review from a team as a code owner January 19, 2024 11:00
@Castavo Castavo requested review from eckter and axrolld January 19, 2024 11:00
Copy link
Contributor

@axrolld axrolld left a comment

Choose a reason for hiding this comment

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

New tests look great ! The work with tolerences as well. I'm just not quite sure what to do with the sorting of the ranges that makes the computation sub-optimal in terms of energy consumption. We should probably talk about it.

@Castavo Castavo self-assigned this Feb 1, 2024
@Castavo Castavo force-pushed the bpt/core/refine-allowance-tolerances branch 2 times, most recently from 68b8223 to 7cc603e Compare February 1, 2024 17:38
@Castavo Castavo requested review from eckter and axrolld February 1, 2024 17:39
Copy link
Contributor

@axrolld axrolld left a comment

Choose a reason for hiding this comment

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

📈

@Castavo Castavo force-pushed the bpt/core/refine-allowance-tolerances branch from 7cc603e to 2eebe3d Compare February 1, 2024 17:53
Baptiste Prevot added 2 commits February 6, 2024 11:19
instead of among ranges
Also, change order in which allowance ranges are computed
start with the shortest ranges instead of the ones with the lowest value
@Castavo Castavo force-pushed the bpt/core/refine-allowance-tolerances branch from 2eebe3d to 8eb223e Compare February 6, 2024 10:21
@Castavo Castavo enabled auto-merge February 6, 2024 10:21
@Castavo Castavo added this pull request to the merge queue Feb 6, 2024
Merged via the queue into dev with commit 1372f0a Feb 6, 2024
22 checks passed
@Castavo Castavo deleted the bpt/core/refine-allowance-tolerances branch February 6, 2024 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:core Work on Core Service kind:refacto-task Task related to Refactorization Epic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants