到着時間推定の駅間距離に線路の長さを使い、速度の較正をその距離で求め直した - #1712
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Essentials Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (14)
Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour. 📝 WalkthroughWalkthrough到着時間推定と較正処理に駅間の線路距離を追加しました。 Changes線路距離を用いた到着時間推定と Legacy 較正
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~60 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant Query as query::track_distances_of
participant TrackIndex as index::track_distance
participant Estimator as estimate_arrival_minutes_with_track
Query->>TrackIndex: 駅間の線路距離を取得
TrackIndex-->>Query: 駅間距離を返す
Query->>Estimator: TrackDistancesを渡す
Estimator-->>Query: 推定停車時刻を返す
Merge Risk: ⚪ Minimal · up to No actionable blocker is established for the track-distance and frozen Legacy calibration changes. The extra endpoint lookup does not change estimates; merging remains subject to normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 49 functions across 10 files. (4 skipped: 4 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
うさぎは線路の距離をたどる Comment |
概要
到着時間推定と乗換経路探索で、駅間の距離に線路の長さ(
connections)を使うようにしました。速度の較正は、この距離で求め直しました。これまでの推定は、駅間の距離を「直線距離 × 迂回係数」で見積もっていました。線路の長さは #1704 で返せるようになっていましたが、推定には使っていませんでした。所要時間のベンチマーク(#1711)で全体を測ると、典型的な所要時間からのずれの平均は 5.71% から 4.71% に下がりました。
オートモード(
trainRouteのLegacy)が使う値は変えていません。求め直す前の較正を、別の表に凍結しました。変更の種類
変更内容
arrival_estimation.rs・query.rs)estimate_arrival_minutes_with_trackを足しました。線路の長さがある駅間はそれを走行距離に使い、無い駅間(または 0 以下の値)だけ、従来どおり直線距離 × 迂回係数で見積もります。estimateArrivalTimes・trainRouteのEstimated・乗換経路の見込みで、系統の隣り合う駅の組の線路の長さを引いて渡します。環状線では、継ぎ目の組(末尾→先頭)も含めます。route_search.rs・src/repository.rs)RouteNetwork::build_with_trackを足し、Worker の経路網は線路の長さで組み立てます。connectedRoutesの乗車時間と、同じ経路の到着の見込みが同じ距離になります。legacy_speed_table.rs・simulation.rs・query.rs)legacy_speed_table.rsに写し、Legacyはこちらを引きます。MobileApp のオートモードが走らせる値は変わりません。speed_table.rs・segment_speed_table.rs・compute_speed_table.py)compute_speed_table.pyの駅間の距離も線路の長さにしました。generated/connections.csvを読むので、先にmake dataが必要です。GTFS からの自動較正の2つの表は、この距離で生成し直しました。20260815のものに変えました。以前の URL は 404 を返していました。travel_times/)baseline.csv)を更新しました。AGENTS.md・docs/architecture.md・scripts/README.mdに、推定が線路の長さを使うこと、Legacyが凍結した表を使うこと、較正スクリプトにmake dataが要ることを書きました。README.mdの「Data Sources」に、りんかい線と多摩都市モノレールの GTFS の出典を足しました。手動の較正
距離が直線 × 迂回係数だった頃の手動の値は、距離の水増しを速度で打ち消していました。そのまま線路の長さに替えると、スカイライナーは 42.1 分から 34.0 分に、小田急の快速急行は 32.8 分から 26.7 分に縮みます。一方、手動の値を外して一般則にすると、スカイライナーは 48.1 分(典型 41 分)まで遅くなります。そのため、外すのではなく求め直しました。
ベンチマークのレポート(変更前後)
変更前はステージング、変更後はこのブランチを
make data && make devで起動した Worker に向けて、make travel-time-reportで測りました。21 件: 典型からのずれ(絶対値)の平均 5.71% → 4.71%、範囲からの外れの平均 2.07% → 1.75%
残っている大きなずれ(この PR では直していません)
テスト
make fmtが通ることmake clippyが通ること(wasm32 ターゲットを含む)make testが通ることcargo fmt --all -- --check、make clippy、make check、make testを実行し、すべて成功しました(stationapi 443 件、stationapi-worker 28 件ほか、失敗なし)。make testは、generated/がある状態とdata/*.csvだけの状態の両方で通しています。オートモードの値が変わっていないことも確かめました。
trainRoute(Legacy)の区間の値(停車・通過、直線距離、最高速度、加減速)を本番とこのブランチで比べ、手動の較正を変えた系統(総武快速 40、スカイライナー 197、京急快特 74、小田急快速急行 129、つくばエクスプレス 977)で一致しました。関連Issue
Refs #1704, #1711
スクリーンショット(任意)
🤖 Generated with Claude Code
Summary by CodeRabbit