-
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
base: dev-2.x
Are you sure you want to change the base?
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.82% 69.87% +0.05%
- Complexity 17419 17445 +26
=============================================
Files 1974 1975 +1
Lines 74545 74576 +31
Branches 7633 7634 +1
=============================================
+ Hits 52048 52112 +64
+ Misses 19847 19815 -32
+ Partials 2650 2649 -1 ☔ 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 top, 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
32ee0be
to
d37c51c
Compare
I reworked the implementation according to our last discussion in the dev meeting and it's now ready for review again. |
private List<Leg> legs; | ||
|
||
private ItineraryFares fare = ItineraryFares.empty(); | ||
|
||
public Itinerary(List<Leg> legs) { | ||
public Itinerary(List<Leg> legs, boolean isSearchWindowAware) { |
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 boolean argument is hard to guess/read. One way to get around it, is to use factory methods:
Make the constructor private and create two factory methods, maybe: Itinerary.createScheduledTransitItinerary(legs)
and Itinerary.createDirectItinerary(legs)
. This will hide the flag searchWindowAware
from the producers (they do not care) and make it an itinerary thing. The coupling between the producer and the flag also become clear and safe - there is less room for setting it wrong. If you want you can create a separate factory method for flex e.g. createTransitItinerary
, createDirectFlexItinerary
and createDirectStreetItinerary
. The last two would have the same implementation, but they are easy to use - less room for mistakes.
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.
7ce50b9
to
0538587
Compare
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.
Looks good, some minor stuff left.
src/test/java/org/opentripplanner/routing/stoptimes/AlternativeLegsTest.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opentripplanner/routing/api/request/RouteRequest.java
Outdated
Show resolved
Hide resolved
...org/opentripplanner/routing/algorithm/filterchain/filters/system/FlexSearchWindowFilter.java
Outdated
Show resolved
Hide resolved
...org/opentripplanner/routing/algorithm/filterchain/filters/system/FlexSearchWindowFilter.java
Show resolved
Hide resolved
Co-authored-by: Thomas Gran <[email protected]>
304862a
to
15faf80
Compare
da2a72d
to
744017f
Compare
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.