Repository navigation
Fix transit egress costs and destination geometry in detailed itineraries - #607
Conversation
|
thanks, @e-kotov . I'll have a look into this ! |
|
Thanks a lot for this, @e-kotov — careful work, and the diagnosis is right. We traced both root causes in R5 (the reverse branch of Benchmark on our sideMaster (3dd6eda) vs this PR (7ff878e), installed in separate libraries and run in separate R sessions (loaded JAR hashes match the ones you report). POA sample data, 25 × 25 hexgrid points (
Blocking: bicycle egress at the default
|
|
Hi @rafapereirabr, thanks for the review and for running the benchmarks! I've pushed the changes:
CI is green on all eight jobs: https://github.com/e-kotov/r5r/actions/runs/40311691843 Rounding: I rounded up on purpose, so the walk to the destination would never be underestimated. I've switched to truncation, as R5 does. One difference remains: R5 truncates the distance to whole metres first, and I don't. I haven't looked into how much of the remaining gap with EgressPath: I kept it as is. Using Audit: the results and old CI links are in the PR description, and the full scripts are in the history at 7ff878e. I've marked those results as historical, since the rounding has changed since. Happy to leave the upstream R5 issue to you. Once you share the link, I'll update the TODO in the code. |
|
thanks, @e-kotov ! this looks great ! |
|
PR to fix the issue upstream in live here conveyal/r5#1027 |
Additional walking-cost regression check
Test-only follow-up
22a55b5cadds a comparison of each known walking egress leg with a separate forward walk from its reported starting coordinate, plus the destination's off-street walking connection. Both calls explicitly usewalk_speed = 3.6(1 m/s); snap/route success is asserted and tolerance is 0.15 minutes. This is an approximate check for the two known POA fixtures, not a general equality rule across modes or cost models. It adds no production, bridge, helper, fixture or workflow changes.Fresh Actions run 40311691843 passed all eight jobs at
22a55b5c2f8997b2a84681857a29ed765a047f54. All six package checks report Status: OK; Java build and coverage also passed. The new 22 assertions passed across the full platform tests: Linux/macOS reportFAIL 0 | WARN 39 | SKIP 0 | PASS 2338, WindowsFAIL 0 | WARN 39 | SKIP 1 | PASS 2337. The existing 39 warnings and Windows Unix-only skip are unchanged.The bridge JAR is identical to the preceding implementation (
a4cf9a7560a57faa31ef89fc0f77376bc4dfd6def7b408600c21dcd63527cf7b); rebuilding produced the same hash. The separate mutation review motivated this addition; its mutation runs were not repeated in this Actions run. The validation below records the preceding implementation snapshot and retired historical audit.Summary
Fix the destination street leg in
detailed_itineraries()for both RAPTOR (fastest trip without fares, #603) and McRAPTOR (alternatives/fares), including FastRaptor searches shared across destinations.Reverse point-origin seeding in pinned R5 v7.6 pairs partial costs with the wrong endpoint, and
State.reverse()drops the initial partial-edge/off-street cost. This patch corrects the seeds and reconstructs the clipped terminal street plus the connection to the requested destination. Selection, limits and output use the same complete directed cost.Changes after maintainer review
Responding to Rafael's review:
setOrigin's convention. Partial cost still uses R5's average directed-edge adjustment; this is not the pointset base-speed model or exact integration of a clipped elevation profile.89a901291b7ffffat LTS2/4; actual transit reachability, destination endpoint, summed legs/waits and an adaptive tighter cutoff.The existing geometry reconstruction and its explicit directed/self-loop root validation remain. Reusing
StreetPathwould still require restoring root cost and appending the directed terminal partial; the reviewed explicit helper was retained instead of taking that optional rewrite.State.reverse()sums existing increments; it does not re-time edges.Earlier implementation validation
Fresh Actions run 40237179437 passed all eight current jobs at source commit
87e7e694b37a415c01980de183c4c5b00e6c3a74. Actions generated the bridge in193945b24e045f9ea23e0e6ee418a0175204a9e1, now pulled into the branch.FAIL 0 | WARN 39 | SKIP 0 | PASS 2316; WindowsFAIL 0 | WARN 39 | SKIP 1 | PASS 2315(one Unix-only test skipped). The warnings remain in unchanged scenario/progress/verbosity tests; they are not package-check warnings.a4cf9a7560a57faa31ef89fc0f77376bc4dfd6def7b408600c21dcd63527cf7b, matching the pulled artifact.The subsequent cleanup commit
0aeb6d5conly restoresbuild.gradlebyte-for-byte to master, removing its trailing-newline-only diff. Production sources, tests and the CI-built JAR are unchanged from the validated snapshot, so that cleanup skips duplicate CI.All builds and R/Java execution take place in Actions. This new run validates the revised implementation; the retired audit below is historical evidence.
Historical evidence (before this revision)
Run 40035176855 passed all nine then-present jobs against upstream
3dd6edaf, source5a76d1bf, CI bridgeacdd9c91. The native original behavior failed 14/16 physical assertions; the correction passed 51/51. Loaded bridge hashes and actual 4 GiB heaps were checked in isolated original/corrected installs.Both algorithms passed the same 300 paired POA ODs at 53/60/90/120 minutes: zero missing or worse lower-cutoff minima across six comparisons per algorithm, when the higher-cutoff minimum was at least 0.1 minute below the lower cutoff. Reachable pairs: McRAPTOR 162/195/274/292; RAPTOR 165/195/274/292. A threaded 2x2 grid had identical shared and paired FastRaptor output. The retired audit remains in the git history at
7ff878eband in that run's logs; it is no longer shipped as maintenance infrastructure.Minimum reported minutes at a 90-minute limit before the truncation change:
Original geometry missed the destination in all 7 checked egress legs; corrected directed partials/endpoints passed on 9 legs. The stronger corrected example was excluded at 60 minutes for both algorithms. Rafael independently benchmarked 625 pairs with walking/bicycle egress and fares in the linked review, confirming the root causes, destination geometry correction and approximately neutral performance, while identifying the LTS blocker addressed here.
The former upward rounding added at most 2 seconds per chosen seed relative to truncating the same cost components. That alone cannot explain a mean difference measured in minutes versus TTM. The partial-edge elevation/base-speed model remains different; exact decomposition of the reported offset is unmeasured.
Scope and remaining follow-ups
Only point-seeded transit egress in
detailed_itineraries()changes. The access/direct origin-geometry issue and other routing APIs are unchanged. The same-package adapter depends on R5 internals and needs review on engine upgrades; no package-version or R5-pin change is included.An upstream conveyal/r5 issue link is still needed. No matching issue was found in searches; the TODO currently links this review, where Rafael offered to file it. This revision does not file a new engine issue.
Car egress, scenarios, other real networks and exact clipped-elevation error remain unmeasured here. The historical 300-pair audit measures cutoff consistency on one POA date, not independent physical correctness of every path or prevalence across networks.