-
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
Fix arrive by filtering for on-street/flex itineraries #6050
Fix arrive by filtering for on-street/flex itineraries #6050
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #6050 +/- ##
=============================================
+ Coverage 69.84% 69.90% +0.05%
- Complexity 17463 17698 +235
=============================================
Files 1974 1996 +22
Lines 74606 75310 +704
Branches 7640 7705 +65
=============================================
+ Hits 52109 52644 +535
- Misses 19850 19995 +145
- Partials 2647 2671 +24 ☔ View full report in Codecov by Sentry. |
9571773
to
8cedfc9
Compare
This fixes the issues we were seeing with arriveBy, happy to see both flex direct and other flex+transit results in the same query. I'll take a look at the code now. |
I removed the enum |
.../opentripplanner/routing/algorithm/filterchain/filters/system/OutsideSearchWindowFilter.java
Outdated
Show resolved
Hide resolved
// arrive-by transit result are filtered by their departure time and whether they don't depart | ||
// after the end of the computed search window which is dependent on the heuristic's minimum | ||
// transit time. |
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.
This is slightly difficult to understand. Maybe use bullets for listing the criteria for filtering. Also, I'm a bit on the edge if this should belong here or on the javadoc for this method as this method doesn't really contain anything else.
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 converted it to Javadoc and tried to make it more understandable.
43509bf
to
7e2a181
Compare
02e481e
to
c61bdc5
Compare
@leonardehrenfried Did you find out if the direct flex is only produced in the first page - the same way as other direct street routes - found by AStar? I think the To fix this we need to know if the search-window was used by the search. The simplest way to do it(I think) is to add flag to the itinerary, f.eks There is another problem here as well. I took a look at the |
c61bdc5
to
8649d75
Compare
0e31b24
to
a7bd6bb
Compare
67a66f2
to
18eff27
Compare
I did a deep dive on this topic, refreshed my memory on how the paging works and added a few hints in the Javadoc about how the various parts of the paging logic work with each other. The good news is that the logic change in this PR works well for any direct itinerary that is not flex as they can always be timeshifted to the request time. Also, only the initial page creates a direct search so the other pages are not affected. For flex we do have a change of behaviour: the direct flex router also looks at the next day (previous for arriveBy) and potentially shows results that start a long time after the search time. When you mix flex with transit then the time window (although not used by the flex router) acts as a sort of sanity check to give you results not too far into the future. If we go ahead with this approach then more results like these would show up. Lets talk about it in the dev meeting. |
ff4bf13
to
36193fc
Compare
...org/opentripplanner/routing/algorithm/filterchain/filters/system/FlexSearchWindowFilter.java
Outdated
Show resolved
Hide resolved
…n/filters/system/FlexSearchWindowFilter.java Co-authored-by: Thomas Gran <[email protected]>
Add comment Add comment
645a7e0
to
483a04f
Compare
doc/user/RouteRequest.md
Outdated
@@ -731,6 +732,19 @@ convenient when tuning the itinerary-filter-chain. | |||
moving to the next page. | |||
|
|||
|
|||
<h3 id="rd_if_filterDirectFlexByEarliestDeparture">filterDirectFlexByEarliestDeparture</h3> |
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.
filterDirectFlexByEarliestDepartureTime ?
Is this still correct?
if (it.isDirectFlex() && sortOrder.isSortedByDescendingDepartureTime()) { | ||
// arive by | ||
var time = it.startTime().toInstant(); | ||
return time.isBefore(earliestDepartureTime); | ||
} else if (it.isDirectFlex() && sortOrder.isSortedByAscendingArrivalTime()) { | ||
// depart at | ||
var time = it.startTime().toInstant(); | ||
return time.isAfter(latestArrivalTime); | ||
} else { |
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 would prefer something like:
if (it.isDirectFlex() {
return switch(sortOrder) {
}
}
src/main/java/org/opentripplanner/standalone/config/routerequest/ItineraryFiltersConfig.java
Outdated
Show resolved
Hide resolved
...org/opentripplanner/routing/algorithm/filterchain/filters/system/FlexSearchWindowFilter.java
Outdated
Show resolved
Hide resolved
…n/filters/system/FlexSearchWindowFilter.java Co-authored-by: Thomas Gran <[email protected]>
...org/opentripplanner/routing/algorithm/filterchain/filters/system/FlexSearchWindowFilter.java
Outdated
Show resolved
Hide resolved
...org/opentripplanner/routing/algorithm/filterchain/filters/system/FlexSearchWindowFilter.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Thomas Gran <[email protected]>
Summary
It fixes a bug in the
OutsideSearchWindowFilter
where on street results that were shorter than transit would be removed even though they are often the best results.cc @daniel-heppner-ibigroup
Issue
Closes #6046
Unit tests
Added.
Documentation
Javadoc.