Skip to content

Fix time penalty - #5715

Merged
t2gran merged 23 commits into
opentripplanner:dev-2.xfrom
entur:fix_time_penalty
Mar 5, 2024
Merged

Fix time penalty#5715
t2gran merged 23 commits into
opentripplanner:dev-2.xfrom
entur:fix_time_penalty

Conversation

@t2gran

@t2gran t2gran commented Feb 29, 2024

Copy link
Copy Markdown
Member

Summary

The time-penalty feature was implemented a bit too simple and did not work in a number of minor cases.

To make the time-penalty feature work poperly the feature is moved inside Raptor and is accounted for:

  • when doing iterations (extra itterations is done for access with time-penalty to include them when they correspond with transit early in the search window)
  • the time-penalty is excluded from the arrive-by time limit check
  • the time-penalty is removed from the output path, but included in all relevant pareto-set comparasons

Issue

Closes #5681

Unit tests

✅ Unit tests are added for almost all new logic. In addition two module tests in Raptor is added to ensure that the access/egress is integrated into Raptor in the correct itteration and round. In addition this module tests test all Raptor profiles and forward/reverse search.

Documentation

JavaDoc is written and updated - no feature is changed, so none of the API/config doc is changed.

Changelog

✅ Should be included.

Bumping the serialization version id

✅ Unsure, but do it to be safe. There are chances to the Raptor API witch is stored in the config. Rarly configured, but better to be safe.

Raptor does not care about mode, so there is no difference between walking and driving;
Hence having factory methods for CAR are very confusing. We have methods for walking and
flex because they serve as "knob" for what to expect and a name to use in conversation.
WALK => (simple, time-shiftable, fixed cost and duration)
FLEX => (complex, opening-hours, hasRides, may arrive onBoard, multiple transfers)
… both forward and reverse search.

Minor cleanup included.
… time-penalty before earliest-departure-time
@t2gran t2gran added !Bug Apply to issues describing a bug and PRs witch fixes it. !Improvement A functional improvement or micro feature +Bump Serialization Id Add this label if you want the serialization id automatically bumped after merging the PR labels Feb 29, 2024
@t2gran t2gran added this to the 2.5 (next release) milestone Feb 29, 2024
@t2gran
t2gran requested a review from a team as a code owner February 29, 2024 17:08
@codecov

codecov Bot commented Feb 29, 2024

Copy link
Copy Markdown

Codecov Report

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

Project coverage is 67.76%. Comparing base (5da2268) to head (cacec85).
Report is 82 commits behind head on dev-2.x.

Files Patch % Lines
...aptor/api/model/AbstractAccessEgressDecorator.java 64.28% 10 Missing ⚠️
...tor/rangeraptor/path/PathParetoSetComparators.java 16.66% 1 Missing and 9 partials ⚠️
...ipplanner/raptor/api/model/RaptorAccessEgress.java 66.66% 1 Missing ⚠️
.../org/opentripplanner/raptor/util/IntIterators.java 75.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #5715      +/-   ##
=============================================
+ Coverage      67.69%   67.76%   +0.07%     
- Complexity     16369    16447      +78     
=============================================
  Files           1890     1900      +10     
  Lines          71812    72085     +273     
  Branches        7407     7425      +18     
=============================================
+ Hits           48611    48849     +238     
- Misses         20693    20727      +34     
- Partials        2508     2509       +1     

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

@vpaturet vpaturet added the Entur Test This is currently being tested at Entur label Mar 1, 2024
Comment thread src/main/java/org/opentripplanner/raptor/api/model/RaptorAccessEgress.java Outdated
Comment thread src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessPaths.java Outdated
Co-authored-by: Leonard Ehrenfried <mail@leonard.io>
Comment thread src/main/java/org/opentripplanner/raptor/util/IntIterators.java Outdated

/**
* There are 86400 seconds in a "normal" day(24 * 60 * 60). This is used for testing, logging
* and debugging, but does not base any important logic on this. A day with changes in

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
* and debugging, but does not base any important logic on this. A day with changes in
* and debugging, but don't base any important logic on this. A day with changes in

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It is not recommended to use apostrophized (or in any way) shortened words in professional or formal english. The doc was appropriate while it was part of the main code, but I moved it into the test code to make it impossible to use in the main code. So, I do not think the doc is needed any more. I will clean it up.

@t2gran
t2gran force-pushed the fix_time_penalty branch from ebfc29b to 4758a77 Compare March 1, 2024 11:42

@leonardehrenfried leonardehrenfried left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I must admit that I don't understand the RAPTOR part but the code looks good and I tested this with a few flex data sets and did not encounter the exception anymore.

@leonardehrenfried

Copy link
Copy Markdown
Member

It might be a good idea to run the speed tests on this PR.

@vpaturet vpaturet left a comment

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.

Only typos/clarifications
I tested also with Entur data, it works.

Comment thread src/main/java/org/opentripplanner/raptor/api/model/RaptorAccessEgress.java Outdated
Comment thread src/main/java/org/opentripplanner/raptor/api/model/RaptorAccessEgress.java Outdated
Comment thread src/main/java/org/opentripplanner/raptor/api/model/RaptorAccessEgress.java Outdated
Comment thread src/main/java/org/opentripplanner/raptor/path/Path.java Outdated
Comment thread src/main/java/org/opentripplanner/raptor/path/Path.java Outdated
Comment thread src/main/java/org/opentripplanner/raptor/api/model/RaptorAccessEgress.java Outdated
Co-authored-by: Vincent Paturet <46598384+vpaturet@users.noreply.github.com>
Co-authored-by: Vincent Paturet <46598384+vpaturet@users.noreply.github.com>
@vpaturet
vpaturet self-requested a review March 5, 2024 09:11
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. +Bump Serialization Id Add this label if you want the serialization id automatically bumped after merging the PR Entur Test This is currently being tested at Entur !Improvement A functional improvement or micro feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trip search with flex access/egress fails with IllegalStateException

3 participants