Document routing between placed crossings and archive development records

This commit is contained in:
Jan Petykiewicz 2026-11-26 21:37:05 -08:00
commit 2c260e5e95
17 changed files with 161 additions and 102 deletions

View file

@ -0,0 +1,9 @@
# Routing development archive
Historical plans, run captures, and raw measurements live here. For current workflows, start with the [developer guide](../../docs/development.md) or [benchmarks](../../docs/benchmarks.md).
- **Plans.** [Original routing goal](routing-policy-goal.md), [routing refactor plan](routing-refactor-plan.md), and [documentation improvement plan](documentation-improvement-plan.md).
- **Performance records.** [Example baseline](performance.md) and its [JSON](performance_baseline.json), [optimization log](optimization_pass_01_log.md), and [pair-local characterization](pair_local_characterization.md).
- **Recorded diagnostics.** [Iteration](iteration_trace.md), [conflict](conflict_trace.md), [frontier](frontier_trace.md), and [pre-pair](pre_pair_frontier_trace.md) traces. Each report has a companion JSON file with the raw data.
The baseline comparison tool reads `archive/routing/performance_baseline.json` by default. Capture tools write here by default and replace files with the same name. Pass `--output-dir` for a scratch capture. [Capture and comparison commands](../../docs/routing-diagnostics.md#reproduce-and-compare)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,57 @@
# Conflict Trace
Generated at 2026-04-02T14:24:39-07:00 by `scripts/record_conflict_trace.py`.
## example_07_large_scale_routing_no_warm_start
Results: 10 valid / 10 reached / 10 total.
| Stage | Iteration | Conflicting Nets | Conflict Edges | Completed Nets |
| :-- | --: | --: | --: | --: |
| iteration | 0 | 9 | 16 | 1 |
| iteration | 1 | 8 | 12 | 2 |
| iteration | 2 | 6 | 5 | 4 |
| iteration | 3 | 4 | 2 | 6 |
| iteration | 4 | 4 | 2 | 6 |
| iteration | 5 | 4 | 2 | 6 |
| restored_best | | 4 | 2 | 6 |
| final | | 0 | 0 | 10 |
Top nets by traced dynamic-collision stages:
- `net_06`: 7
- `net_07`: 7
- `net_01`: 6
- `net_00`: 5
- `net_02`: 5
- `net_03`: 4
- `net_08`: 2
- `net_09`: 2
- `net_05`: 1
Top net pairs by frequency:
- `net_06` <-> `net_07`: 7
- `net_00` <-> `net_01`: 5
- `net_01` <-> `net_02`: 4
- `net_00` <-> `net_02`: 3
- `net_00` <-> `net_03`: 3
- `net_02` <-> `net_03`: 3
- `net_01` <-> `net_03`: 2
- `net_06` <-> `net_08`: 2
- `net_06` <-> `net_09`: 2
- `net_07` <-> `net_08`: 2
Top component pairs by frequency:
- `net_06[2]` <-> `net_07[2]`: 6
- `net_06[3]` <-> `net_07[2]`: 6
- `net_06[1]` <-> `net_07[1]`: 6
- `net_06[2]` <-> `net_07[1]`: 5
- `net_00[2]` <-> `net_01[3]`: 4
- `net_01[2]` <-> `net_02[2]`: 3
- `net_01[2]` <-> `net_02[3]`: 3
- `net_00[2]` <-> `net_01[2]`: 3
- `net_07[3]` <-> `net_08[2]`: 2
- `net_02[1]` <-> `net_03[1]`: 2

View file

@ -0,0 +1,60 @@
# Documentation improvement plan
Give readers a direct path to their task. A new user should be able to route a layout and diagnose a failure. A developer should be able to run a benchmark, explain a routing decision, or find the right diagnostic. Before the reorganization, the benchmark link opened on corridor algorithms and several pages buried steps and choices in long paragraphs. The original combined page is available with `git show 24559bb:docs/topological-routing.md`.
## Proposed navigation
- **`README.md`** gives the project purpose, installation, and one runnable route with an inline result plot. Link directly to **User guide**, **Developer guide**, and **Benchmarks**.
- **`DOCS.md`** is the user landing page.
- **Route a layout** in `docs/user/route-a-layout.md`. Define ports, headings, widths, and keepouts. Show preplaced crossings, movable seeds, and fixed routes where each matters in the workflow.
- **Tune and troubleshoot** in `docs/user/tune-and-troubleshoot.md`. Read a result, distinguish a geometric bound from an unfinished search or a collision, and choose the next setting to test.
- **API reference** in `docs/user/api-reference.md`. Look up public signatures, fields, units, and defaults. Link back to a worked example when an option's effect needs explanation.
- **Examples** in `examples/README.md`. Show a small visual gallery grouped by task, with links to runnable scripts and advanced examples.
- **`docs/development.md`** is the developer landing page.
- **Benchmarks** in `docs/benchmarks.md`. Choose a case and profile, run a command, and compare the results.
- **Architecture** in `docs/architecture.md`. Explain the automatic stage sequence, what gets locked or retried, and what must be verified before selection. Link to `docs/topological-routing.md` for corridor and lane algorithms.
- **Diagnostics** in `docs/routing-diagnostics.md`. Start from a symptom and select a report, counter, or trace. Use a worked trace to show what the evidence can establish.
- **Design and experiment records** link to prior goals, refactor plans, measured results, and generated traces with their original context.
## Split benchmarks from topological routing
1. Make the README's **Benchmarks** link lead directly to `docs/benchmarks.md`. Open with `overloaded-gate` under `corpus-regression`, where three of four nets route at the three-track bound. Use the output to explain how to judge coverage. Follow with choices for the full regression corpus, mode comparisons, and holdout validation.
2. Move case groups, profile definitions, coverage and cost interpretation, and comparison commands to the benchmark guide. Put fixture provenance, import commands, and Terminal-Bench reproduction in `docs/benchmark-fixtures.md`. Put probe and retry findings in `docs/benchmark-results.md`, with the decision, the conditions, and the evidence needed to reproduce it.
3. Keep `docs/topological-routing.md` focused on free-space triangulation, portals, lane assignment, and how guide and seed modes use them. Use a contextual link to the benchmark guide when a reader wants to measure the algorithms.
4. Update inbound links as part of the move. Map old section links to their new destinations and keep brief forwarding links for useful bookmarks. Preserve the source pins, licenses, and historical commands with the fixture and experiment records.
## Write for scanning and use
- Open each page with the task it supports and put the first action or decision near the top. Name headings after what readers are looking for, such as **Run a benchmark** or **Why a net stopped short**.
- Use numbered lists for procedures, bullets for independent checks and options, and tables for lookup or comparison. Use short paragraphs to explain why a decision follows from the evidence.
- Keep the public workflows and option reference separate. Explain an option at the point where a user needs to choose it, then link to its canonical default or field definition.
- Pair an example with its expected result and the next action it demonstrates. Put implementation names and detailed counters beside the developer decisions that use them.
- Lead benchmark findings with their implication. Include the profile, comparison baseline, and relevant metric. Link to the full measurements when readers need the raw evidence.
## Illustrations to add
| Place | Show | Reader takeaway |
| --- | --- | --- |
| README quick start | A compact plot generated from the exact quick-start snippet, with start and target arrows | See what a finished path looks like and how to read arrival direction. |
| Route a layout | A preplaced crossing with the keepout, port access, and the external nets labeled | See which geometry belongs to the placed device and which connections to give Inire. |
| Troubleshooting | Two panels of the same best-effort layout showing a partial path and a completed path after increasing the budget | See why a partial path can indicate unfinished search. |
| Examples gallery | Inline previews of selected existing plots, including locked paths and S-bends | Pick the example that resembles the layout at hand. |
| Architecture | A small flow diagram of construct, probe, widen, recover, verify, and refine | See where the router stops, retries, or rejects a candidate. |
| Topological routing | A single fixture shown as free space and portals, a chosen lane, and the verified physical route | See where the corridor ends and the detailed router's work begins. |
Use the existing plots where they read clearly at page width. Regenerate focused figures from the documented inputs with the existing plotting tools. Give each figure a caption that explains what to notice and alt text that conveys the takeaway. Distinguish states with labels or line styles as well as color. Use a checked-in image for diagrams when the repository renderer needs one. [Example plots](../../examples/README.md) · [Plotting helpers](../../inire/utils/visualization.py)
## Order of work
1. **Fix navigation.** Split the benchmark and topology pages, add the developer landing page, and update links. This is the first reviewable change.
2. **Rebuild the user path.** Turn `DOCS.md` into a guide index, move the field tables into the reference, and write the layout and troubleshooting pages as steps and decisions. Add the quick-start, crossing, and partial-route figures.
3. **Finish the developer path.** Rework the architecture and diagnostics headings, add the flow and corridor figures, and connect the benchmark guide to fixtures and dated results. Embed the selected existing plots in the examples gallery.
4. **Check the paths as a reader.** Preview the rendered docs at normal and narrow widths. Check links, old anchors, image paths, and command output. Run the quick start, a benchmark smoke case, and a diagnostic capture from the published instructions.
## Acceptance checks
- From the README, a new user can install, run the first route, see the expected result inline, and find what to check if a real layout returns a partial path.
- From the README, a developer can click **Benchmarks** and immediately find how to run a case. The landing page gives enough context to compare verified IDs, path cost, and work under a chosen profile.
- A developer looking for corridor internals reaches the topology page through **Architecture** and can follow the stages in an annotated figure.
- Each main page has one clear job. The headings alone make the path through it apparent, and procedural sections can be followed from their lists.
- Figures match the current snippets or fixtures, remain legible at ordinary page width, and have descriptive captions. Historical measurements and fixture attributions remain findable from the relevant guide.

View file

@ -0,0 +1,120 @@
{
"generated_at": "2026-04-02T14:24:39-07:00",
"generator": "scripts/record_frontier_trace.py",
"scenarios": [
{
"frontier_trace": [],
"metrics": {
"congestion_cache_hits": 31,
"congestion_cache_misses": 4625,
"congestion_candidate_ids": 9924,
"congestion_candidate_nets": 9979,
"congestion_candidate_precheck_hits": 2562,
"congestion_candidate_precheck_misses": 2165,
"congestion_candidate_precheck_skips": 71,
"congestion_check_calls": 4625,
"congestion_exact_pair_checks": 8122,
"congestion_grid_net_cache_hits": 2457,
"congestion_grid_net_cache_misses": 3942,
"congestion_grid_span_cache_hits": 2283,
"congestion_grid_span_cache_misses": 1948,
"congestion_lazy_requeues": 0,
"congestion_lazy_resolutions": 0,
"congestion_net_envelope_cache_hits": 2673,
"congestion_net_envelope_cache_misses": 4139,
"congestion_presence_cache_hits": 2858,
"congestion_presence_cache_misses": 2556,
"congestion_presence_skips": 687,
"danger_map_cache_hits": 16878,
"danger_map_cache_misses": 7425,
"danger_map_lookup_calls": 24303,
"danger_map_query_calls": 7425,
"danger_map_total_ns": 212814061,
"dynamic_grid_rebuilds": 0,
"dynamic_path_objects_added": 471,
"dynamic_path_objects_removed": 423,
"dynamic_tree_rebuilds": 0,
"guidance_bonus_applied": 11000.0,
"guidance_bonus_applied_bend90": 3500.0,
"guidance_bonus_applied_sbend": 625.0,
"guidance_bonus_applied_straight": 6875.0,
"guidance_match_moves": 176,
"guidance_match_moves_bend90": 56,
"guidance_match_moves_sbend": 10,
"guidance_match_moves_straight": 110,
"hard_collision_cache_hits": 0,
"iteration_conflict_edges": 39,
"iteration_conflicting_nets": 36,
"iteration_reverified_nets": 60,
"iteration_reverify_calls": 6,
"move_cache_abs_hits": 2559,
"move_cache_abs_misses": 6494,
"move_cache_rel_hits": 5872,
"move_cache_rel_misses": 622,
"moves_added": 8081,
"moves_generated": 9053,
"nets_carried_forward": 0,
"nets_reached_target": 60,
"nets_routed": 60,
"nodes_expanded": 1764,
"pair_local_search_accepts": 2,
"pair_local_search_attempts": 2,
"pair_local_search_nodes_expanded": 68,
"pair_local_search_pairs_considered": 2,
"path_cost_calls": 0,
"pruned_closed_set": 439,
"pruned_cost": 533,
"pruned_hard_collision": 0,
"ray_cast_calls": 5477,
"ray_cast_calls_expand_forward": 1704,
"ray_cast_calls_expand_snap": 46,
"ray_cast_calls_other": 0,
"ray_cast_calls_straight_static": 3721,
"ray_cast_calls_visibility_build": 0,
"ray_cast_calls_visibility_query": 0,
"ray_cast_calls_visibility_tangent": 6,
"ray_cast_candidate_bounds": 305,
"ray_cast_exact_geometry_checks": 0,
"refine_path_calls": 10,
"refinement_candidate_side_extents": 0,
"refinement_candidates_accepted": 0,
"refinement_candidates_built": 0,
"refinement_candidates_verified": 0,
"refinement_dynamic_bounds_checked": 0,
"refinement_static_bounds_checked": 0,
"refinement_windows_considered": 0,
"route_iterations": 6,
"score_component_calls": 8634,
"score_component_total_ns": 241025335,
"static_net_tree_rebuilds": 1,
"static_raw_tree_rebuilds": 1,
"static_safe_cache_hits": 2482,
"static_tree_rebuilds": 1,
"timeout_events": 0,
"verify_dynamic_candidate_nets": 2106,
"verify_dynamic_exact_pair_checks": 558,
"verify_path_report_calls": 190,
"verify_static_buffer_ops": 895,
"visibility_builds": 0,
"visibility_corner_hits_exact": 0,
"visibility_corner_index_builds": 1,
"visibility_corner_pairs_checked": 0,
"visibility_corner_queries_exact": 0,
"visibility_point_cache_hits": 0,
"visibility_point_cache_misses": 0,
"visibility_point_queries": 0,
"visibility_tangent_candidate_corner_checks": 6,
"visibility_tangent_candidate_ray_tests": 6,
"visibility_tangent_candidate_scans": 1704,
"warm_start_paths_built": 0,
"warm_start_paths_used": 0
},
"name": "example_07_large_scale_routing_no_warm_start",
"summary": {
"reached_targets": 10,
"total_results": 10,
"valid_results": 10
}
}
]
}

View file

@ -0,0 +1,23 @@
# Frontier Trace
Generated at 2026-04-02T14:24:39-07:00 by `scripts/record_frontier_trace.py`.
## example_07_large_scale_routing_no_warm_start
Results: 10 valid / 10 reached / 10 total.
| Net | Hotspots | Closed-Set | Hard Collision | Self Collision | Cost | Samples |
| :-- | --: | --: | --: | --: | --: | --: |
Prune totals by reason:
- None
Top traced hotspots by sample count:
- None
Per-net sampled reason/move breakdown:
- None

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,81 @@
# Iteration Trace
Generated at 2026-04-02T18:51:01-07:00 by `scripts/record_iteration_trace.py`.
## example_07_large_scale_routing_no_warm_start
Results: 10 valid / 10 reached / 10 total.
| Iteration | Penalty | Routed Nets | Completed | Conflict Edges | Dynamic Collisions | Nodes | Congestion Checks | Candidate Ids | Exact Pairs |
| --: | --: | --: | --: | --: | --: | --: | --: | --: | --: |
| 0 | 100.0 | 10 | 1 | 16 | 50 | 571 | 0 | 0 | 0 |
| 1 | 140.0 | 10 | 2 | 12 | 54 | 253 | 974 | 2378 | 1998 |
| 2 | 196.0 | 10 | 4 | 5 | 22 | 253 | 993 | 1928 | 1571 |
| 3 | 274.4 | 10 | 6 | 2 | 10 | 100 | 437 | 852 | 698 |
| 4 | 384.2 | 4 | 6 | 2 | 10 | 81 | 332 | 627 | 513 |
Top nets by iteration-attributed nodes expanded:
- `net_09`: 242
- `net_00`: 201
- `net_02`: 157
- `net_06`: 155
- `net_01`: 147
- `net_08`: 144
- `net_03`: 141
- `net_07`: 45
- `net_04`: 13
- `net_05`: 13
Top nets by iteration-attributed congestion checks:
- `net_06`: 569
- `net_02`: 514
- `net_01`: 468
- `net_03`: 425
- `net_00`: 203
- `net_08`: 170
- `net_07`: 143
- `net_09`: 124
- `net_04`: 60
- `net_05`: 60
## example_07_large_scale_routing_no_warm_start_seed43
Results: 10 valid / 10 reached / 10 total.
| Iteration | Penalty | Routed Nets | Completed | Conflict Edges | Dynamic Collisions | Nodes | Congestion Checks | Candidate Ids | Exact Pairs |
| --: | --: | --: | --: | --: | --: | --: | --: | --: | --: |
| 0 | 100.0 | 10 | 1 | 16 | 50 | 571 | 0 | 0 | 0 |
| 1 | 140.0 | 10 | 1 | 13 | 53 | 269 | 961 | 2562 | 2032 |
| 2 | 196.0 | 10 | 4 | 3 | 15 | 140 | 643 | 1610 | 1224 |
| 3 | 274.4 | 6 | 4 | 3 | 15 | 54 | 250 | 557 | 428 |
| 4 | 384.2 | 6 | 6 | 2 | 10 | 136 | 505 | 1025 | 829 |
| 5 | 537.8 | 4 | 6 | 2 | 10 | 33 | 171 | 419 | 287 |
Top nets by iteration-attributed nodes expanded:
- `net_09`: 250
- `net_03`: 199
- `net_00`: 177
- `net_08`: 166
- `net_07`: 140
- `net_06`: 105
- `net_02`: 79
- `net_01`: 65
- `net_05`: 12
- `net_04`: 10
Top nets by iteration-attributed congestion checks:
- `net_03`: 639
- `net_07`: 454
- `net_06`: 382
- `net_02`: 290
- `net_08`: 283
- `net_09`: 178
- `net_01`: 135
- `net_00`: 82
- `net_05`: 47
- `net_04`: 40

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,30 @@
# Pair-Local Search Characterization
Generated at 2026-04-02T15:53:29-07:00 by `scripts/characterize_pair_local_search.py`.
Grid: `num_nets=[6, 8, 10]`, `seed=[41, 42, 43]`, repeats=2.
| Nets | Seed | Repeat | Duration (s) | Valid | Reached | Pair Pairs | Pair Accepts | Pair Nodes | Nodes | Checks |
| :-- | :-- | :-- | --: | --: | --: | --: | --: | --: | --: | --: |
| 6 | 41 | 0 | 0.5462 | 1 | 6 | 0 | 0 | 0 | 500 | 674 |
| 6 | 41 | 1 | 0.5256 | 1 | 6 | 0 | 0 | 0 | 500 | 674 |
| 6 | 42 | 0 | 0.5241 | 1 | 6 | 0 | 0 | 0 | 503 | 683 |
| 6 | 42 | 1 | 0.5477 | 1 | 6 | 0 | 0 | 0 | 503 | 683 |
| 6 | 43 | 0 | 0.5199 | 1 | 6 | 0 | 0 | 0 | 493 | 654 |
| 6 | 43 | 1 | 0.5160 | 1 | 6 | 0 | 0 | 0 | 493 | 654 |
| 8 | 41 | 0 | 1.8818 | 8 | 8 | 2 | 2 | 38 | 1558 | 4313 |
| 8 | 41 | 1 | 1.8618 | 8 | 8 | 2 | 2 | 38 | 1558 | 4313 |
| 8 | 42 | 0 | 1.4850 | 8 | 8 | 1 | 1 | 19 | 1440 | 3799 |
| 8 | 42 | 1 | 1.4636 | 8 | 8 | 1 | 1 | 19 | 1440 | 3799 |
| 8 | 43 | 0 | 1.0652 | 8 | 8 | 0 | 0 | 0 | 939 | 1844 |
| 8 | 43 | 1 | 1.0502 | 8 | 8 | 0 | 0 | 0 | 939 | 1844 |
| 10 | 41 | 0 | 2.8617 | 8 | 10 | 2 | 2 | 41 | 2223 | 6208 |
| 10 | 41 | 1 | 2.8282 | 8 | 10 | 2 | 2 | 41 | 2223 | 6208 |
| 10 | 42 | 0 | 2.0356 | 10 | 10 | 2 | 2 | 68 | 1764 | 4625 |
| 10 | 42 | 1 | 2.0052 | 10 | 10 | 2 | 2 | 68 | 1764 | 4625 |
| 10 | 43 | 0 | 50.1863 | 10 | 10 | 2 | 2 | 38 | 61259 | 165223 |
| 10 | 43 | 1 | 50.4019 | 10 | 10 | 2 | 2 | 38 | 61259 | 165223 |
## Recommendation
No smaller stable pair-local smoke scenario satisfied the rule `valid_results == total_results`, `pair_local_search_accepts >= 1`, and `duration_s <= 1.0` across all repeats.

View file

@ -0,0 +1,29 @@
# Performance Baseline
Generated on 2026-04-02 by `scripts/record_performance_baseline.py`.
The full machine-readable snapshot is in [performance_baseline.json](performance_baseline.json).
Use `scripts/diff_performance_baseline.py` to compare a fresh run against that snapshot.
The default table below intentionally excludes the heavier performance-only no-warm `example_07` canaries. Use `scripts/record_iteration_trace.py` and `scripts/record_pre_pair_frontier_trace.py` to inspect the late negotiated-congestion basin and pair-local handoff behavior for those scenarios.
| Scenario | Duration (s) | Total | Valid | Reached | Iter | Nets Routed | Nodes | Ray Casts | Moves Gen | Moves Added | Dyn Tree | Visibility Builds | Congestion Checks | Verify Calls |
| :-- | --: | --: | --: | --: | --: | --: | --: | --: | --: | --: | --: | --: | --: | --: |
| example_01_simple_route | 0.0037 | 1 | 1 | 1 | 1 | 1 | 2 | 10 | 11 | 7 | 0 | 0 | 0 | 5 |
| example_02_congestion_resolution | 0.3361 | 3 | 3 | 3 | 1 | 3 | 366 | 1164 | 1413 | 668 | 0 | 0 | 0 | 41 |
| example_03_locked_paths | 0.1877 | 2 | 2 | 2 | 2 | 2 | 191 | 657 | 904 | 307 | 0 | 0 | 0 | 18 |
| example_04_sbends_and_radii | 0.0269 | 2 | 2 | 2 | 1 | 2 | 15 | 70 | 123 | 65 | 0 | 0 | 0 | 10 |
| example_05_orientation_stress | 0.2311 | 3 | 3 | 3 | 2 | 5 | 297 | 1274 | 1680 | 689 | 0 | 0 | 146 | 20 |
| example_06_bend_collision_models | 0.1988 | 3 | 3 | 3 | 3 | 3 | 240 | 682 | 1026 | 629 | 0 | 0 | 0 | 15 |
| example_07_large_scale_routing | 0.2088 | 10 | 10 | 10 | 1 | 10 | 78 | 383 | 372 | 227 | 0 | 0 | 0 | 50 |
| example_08_custom_bend_geometry | 0.0177 | 2 | 2 | 2 | 2 | 2 | 18 | 56 | 78 | 56 | 0 | 0 | 0 | 10 |
| example_09_unroutable_best_effort | 0.0057 | 1 | 0 | 0 | 1 | 1 | 3 | 13 | 16 | 10 | 0 | 0 | 0 | 1 |
## Full Counter Set
Each scenario entry in the JSON records the full `RouteMetrics` snapshot, including cache, index, congestion, and verification counters.
These counters are currently observational only and are not enforced as CI regression gates.
Tracked metric keys:
nodes_expanded, moves_generated, moves_added, pruned_closed_set, pruned_hard_collision, pruned_cost, route_iterations, nets_routed, nets_reached_target, warm_start_paths_built, warm_start_paths_used, refine_path_calls, timeout_events, iteration_reverify_calls, iteration_reverified_nets, iteration_conflicting_nets, iteration_conflict_edges, nets_carried_forward, score_component_calls, score_component_total_ns, path_cost_calls, danger_map_lookup_calls, danger_map_cache_hits, danger_map_cache_misses, danger_map_query_calls, danger_map_total_ns, move_cache_abs_hits, move_cache_abs_misses, move_cache_rel_hits, move_cache_rel_misses, guidance_match_moves, guidance_match_moves_straight, guidance_match_moves_bend90, guidance_match_moves_sbend, guidance_bonus_applied, guidance_bonus_applied_straight, guidance_bonus_applied_bend90, guidance_bonus_applied_sbend, static_safe_cache_hits, hard_collision_cache_hits, congestion_cache_hits, congestion_cache_misses, congestion_presence_cache_hits, congestion_presence_cache_misses, congestion_presence_skips, congestion_candidate_precheck_hits, congestion_candidate_precheck_misses, congestion_candidate_precheck_skips, congestion_grid_net_cache_hits, congestion_grid_net_cache_misses, congestion_grid_span_cache_hits, congestion_grid_span_cache_misses, congestion_candidate_nets, congestion_net_envelope_cache_hits, congestion_net_envelope_cache_misses, dynamic_path_objects_added, dynamic_path_objects_removed, dynamic_tree_rebuilds, dynamic_grid_rebuilds, static_tree_rebuilds, static_raw_tree_rebuilds, static_net_tree_rebuilds, visibility_corner_index_builds, visibility_builds, visibility_corner_pairs_checked, visibility_corner_queries_exact, visibility_corner_hits_exact, visibility_point_queries, visibility_point_cache_hits, visibility_point_cache_misses, visibility_tangent_candidate_scans, visibility_tangent_candidate_corner_checks, visibility_tangent_candidate_ray_tests, ray_cast_calls, ray_cast_calls_straight_static, ray_cast_calls_expand_snap, ray_cast_calls_expand_forward, ray_cast_calls_visibility_build, ray_cast_calls_visibility_query, ray_cast_calls_visibility_tangent, ray_cast_calls_other, ray_cast_candidate_bounds, ray_cast_exact_geometry_checks, congestion_check_calls, congestion_lazy_resolutions, congestion_lazy_requeues, congestion_candidate_ids, congestion_exact_pair_checks, verify_path_report_calls, verify_static_buffer_ops, verify_dynamic_candidate_nets, verify_dynamic_exact_pair_checks, refinement_windows_considered, refinement_static_bounds_checked, refinement_dynamic_bounds_checked, refinement_candidate_side_extents, refinement_candidates_built, refinement_candidates_verified, refinement_candidates_accepted, pair_local_search_pairs_considered, pair_local_search_attempts, pair_local_search_accepts, pair_local_search_nodes_expanded, late_phase_capped_nets, late_phase_capped_fallbacks

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,48 @@
# Pre-Pair Frontier Trace
Generated at 2026-04-02T18:51:01-07:00 by `scripts/record_pre_pair_frontier_trace.py`.
## example_07_large_scale_routing_no_warm_start
Results: 10 valid / 10 reached / 10 total.
Captured iteration: `4`
Conflict edges: `(('net_01', 'net_02'), ('net_06', 'net_07'))`
| Net | Nodes | Checks | Closed-Set | Cost | Hard Collision | Guidance Seed | Frontier Samples |
| :-- | --: | --: | --: | --: | --: | :--: | --: |
| net_07 | 7 | 30 | 1 | 0 | 0 | yes | 0 |
| net_06 | 46 | 179 | 7 | 15 | 0 | yes | 5 |
| net_00 | 10 | 43 | 1 | 0 | 0 | yes | 0 |
| net_01 | 18 | 80 | 3 | 0 | 0 | yes | 0 |
Frontier prune totals by reason:
- `closed_set`: 5
- `hard_collision`: 0
- `self_collision`: 0
- `cost`: 0
## example_07_large_scale_routing_no_warm_start_seed43
Results: 10 valid / 10 reached / 10 total.
Captured iteration: `5`
Conflict edges: `(('net_02', 'net_03'), ('net_06', 'net_07'))`
| Net | Nodes | Checks | Closed-Set | Cost | Hard Collision | Guidance Seed | Frontier Samples |
| :-- | --: | --: | --: | --: | --: | :--: | --: |
| net_07 | 16 | 85 | 3 | 0 | 0 | yes | 2 |
| net_02 | 17 | 86 | 4 | 0 | 0 | yes | 3 |
| net_06 | 0 | 0 | 0 | 0 | 0 | yes | 8 |
| net_03 | 0 | 0 | 0 | 0 | 0 | yes | 12 |
Frontier prune totals by reason:
- `closed_set`: 25
- `hard_collision`: 0
- `self_collision`: 0
- `cost`: 0

View file

@ -0,0 +1,33 @@
# Automatic routing policy and route cost goals
Use this historical milestone to understand why automatic routing combines constructive planners with search and why the project checks coverage before cost. Use the [current benchmark guide](../../docs/benchmarks.md) to evaluate a new change.
Run one inire policy across the full benchmark corpus from empty initial paths. The first milestone is to verify **242 of 243 nets and fully route 36 of 37 boards** in one run. The overloaded gate should reach its three-track capacity. Once the policy reproduces that baseline, reduce weighted route cost while preserving coverage.
## Benchmark baseline
| Full corpus result | Verified nets | Fully routed boards |
| --- | ---: | ---: |
| Bundle-first at 100 nodes per attempt and two iterations | 155/243 | 15/37 |
| Best existing policy per board after targeted retries | 190/243 | 20/37 |
| Best result per board including standalone experiments | 242/243 | 36/37 |
The clearance-checked column planner completed all 15 serial, split, and bidirectional bypass layouts with zero A* expansions. An experimental bundle turnaround routed all nine nets with the fixed Terminal-Bench headings. An automatic perimeter detour completed the two-net subset. The integrated policy should generate these routes from the input geometry and settings. Keep feasibility witnesses in the test harness for independent coverage and cost checks. [Benchmark corpus and methods](../../docs/benchmarks.md#choose-a-case)
## Planner selection and verification
Use geometry checks to select a candidate planner. Use column lane assignment for ordered tracks through successive openings, bundle planning for perimeter returns, and a perimeter detour when the layout leaves room for one. Preserve fixed terminal headings and infer headings only for point-terminal inputs.
Check complete candidate layouts with inire's geometry verifier before accepting them. Retain the best verified layout across attempts. Use the existing guide, seed, and near-port probe policies for layouts outside the constructive planners' scope or for unresolved nets. Where verification identifies a failed turn, an aperture with insufficient room, or a conflict between nets, use that information to choose the next retry. Stop at a capacity limit only when the geometry proves it.
## Weighted route cost
At this milestone, the column planner ranked lateral movement and forward span. On `bypass-interleaved-directions`, its verified solution used 86 S-bends compared with 22 in the feasibility witness and cost 36% more. The difference motivated scoring transitions by physical component cost and considering lanes reachable in a single S-bend. A cheaper transition still needs enough forward room between obstacles and must pass the full-board check.
## Original next steps
1. Port the three experimental planners into the benchmark policy and run it with one configuration on all 37 boards. Record the selected planner, retries, valid net IDs, and any capacity limit. Add regression checks for the fixed-heading turnaround and the overloaded gate.
2. Set aside validation layouts with staggered terminal columns, uneven widths, and different obstacle arrangements before tuning. Keep closely related variants together so the validation set tests unfamiliar geometry.
3. Compare weighted transition scoring against the integrated baseline, starting with `bypass-interleaved-directions`, `split-moving-divider`, and `serial-terminal-jogs`. Report complete boards, weighted cost on identical net sets, A* expansions, and median and tail runtime. Use the full corpus and the held-out layouts to evaluate a default-policy change.
The archived automatic policy validation records the completed corpus and holdout runs and the scoring comparison. [Experiment archive](../../docs/benchmark-results.md#experiment-archive)

View file

@ -0,0 +1,51 @@
# Routing refactor plan
Use this record to recover the original refactor scope and the reason for each proposed boundary. The initial refactor landed in `ea5cfe7`. Start with the future-looking items when considering new work, and use the [architecture](../../docs/architecture.md) and [diagnostics guide](../../docs/routing-diagnostics.md) for current behavior.
## Planned
### Benchmark reproducibility and router state
1. **Share the corpus and benchmark profiles.** Give the comparison CLI, pytest, and the performance snapshot tools one source for case groups and named configurations. The CLI's matched-budget defaults currently use two congestion iterations and a 600-node seed budget. The corpus test uses three iterations and a 500-node seed budget. Make those settings explicit and preserve the existing configurations when moving them. Store expected coverage with the fixtures, including the bounds for `overloaded-gate` and `lidar-clements-8x8`. [Benchmark CLI](../../scripts/compare_topological_routing.py) · [Corpus tests](../../inire/tests/test_routing_benchmarks.py)
2. **Make exact parity a reusable benchmark command.** Compare runs by case and effective profile. Check verified net IDs, path seeds, per-net costs, selected stages and stage order, stable counters, and callback payloads. Report the first differing case, stage, or net and compare elapsed time separately. Use the command when checking subsequent behavior-preserving work.
3. **Scope temporary obstacle reservations.** Greedy warm starts remove temporary obstacles on normal completion, and corridor seeding already uses `finally`. Share the cleanup rule while preserving insertion order and cache invalidation. Test that an interrupted greedy search leaves the routing world reusable. [Warm starts and corridor seeds](../../inire/router/_router.py)
4. **Consolidate routing counter definitions.** Define counter defaults, reset behavior, and snapshot aggregation once. Keep direct attribute increments in the search loop, preserve the distinction between per-search and cumulative counters, and retain the public `RouteMetrics` fields. Check that runs and reports expose the same counter values. [Mutable counters](../../inire/router/_astar_types.py) · [Public metrics](../../inire/results.py)
### Routing decisions and diagnostics
5. **Extract trace formatting from `PathFinder`.** Start with pure formatters for conflict and iteration entries. Keep trace capture points visible in the routing loop, including the stages around best-iteration restoration and pair-local repair. Compare the serialized traces before and after. [Trace capture](../../inire/router/_router.py)
6. **Extract negotiated-congestion decisions.** Make reroute selection, late search caps, and stop conditions testable against an iteration review and recent search work. Use small tests to exercise those rules independently of A*, with corpus parity to check their integration. [Congestion routing](../../inire/router/_router.py)
7. **Group the per-search congestion caches.** Give the six congestion cache dictionaries one owner for each A* search. Simplify the signatures between the search loop, move expansion, and admission while preserving cache keys and lifetime. Compare stable counters and runtime. [Search loop](../../inire/router/_search.py) · [Move admission](../../inire/router/_astar_admission.py)
8. **Consolidate direct-policy settings.** Define each direct policy's connectivity checks, lookahead, budget splitting, and unlocked probe in one internal table. Keep the attempt sequence and early exits explicit and preserve policies exposed by the benchmark CLI. [Direct and residual policies](../../inire/router/_routing_policy.py)
9. **Make automatic trial acceptance explicit.** Distinguish locally feasible candidates, whole-board validity, and eligibility to replace an incumbent. Preserve the rule that cost ranks alternatives with the same verified net IDs. Record when residual results are checked and when unresolved results are merged so stage metadata remains consistent. [Trial selection](../../inire/router/_routing_policy.py) · [Automatic orchestration](../../inire/router/_automatic.py)
10. **Make capacity bounds independently testable.** Extract the cut-capacity calculation and the disjoint port-conflict check. State the geometry assumptions beside each bound and test when a bound applies separately from the policy decision to stop. Preserve reported cuts, conflict pairs, and routing targets. [Capacity and port checks](../../inire/router/_capacity.py)
11. **Separate topological planning from corridor construction.** Give endpoint access, mesh paths, lane assignments, and conversion to `Corridor` explicit internal boundaries. That lets lane-allocation tests exercise choices and tie-breaking independently of the lattice router. [Topological corridors](../../inire/router/_topology.py)
12. **Separate column scheduling from seed generation.** Distinguish opening and track assignment, feasible S-bend schedules, and the conversion of a schedule to seeds. Preserve candidate order and full-board verification. Exercise individual transition failures so new passage patterns can be tested in isolation. [Column planning](../../inire/router/_columns.py)
13. **Reuse verification details in final diagnostics.** Share final verification details with conflict and frontier reporting where they cover the same net population and installed geometry. Compare exact routes and trace payloads, then measure the change in verification calls and runtime. [Final verification and frontier capture](../../inire/router/_router.py)
### Geometry and tooling cleanup
14. **Expose live raw static obstacles through `RoutingWorld`.** Give pair-local search and corridor setup an ordered iterator so both can use current obstacles, including obstacles added after problem creation. Keep index storage details inside the world. [Routing world](../../inire/geometry/collision.py) · [Pair-local search](../../inire/router/_pair_local.py)
15. **Centralize cardinal coordinate transforms.** Share forward and lateral projection across the refiner, perimeter planner, and direct-route planner. Cover all four headings and leave snapping at its current points. [Port primitives](../../inire/geometry/primitives.py) · [Refiner](../../inire/router/refiner.py)
16. **Move shared geometry helpers out of planner modules.** Give helpers such as exact S-bend spans a neutral home so compact routing can reuse them directly. Preserve exact integer spans for constructive routing and floating-point reach calculations for search. [Compact routing](../../inire/router/_compact.py) · [Column planning](../../inire/router/_columns.py)
17. **Share component construction between seed replay and A*.** Reuse the mapping from move parameters to straight, 90-degree bend, and S-bend geometry. Preserve A* cache keys, handling of infeasible moves, and the geometry options applied during seed replay. [Seed materialization](../../inire/router/_seed_materialization.py) · [Move admission](../../inire/router/_astar_admission.py)
18. **Name scoring objectives by purpose.** Make search cost, refinement cost, automatic trial ranking, and benchmark-weighted length clear in code and reports. Reuse the weighted-length calculation where it is identical and label native and benchmark costs explicitly. [Automatic scoring](../../inire/router/_automatic.py) · [Benchmark reporting](../../scripts/compare_topological_routing.py)
19. **Share trace recorder boilerplate.** Reuse scenario selection, result summaries, command-line arguments, and artifact writing across conflict, frontier, pre-pair, and iteration recorders. Keep each report's renderer and schema in its own script. [Frontier recorder](../../scripts/record_frontier_trace.py) · [Iteration recorder](../../scripts/record_iteration_trace.py)
20. **Keep fixtures and routing docs easy to maintain.** Organize large fixture modules by family while preserving stable case names and corpus order. Keep feasibility witnesses separate from timed inputs. Update the architecture map for pair-local search and label the original routing goal as a historical milestone. [Benchmark fixtures](../../inire/tests/routing_benchmarks.py) · [Architecture](../../docs/architecture.md) · [Original routing goal](routing-policy-goal.md)
21. **Resolve the remaining lint findings.** Review and fix the reported issues in `inire` and `scripts`, including redundant comprehensions and long lines. Review suggested fixes individually where they touch search or benchmark behavior. [Lint configuration](../../pyproject.toml)
## Future-looking
22. **Consider a common residual routing interface when a new recovery strategy needs it.** Identify which operations can be shared across direct locks, incumbent seeding, perimeter recovery, and pair-local search. Preserve their distinct roles for frozen obstacles, seed hints, and merge-time verification. [Residual policies](../../inire/router/_routing_policy.py) · [Pair-local search](../../inire/router/_pair_local.py)
23. **Split collision queries further when profiling or geometry work identifies a reason.** Candidate lookup, exact overlap, and ray casting are possible boundaries. Compare clearance, boundary touches, physical and proxy geometry, and cache behavior before adopting a new split. [Collision queries](../../inire/geometry/collision.py)
24. **Revisit public option grouping with a compatibility plan.** Consider grouping planner settings or bend geometry when an API change is warranted. Account for legacy custom bend polygons and separate physical and proxy geometry. Handle changes to defaults, validation, and public names as explicit API decisions. [Public options](../../inire/model.py)
## Verification
Use the current 67-board corpus as the regression baseline for routing changes. The `corpus-regression` and `public-defaults` profiles reach every board's routing bound and verify 433 of 437 nets each. For behavior-preserving changes, compare exact paths, per-net costs, bounds, planner stage order and metadata, and relevant callback and trace payloads. For changes that intentionally eliminate work, such as item 13, record the expected counter differences while checking route and trace parity. [Corpus reproduction](../../docs/benchmarks.md#run-the-full-regression-corpus)
Capture the same cases and options at both revisions. The parity command defaults to the `corpus-regression` and `public-defaults` profiles. [Parity commands](../../docs/routing-diagnostics.md#reproduce-and-compare)
### Refactor validation
The refactor matched paths, costs, stage data, traces, and callbacks on the applicable parity runs. Reusing final verification details reduced repeated checks and improved timing on a diagnostic-heavy straight-route fixture. The full corpus showed little time change. Use trace-heavy cases to measure this kind of refactor, and keep the full corpus for correctness. The paired measurements are in `git show 2b02c6e:docs/routing-refactor-plan.md`.