Add implementation code for all 4 improvement plan phases

Production changes:
- TravelEstimator: remove 300mi fallback, return nil on missing coords
- TripPlanningEngine: add warnings array, empty sports warning, inverted
  date range rejection, must-stop filter, segment validation gate
- GameDAGRouter: add routePreference parameter with preference-aware
  bucket ordering and sorting in selectDiverseRoutes()
- ScenarioA-E: pass routePreference through to GameDAGRouter
- ScenarioA: track games with missing stadium data
- ScenarioE: add region filtering for home games
- TravelSegment: add requiresOvernightStop and travelDays() helpers

Test changes:
- GameDAGRouterTests: +252 lines for route preference verification
- TripPlanningEngineTests: +153 lines for segment validation, date range,
  empty sports
- ScenarioEPlannerTests: +119 lines for region filter tests
- TravelEstimatorTests: remove obsolete fallback distance tests
- ItineraryBuilderTests: update nil-coords test expectation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Trey T
2026-03-21 09:40:32 -05:00
parent db6ab2f923
commit 6cbcef47ae
14 changed files with 807 additions and 88 deletions

View File

@@ -163,6 +163,7 @@ final class ScenarioBPlanner: ScenarioPlanner {
stadiums: request.stadiums,
anchorGameIds: anchorGameIds,
allowRepeatCities: request.preferences.allowRepeatCities,
routePreference: request.preferences.routePreference,
stopBuilder: buildStops
)
validRoutes.append(contentsOf: globalRoutes)
@@ -172,7 +173,8 @@ final class ScenarioBPlanner: ScenarioPlanner {
games: gamesInRange,
stadiums: request.stadiums,
anchorGameIds: anchorGameIds,
allowRepeatCities: request.preferences.allowRepeatCities
allowRepeatCities: request.preferences.allowRepeatCities,
routePreference: request.preferences.routePreference
)
validRoutes.append(contentsOf: regionalRoutes)
@@ -437,7 +439,8 @@ final class ScenarioBPlanner: ScenarioPlanner {
games: [Game],
stadiums: [String: Stadium],
anchorGameIds: Set<String>,
allowRepeatCities: Bool
allowRepeatCities: Bool,
routePreference: RoutePreference = .balanced
) -> [[Game]] {
// First, determine which region(s) the anchor games are in
var anchorRegions = Set<Region>()
@@ -482,6 +485,7 @@ final class ScenarioBPlanner: ScenarioPlanner {
stadiums: stadiums,
anchorGameIds: regionAnchorIds,
allowRepeatCities: allowRepeatCities,
routePreference: routePreference,
stopBuilder: buildStops
)