Skip to content

Metro generator: turn-aware line paths, and an exact search for small metros - #37

Merged
dgoodenough merged 2 commits into
mainfrom
claude/vigilant-knuth-loxal2
Nov 12, 2026
Merged

dgoodenough merged 2 commits into
mainfrom
claude/vigilant-knuth-loxal2

Conversation

@dgoodenough

Copy link
Copy Markdown
Owner

These are the last two deferred items from Texas Transit's second session (item 12).

  • Turn-aware line paths (candidates._search_turns, lines.turn_pen_km):
    • What it does: an edge-based search through the center links, where the search state is a center plus the one before it. It never makes a turn sharper than max_turn_deg, and it adds a cost for every turn. Its best path is offered beside the shortest one, so a pair of centers whose shortest path bends too sharply still gets a smooth line.
    • Why it's off by default: it was tested at 1.5 km per 90° turn on Austin, El Paso, the Rio Grande Valley, Corpus Christi and College Station. Austin gets 8% more candidate paths, but no metro gets a better network: Austin's planner score is 483,943 with it and 484,135 without.
  • Exact search (Planner.exact, selection.plan.exact_max_evals 4096):
    • What it does: when the planner's candidate lines make at most that many networks within 1.5× the budget, every network is evaluated on the full model after the local search, and the best one is kept. The result goes in the report.
    • Effect on the test metros:
      • Rio Grande Valley: 1,024 networks; it beats the local search by J +95 (one line swapped for another).
      • Corpus Christi and College Station: 8 networks each; the local search's network was already the best.
      • El Paso (16 lines) and the larger metros: too many networks, so the local search's result stands.

Tests: 23 pass in tests/test_metro_generate.py. They include a pair of lines worth nothing alone and a lot together, which only the exact search finds.


Generated by Claude Code

…ll metros

Line paths through the center links are also searched edge-based (the state is a center and the one before it): turns over max_turn_deg are never taken and each turn costs lines.turn_pen_km x (turn/90)^2 km, so a pair whose shortest path bends too sharply still gets its best smooth path, beside its shortest one.

Where the planner's pool makes at most selection.plan.exact_max_evals networks within 1.5 x the money (the small metros), every one is evaluated on the full model after the local search, and the optimum kept (Planner.exact), with the result in the report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GsUvo7SNZomvEVjWUMuYvF
…r network

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GsUvo7SNZomvEVjWUMuYvF
@dgoodenough
dgoodenough merged commit b642a59 into main Nov 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants