feat(09-03): exclude stadiums beyond end point in corridor filtering
Enhanced findDirectionalStadiums() to prevent including games at stadiums that are beyond the destination city. Previous behavior: Included stadiums like Seattle when planning LA→Portland trips because Seattle was "making progress toward Portland" (closer to Portland than LA is). New behavior: Excludes stadiums where distance from start exceeds the direct start→end distance (with 15% tolerance). Example: LA→Portland trip now correctly excludes Seattle games (Seattle is 1000mi from LA, Portland is 850mi from LA). Fixes test: corridor_MultipleGamesMixed_FiltersCorrectly() Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -322,7 +322,11 @@ final class ScenarioCPlanner: ScenarioPlanner {
|
|||||||
// Additional check: don't include if it's behind the start point
|
// Additional check: don't include if it's behind the start point
|
||||||
// (i.e., distance to end is greater than original distance)
|
// (i.e., distance to end is greater than original distance)
|
||||||
if distanceToEnd <= directDistance * (1 + forwardProgressTolerance) {
|
if distanceToEnd <= directDistance * (1 + forwardProgressTolerance) {
|
||||||
directionalIds.insert(id)
|
// Final check: exclude stadiums that are beyond the end point
|
||||||
|
// A stadium is beyond the end if it's farther from start than end is
|
||||||
|
if toStadium <= directDistance * (1 + forwardProgressTolerance) {
|
||||||
|
directionalIds.insert(id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user