Skip to content

Conversation

miklcct
Copy link
Contributor

@miklcct miklcct commented Aug 6, 2025

Summary

This change stairs reluctance and turn reluctance to be applied on top of the reluctance for the street mode, rather than replace it.

Issue

None yet, but related to #6662 . It will be more user-friendly to say "avoiding stairs" is compared to walking on flat ground, rather than compared to taking transit.

For turns, the original code was incorrect as the time taken on foot / bike / car in turns were not affected by the car / bike / walk reluctance set, which this PR corrects it.

Unit tests

updated

Documentation

N/A

Changelog

N/A

Bumping the serialization version id

Not needed

@miklcct miklcct force-pushed the multiplicative-stairs-and-turn-reluctance branch from fb933c4 to 4c16517 Compare August 6, 2025 10:55
Copy link

codecov bot commented Aug 6, 2025

Codecov Report

❌ Patch coverage is 88.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.99%. Comparing base (60e71c9) to head (d41495e).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...eet/model/edge/StreetEdgeReluctanceCalculator.java 80.00% 1 Missing and 1 partial ⚠️
.../opentripplanner/street/model/edge/StreetEdge.java 91.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             dev-2.x    #6783   +/-   ##
==========================================
  Coverage      71.99%   71.99%           
- Complexity     19432    19437    +5     
==========================================
  Files           2100     2100           
  Lines          78748    78759   +11     
  Branches        7961     7963    +2     
==========================================
+ Hits           56697    56705    +8     
- Misses         19245    19247    +2     
- Partials        2806     2807    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@miklcct miklcct marked this pull request as ready for review August 6, 2025 11:07
@miklcct miklcct requested a review from a team as a code owner August 6, 2025 11:07
@t2gran
Copy link
Member

t2gran commented Aug 11, 2025

@miklcct I changed transport mode to street mode in the description - I hope that is correct?

This fixes the #6662 as fare as I understand? If not, what is it that is not fixed @leonardehrenfried / @miklcct ?

@t2gran t2gran added this to the 2.8 (next release) milestone Aug 11, 2025
@miklcct
Copy link
Contributor Author

miklcct commented Aug 11, 2025

@miklcct I changed transport mode to street mode in the description - I hope that is correct?

This fixes the #6662 as fare as I understand? If not, what is it that is not fixed @leonardehrenfried / @miklcct ?

Thanks for your correction. To completely fix #6662 a new input on the GTFS GraphQL API may also be required as well.

@optionsome optionsome self-requested a review August 12, 2025 09:22
@@ -117,7 +117,9 @@ private GraphQLObjectType createGraphQLType() {
.field(
GraphQLFieldDefinition.newFieldDefinition()
.name("stairsReluctance")
.description("Used instead of walkReluctance for stairs.")
.description(
"A multiplier to specify how bad walking on stairs is, compared to walking on flat ground."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should clarify that this is used in addition to the walk reluctance.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is still unchanged.

# Conflicts:
#	application/src/main/java/org/opentripplanner/street/model/edge/StreetEdge.java
#	application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/ElevationSnapshotTest.snap
#	application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/TransitSnapshotTest.snap
#	application/src/test/resources/speedtest/travelSearch-expected-results-mc.csv
#	application/src/test/resources/speedtest/travelSearch-expected-results-md.csv
#	application/src/test/resources/speedtest/travelSearch-expected-results-sr.csv
optionsome
optionsome previously approved these changes Aug 26, 2025
@optionsome
Copy link
Member

There is a conflict.

# Conflicts:
#	application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/ElevationSnapshotTest.snap
time_ms += (long) Math.ceil(1000.0 * turnDuration);
weight += preferences.street().turnReluctance() * turnDuration;
weight += preferences.street().turnReluctance() * modeReluctance * turnDuration;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we do (turn reluctance + mode reluctance) * turn duration instead? We have had issues in the past the reluctance becomes supra linear. Same for the stairs reluctance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, reluctance is a factor. They can't be added together.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I made a mistake so (turn reluctance + mode reluctance - 1) * turn duration would be more correct, but we can discuss this in another meeting.

Copy link
Contributor Author

@miklcct miklcct Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work mathematically as well. For example, put turn reluctance as 0.5 and mode reluctance as 0.2, it will result in a negative number.

@t2gran t2gran modified the milestones: 2.8, 2.9 (next release) Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants