-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Change elevator cost calculation, add reluctance for elevators, and deprecate elevatorHopCost
#7111
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
base: dev-2.x
Are you sure you want to change the base?
Change elevator cost calculation, add reluctance for elevators, and deprecate elevatorHopCost
#7111
Conversation
|
Is there a transmodel GraphQL API label? |
|
This PR would remove the |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #7111 +/- ##
=============================================
+ Coverage 72.06% 72.11% +0.04%
- Complexity 20681 20702 +21
=============================================
Files 2238 2245 +7
Lines 83672 83931 +259
Branches 8348 8348
=============================================
+ Hits 60297 60523 +226
- Misses 20451 20483 +32
- Partials 2924 2925 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
We would like to make this configurable client-side with the GTFS API, so that we can add a preference of "avoid elevators", thanks. |
|
I updated the description to describe the changes in more detail. If my argument for adding the reluctance value is not supported by other OTP developers I'll close this PR and create another one for changing the default values of |
|
I will review the design, and answer the question about the Transmodel API |
application/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql
Show resolved
Hide resolved
|
My suggestions,
Choosing between alt. A and B depend on if we regard the I think the above suggestion is inline with the rest of the code. The terms |
I think you are missing
I think you also meant
I'm in favor of option A. Should we create a separate config object for elevatorpreferences? What I mean is that instead of having |
|
I discussed this with @t2gran and came to the conclusion that we should do |
…= boardCost + reluctance * elevator-total-time'.
elevatorReluctance and remove elevatorBoardCost and elevatorHopCostreluctance for elevators, and deprecate elevatorHopCost
|
This is ready for review now |
| GraphQLFieldDefinition.newFieldDefinition() | ||
| .name("elevatorBoardSlack") | ||
| .description("How long it takes to get on an elevator, on average.") | ||
| .type(Scalars.GraphQLInt) |
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.
Do we have a duration type in the API? I would prefer it rather than the number of seconds (which these presumably are, but not documented.)
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.
All time related fields in this file seem to be using the type Scalars.GraphQLInt. Another option would be to not add this to the API at all, it can be added later on if someone needs it
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 removed elevatorBoardSlack from the API and removed the deprecation from elevatorBoardTime
| // | ||
| // X ElevatorHopVertex | ||
| // --- ElevatorHopEdge | ||
| double time = request.elevator().hopTime().toSeconds() * this.levels; |
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.
Please add test cases in ElevatorHopEdge for the various cases:
- fixed travel time
- travel time from config
- ...
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.
Sorry, I meant ElevatorHopEdge.
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 improved the tests, was it what you meant?
leonardehrenfried
left a comment
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 looks already quite good but I have two comments.
Summary
Elevator preferences had separate cost fields previously. This is different compared to the reluctance value used in other preferences. Elevators should not be automatically preferred over reluctance-using options, e.g. stairs and escalators. Setting the costs separately is tedious and having some kind of default reluctance seems like a good thing to add. Adding a default reluctance of 2.0 makes the routing a bit better.
The chosen solution
What this PR does?
elevatorReluctanceand removeelevatorBoardCostandelevatorHopCostelevatorBoardTime,elevatorHopTime, andelevatorReluctanceamountOfLevelsTraveled * elevatorHopCostOR
travelTime (for specific elevator from OSM)elevatorReluctance * amountOfLevelsTraveled * elevatorHopTimeOR
elevatorReluctance * travelTime (for specific elevator from OSM)elevatorBoardCostelevatorReluctance * elevatorBoardTimeReasoning behind change
Favoring elevators over stairs or escalators can be bad if everyone is routed through elevators. When everyone uses the same elevator, wait times increase. The throughput is not as good as stairs or escalators. However, elevators should not be penalized too much because it should still make sense to use them in some cases. Setting the default value for the elevator reluctance to 2.0 puts it a bit above the default value for escalators (1.5) and equal to the default reluctance value for stairs in walk preferences.
A simpler version of this PR would simply increase the default values for
elevatorBoardCostandelevatorHopCost. However, since escalators and stairs use a reluctance value, I think elevators should too. Comparing reluctances is easier than comparing reluctances and constant values.In my opinion, the board cost/wait cost for transit is different than the board cost for elevators. For elevators, the competition is stairs, sloped streets, and escalators. For transit the competition is other transit, walking, cycling, waiting for transit, and the hassle of changing transit vehicles.
The more relevant metric for elevators is the total time taken by the elevator journey, not an individual board cost (the underlying hop times and board times can still be changed). This total time of the elevator journey then competes with the other options. Having one elevator reluctance value for the total time taken makes setting the ratios between the competition simpler.
Issue
Related to #6829
Unit tests
Changed existing tests because of new way of calculating elevator cost.
Documentation
Router config field added with short description.