Skip to content

Conversation

@miklcct
Copy link
Contributor

@miklcct miklcct commented Aug 6, 2025

Summary

This adjusts the safest street routing to exaggerate the use of safest streets.

This is based on #6782 as the correct heuristics depends on if the normalizer is removed.

Issue

None yet.

The problem here is that, in the original code, safest street has a negligible difference to safe street routing, unless elevation is involved. The original exaggeration code to exaggerate safety factor of < 0.1 does not really happen in practice, as most safe streets (greenways) are around 0.3 to 0.6, and it never happens before the normalizer was removed.

Therefore, I am adjusting it so the safety values used for safest street routing is the original safety squared times 2, and extracted to a helper method. The effect is that, neutral streets will be avoided, dangerous streets will be avoided at all costs, slightly safe streets (about 0.7) will appear neutral, and very safe streets will be safe.

Unit tests

Added

Documentation

N/A

Changelog

N/A

Bumping the serialization version id

N/A

@codecov
Copy link

codecov bot commented Aug 6, 2025

Codecov Report

❌ Patch coverage is 80.00000% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.04%. Comparing base (bf2b9ac) to head (3274de5).

Files with missing lines Patch % Lines
...r/graph_builder/module/osm/SafetyValueApplier.java 72.72% 9 Missing and 6 partials ⚠️
...ch/strategy/EuclideanRemainingWeightHeuristic.java 78.00% 9 Missing and 2 partials ⚠️
...er/ext/carpooling/routing/CarpoolStreetRouter.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6785      +/-   ##
=============================================
- Coverage      72.05%   72.04%   -0.01%     
- Complexity     20644    20651       +7     
=============================================
  Files           2231     2232       +1     
  Lines          83543    83567      +24     
  Branches        8346     8338       -8     
=============================================
+ Hits           60198    60207       +9     
- Misses         20420    20434      +14     
- Partials        2925     2926       +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.

@t2gran t2gran added this to the 2.8 (next release) milestone Aug 11, 2025
# Conflicts:
#	application/src/main/java/org/opentripplanner/graph_builder/module/osm/OsmModule.java
#	application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/ElevationSnapshotTest.snap
# Conflicts:
#	application/src/main/java/org/opentripplanner/street/search/strategy/EuclideanRemainingWeightHeuristic.java
# Conflicts:
#	application/src/main/java/org/opentripplanner/graph_builder/module/osm/SafetyValueNormalizer.java
#	application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/ElevationSnapshotTest.snap
@t2gran t2gran modified the milestones: 2.8, 2.9 (next release) Sep 10, 2025
# Conflicts:
#	application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/ElevationSnapshotTest.snap
# Conflicts:
#	application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/DirectStreetRouter.java
#	application/src/main/java/org/opentripplanner/routing/impl/GraphPathFinder.java
#	application/src/test/java/org/opentripplanner/astar/AStarTest.java
#	application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/BikeRentalSnapshotTest.snap
#	application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/ElevationSnapshotTest.snap
#	application/src/test/java/org/opentripplanner/street/integration/BikeRentalTest.java
# Conflicts:
#	application/src/main/java/org/opentripplanner/graph_builder/module/osm/OsmModule.java
#	application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/BikeRentalSnapshotTest.snap
#	application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/ElevationSnapshotTest.snap
# Conflicts:
#	application/src/main/java/org/opentripplanner/graph_builder/module/osm/OsmModule.java
#	application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/DirectStreetRouter.java
#	application/src/main/java/org/opentripplanner/routing/impl/GraphPathFinder.java
#	application/src/main/java/org/opentripplanner/street/model/StreetModelDetails.java
#	application/src/main/java/org/opentripplanner/street/service/StreetLimitationParametersService.java
#	application/src/test/java/org/opentripplanner/ConstantsForTests.java
# Conflicts:
#	application/src/main/java/org/opentripplanner/graph_builder/module/osm/OsmModule.java
#	application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/router/street/DirectStreetRouter.java
#	application/src/main/java/org/opentripplanner/routing/impl/GraphPathFinder.java
#	application/src/main/java/org/opentripplanner/street/model/StreetModelDetails.java
#	application/src/main/java/org/opentripplanner/street/service/StreetLimitationParametersService.java
#	application/src/test/java/org/opentripplanner/ConstantsForTests.java
# Conflicts:
#	application/src/main/java/org/opentripplanner/graph_builder/module/osm/SafetyValueNormalizer.java
#	application/src/test/java/org/opentripplanner/street/model/_data/SimpleConcreteEdge.java
# Conflicts:
#	application/src/main/java/org/opentripplanner/street/model/edge/StreetEdge.java
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.

2 participants