Skip to content

Commit 6287243

Browse files
Copilotsteffenaxer
andauthored
Address review: remove redundant phase check, document ALT estimation variables
Agent-Logs-Url: https://github.com/steffenaxer/matsim-libs/sessions/b1cbd2a4-34d0-4967-9e33-d5d221f864be Co-authored-by: steffenaxer <26229392+steffenaxer@users.noreply.github.com>
1 parent 73a6f04 commit 6287243

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

matsim/src/main/java/org/matsim/core/router/speedy/CHQueryExporter.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -592,15 +592,23 @@ private static SpeedyALTQueryResult runInstrumentedSpeedyALT(SpeedyGraph graph,
592592
}
593593

594594
/**
595-
* ALT lower-bound estimation: max over all landmarks of (SL-TL) and (LT-LS).
595+
* ALT lower-bound estimation: max over all landmarks L of (SL−TL) and (LT−LS),
596+
* where S=source, T=target.
597+
* <ul>
598+
* <li>sl = cost(source → landmark L)</li>
599+
* <li>ls = cost(landmark L → source)</li>
600+
* <li>tl = cost(target → landmark L)</li>
601+
* <li>lt = cost(landmark L → target)</li>
602+
* </ul>
603+
* By the triangle inequality: ST ≥ SL−TL and ST ≥ LT−LS.
596604
*/
597605
private static double estimateMinCost(SpeedyALTData altData, int nodeIdx, int destinationIdx) {
598606
double best = 0;
599607
for (int i = 0, nL = altData.getLandmarksCount(); i < nL; i++) {
600-
double sl = altData.getTravelCostToLandmark(nodeIdx, i);
601-
double ls = altData.getTravelCostFromLandmark(nodeIdx, i);
602-
double tl = altData.getTravelCostToLandmark(destinationIdx, i);
603-
double lt = altData.getTravelCostFromLandmark(destinationIdx, i);
608+
double sl = altData.getTravelCostToLandmark(nodeIdx, i); // source → L
609+
double ls = altData.getTravelCostFromLandmark(nodeIdx, i); // L → source
610+
double tl = altData.getTravelCostToLandmark(destinationIdx, i); // target → L
611+
double lt = altData.getTravelCostFromLandmark(destinationIdx, i); // L → target
604612
double estimate = Math.max(sl - tl, lt - ls);
605613
if (estimate > best) best = estimate;
606614
}

matsim/tools/ch-viz/ch-visualization.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ <h2>Search Space Comparison</h2>
10401040
}
10411041

10421042
// After 2 seconds of showing the path, display final overlay
1043-
if (phase === 1 && pathRevealStart > 0 && Date.now() - pathRevealStart > 2000 && phase < 2) {
1043+
if (phase === 1 && pathRevealStart > 0 && Date.now() - pathRevealStart > 2000) {
10441044
phase = 2;
10451045
showFinalOverlay();
10461046
// Keep recording for 3 more seconds to capture the final overlay

0 commit comments

Comments
 (0)