Access egress carpooling implementation#7428
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #7428 +/- ##
=============================================
- Coverage 71.36% 71.32% -0.05%
- Complexity 21067 21135 +68
=============================================
Files 2343 2357 +14
Lines 87055 87528 +473
Branches 8612 8663 +51
=============================================
+ Hits 62128 62426 +298
- Misses 21922 22090 +168
- Partials 3005 3012 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fc2af08 to
31e0acd
Compare
…etRouter in carpooling module, and implemented access/egress for carpooling
31e0acd to
3efa617
Compare
arnljot
left a comment
There was a problem hiding this comment.
Mostly just camel case mistakes. Two of my comments are not request for changes but rather points if it should be improved or added.
| request.preferences().car().reluctance() | ||
| ) | ||
| ) | ||
| .toList(); |
There was a problem hiding this comment.
We should consider if this also should be limited like routeDirect()
.limit(DEFAULT_MAX_CARPOOL_DIRECT_RESULTS)
There was a problem hiding this comment.
This is related to the following conversation in the PR for the core changes that enabled this PR:
I gave the following answer:
As for stopCountLimit, this might be relevant for the computational complexity in later steps of the pipeline, since it limits the input size which the raptor algorithm has to work through. If too many access/egress results can cause problems there, we should include this variable. Note: it will cause loosing relevant results especially if we want the option of having very long carpooling access/egresses.
I say we don't put a limit of the number of results for now, but we might have to in the future.
| try (var temporaryVerticesContainer = new TemporaryVerticesContainer()) { | ||
| var streetVertexUtils = new StreetVertexUtils(this.vertexLinker, temporaryVerticesContainer); | ||
|
|
||
| var carPoolTreeVertexRouter = new CarpoolTreeStreetRouter(); |
There was a problem hiding this comment.
typo:
var carPoolTreeVertexRouter = new CarpoolTreeStreetRouter();
should be:
var carpoolTreeVertexRouter = new CarpoolTreeStreetRouter();
There was a problem hiding this comment.
changed as suggested
| 0 | ||
| ); | ||
|
|
||
| var nearByStops = streetNearbyStopFinder |
There was a problem hiding this comment.
typo, should be
var nearbyStops
There was a problem hiding this comment.
changed as suggested
| .filter(stop -> !(stop.stop instanceof AreaStop)) | ||
| .toList(); | ||
|
|
||
| var nearByStopsWithVertices = new HashMap<NearbyStop, Vertex>(); |
There was a problem hiding this comment.
same typo here
var nearbyStopsWithVertices
There was a problem hiding this comment.
changed as suggested
| .filter(Objects::nonNull) | ||
| .toList(); | ||
|
|
||
| // vertices have to be added to the carPoolTreeVertexRouter AFTER all vertices have been created |
There was a problem hiding this comment.
Lets consider if this two phase setup can be incapsulated inside the router or StreetVertexUtils. As now this limitation is only communicated in this comment. If it can't be incapsulated in the router or the util, then perhaps it can be grouped in it's own private method?
As it stands this constraint is easy to violate in future edits, however the code is well covered with tests so it might be left to this comment and current test coverage.
There was a problem hiding this comment.
This should no longer be an issue now. I have done the following changes:
- We no longer create temporary vertices for NearbyStops. This seemed to be necessary earlier, but everything works now by simply fetching the stop's vertex like this: stop.state.getVertex() .
- CarpoolTreeStreetRouter lazily creates SPTs and you can no longer add vertices after routing has started. This is both good for performance, and it makes sure that you cannot create SPTs which don't include all temporary vertices.
| private static final GeometryFactory GEOMETRY_FACTORY = new GeometryFactory(); | ||
|
|
||
| private static final int DEFAULT_AVAILABLE_SEATS = 2; | ||
| private static final int DEFAULT_AVAILABLE_SEATS = 5; |
There was a problem hiding this comment.
Mention this in PR description, it's unrelated to the access egress change, but good and too trivial to address in a separate change.
There was a problem hiding this comment.
I have added a comment about it in the PR description
| GenericLocation to, | ||
| LinkingContext linkingContext | ||
| ); | ||
| public interface CarpoolRouter { |
There was a problem hiding this comment.
Very smooth change, good domain oriented improvement
|
@eibakke and @hakoncarlsen - I've looked over the change and it looks good to me, nothing needs change except the camel case mistakes. Then the two other comments can be disregarded if Håkon chooses to. |
5c0e89e to
0e45178
Compare
…ating temporary vertices for nearbyStops in routeAccessEgress in DefaultCarpoolingService
0e45178 to
6f06598
Compare
eibakke
left a comment
There was a problem hiding this comment.
Mostly looks good, just a comment about the filter interface duplication.
… class TripFilter instead
leonardehrenfried
left a comment
There was a problem hiding this comment.
This PR adheres to the sandbox contract.
Summary
Implementation of the function routeAccessEgress in DefaultCarpoolingService.
Issue
Notes:
Closes #45
Unit tests
Write a few words on how the new code is tested.
Were unit tests added/updated?
There are added unit tests for the new router CarpoolTreeStreetRouter and the utility class StreetVertexUtils, and integration tests for both the routeDirect and routeAccessEgress functions of DefaultCarpoolingservice.
Was any manual verification done?
Yes, both routeDirect and routeAccessEgress works when running OTP locally.
Documentation
Yes
Yes
No