-
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
Bike rental edge split refactor #2791
Bike rental edge split refactor #2791
Conversation
- rename SimpleStreetSplitter to StreetSplitter as it is the only StreetSplitter in use - add some checks to make sure duplicate indexing doesn't occur on the same graph - refactor some areas where duplicate indexing was occurring
The testing is a work in progress Refs opentripplanner#2787
…tialStreetEdge class
I think this is a great PR that is useful for our needs in Columbus. We experienced a problem using it that is actually related to a deeper issue. You can see below that we had a bug where a path sometimes has an extra appendage on the initial edge. Here, it goes right through a building footprint. I figured this had something to do with integer offsets (compacted geometry form) being relative to the wrong vertex after the temporary origin edge split. If you specify that you want destructive splitting, the StreetEdge constructor will inherit its "back" (reversed direction) property from the parent edge:
The
This is okay for destructive splits, but redundant. However it introduces an error when this function is called on Temporary or SemiPermanent edges. When these edges are constructed, they always pass When I delete the The current code for My second proposed change (besides removing the
Finally, to eliminate this form of bug (in lieu of a new test), I also propose that we get rid of the Thanks @evansiroky! |
Thanks, @jwoyame, for looking at this. I'll have to try out your recommended changes at some point. |
Thanks again @jwoyame for the comments. You definitely identified the cause of the problem and recommended a good solution. I have implemented most of your changes into this PR, but did not opt for removing the |
The street splitter has been refactored in OTP2 where the original edge is restored when the rental vehicle is no longer there. Also, there hasn't been any development on the 1.5 branch for a few years. Therefore I'm closing this issue. If that was a mistake, please re-open. |
To be completed by pull request submitter:
closes #45
).To be completed by @opentripplanner/plc:
This PR refactors the way that StreetEdges are handled in order to properly insert and remove bike/car/vehicle rentals.
This PR is built on top of #2762 which should be reviewed, approved and merged first.
Motivation and problem description
In the latest work for TriMet, we added in the ability to plan trips with eScooter rentals in the Porltand, OR area. We were running the graph with a total of 9 rental updaters: 1 bicycle rental operator, 2 car rental operators and 6 eScooter rental operators. Hundreds of vehicles were in operation at any point in time and all of these companies had rental vehicles concentrated in the downtown Portland area. At times there could be a dozen or more vehicles on a particular street corner. See this example:
The implementation of connecting the vehicle rentals to the graph prior to this PR was as follows:
Before insertion of bike/car/vehicle rental:
After insertion of bike/car/vehicle rental:
This one insertion may seem harmless, but it caused numerous problems:
Perhaps the worst thing about the original implementation, however, was that the split edges were never unsplit once the rental station disappeared from the updater data. Therefore, there was a constant accumulation of unneeded StreetEdges that would stay in the graph forever. As noted in #2787, this ultimately resulted in requiring to reboot OTP every-so-often so it wouldn't grind to a halt.
Sample trip plan with a fresh start of OTP
Sample trip plan with an OTP instance running for a few days
Proposed solution
As was seen with the original implementation, the first priority was to actually remove the vertices and edges that were no longer needed from the graph. However, this would involve a very complex analysis of which edges were split and how to rejoin edges. For example, if one vehicle initially split an edge and then another vehicle split the resulting edge and the first vehicle then needed to be removed, there would have to be an analysis of what edges there currently were that could be rejoined and the resulting distance and elevation recalculations would likely lose or have substantially changed information. Furthermore, there would still be the matter of increased turn costs and many more edges required to be traversed for what used to be one edge.
So, the implementation I am proposing here is to create semi-permanent edges and vertices that are dedicated to a specific rental station. See the following diagram of the new implementation:
This implementation does result in 2 more edges being created than merely splitting edges in two. However, every other original problem is solved by doing so:
Furthermore, this added approach has even more benefits:
Related issues
This PR fixes #2787
This PR basically makes #2790 a non-issue. Comments have been added to the code regarding this.