-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Keep at least one result for min-transfers and each transit-group in itinerary-group-filter #5919
Keep at least one result for min-transfers and each transit-group in itinerary-group-filter #5919
Conversation
We will use this later to improve group-by-filter
This is default off, witch make OTP work as before. We will remove the old behavior and this OTPFeature if the new multi-criteria filter works as expected.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #5919 +/- ##
=============================================
+ Coverage 69.65% 69.70% +0.05%
- Complexity 17156 17224 +68
=============================================
Files 1942 1947 +5
Lines 73786 73939 +153
Branches 7550 7573 +23
=============================================
+ Hits 51397 51541 +144
- Misses 19759 19765 +6
- Partials 2630 2633 +3 ☔ View full report in Codecov by Sentry. |
This PR is improving the |
...rg/opentripplanner/routing/algorithm/filterchain/filters/system/SingeCriteriaComparator.java
Outdated
Show resolved
Hide resolved
...rg/opentripplanner/routing/algorithm/filterchain/filters/system/SingeCriteriaComparator.java
Outdated
Show resolved
Hide resolved
...rg/opentripplanner/routing/algorithm/filterchain/filters/system/SingeCriteriaComparator.java
Outdated
Show resolved
Hide resolved
...rg/opentripplanner/routing/algorithm/filterchain/filters/system/SingeCriteriaComparator.java
Outdated
Show resolved
Hide resolved
...org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/McMaxLimitFilter.java
Outdated
Show resolved
Hide resolved
...org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/McMaxLimitFilter.java
Outdated
Show resolved
Hide resolved
...org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/McMaxLimitFilter.java
Outdated
Show resolved
Hide resolved
...org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/McMaxLimitFilter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/State.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/State.java
Outdated
Show resolved
Hide resolved
...pentripplanner/routing/algorithm/filterchain/filters/system/SingeCriteriaComparatorTest.java
Outdated
Show resolved
Hide resolved
...pentripplanner/routing/algorithm/filterchain/filters/system/SingeCriteriaComparatorTest.java
Outdated
Show resolved
Hide resolved
...pentripplanner/routing/algorithm/filterchain/filters/system/SingeCriteriaComparatorTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I typical Thomas fashion this is using very clean coding practises and is well tested and documented. Nevertheless, I picked up on a few smaller issues.
Co-authored-by: Leonard Ehrenfried <[email protected]>
Co-authored-by: Leonard Ehrenfried <[email protected]>
…itinerary-group-filter opentripplanner#5919 (squashed 4d0dc4c..9b4b7fe)
The merge does not look ok - I will try to do it one more time... |
You apparently formatted all files in the |
bb1d4a1
to
fd33464
Compare
I noticed, probably did it as part of comitting from IntelliJ. Did the merge again, but now using git from the command line. |
@@ -10,7 +10,7 @@ public final class DefaultTransitGroupPriorityCalculator | |||
implements RaptorTransitGroupPriorityCalculator { | |||
|
|||
@Override | |||
public int mergeGroupIds(int currentGroupIds, int boardingGroupId) { | |||
public int mergeInGroupId(int currentGroupIds, int boardingGroupId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it mean to "merge in a group id" rather than merging two group ids? I would assuming that "merging in" modifies an existing instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first argument is a set of group ids, not singular.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess both names work, but the name should match the JavaDoc:
/**
* Merge in the transit group id with an existing set. Note! Both the set
* and the group id type is {@code int}.
*
* @param currentGroupIds the set of groupIds for all legs in a path.
* @param boardingGroupId the transit group id to add to the given set.
* @return the new computed set of groupIds
*/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a question about the renaming of "mergeInGroupId" method.
Summary
The MaxLimit filter in GroupByFilter in the ItineraryListFilterChain did only look at
generalized-cost
when it reduced the number of itineraries in each group. This problematic because the itinerary with the best number of transfers or good alternatives for transit-groups could be lost. The new McMaxLimit filter will look at all pareto criterias used in the Raptor search and keep at least one optimal result for each criteria, before limiting the result to N itineraries.To enable this the
OTPFeature.MultiCriteriaGroupMaxFilter
must be set in otp-config.json.Issue
There is no issue for this, but one case we have seen at Entur is:
The alternative with two legs with the same agency is filtered away, in favor of a slightly better cost alternative with two legs with different agencies. The first leg is the same, but because of the switch to another agency the customer has to bye two tickets and have no guarantee in case of delays. So we want both options to be shown.
This is related to #5436 and #3833.
Unit tests
✅ All new business logic has unit-tests with 100% coverage.
Documentation
✅ There is extensive JavaDoc documentation, and a little bit of explaination on the new OTPFeature to enable this behaivour. OTP will work as before, if the feature is not enabled in config.
Changelog
✅ This is a minor improvment
Bumping the serialization version id
🟥 Not needed