diff --git a/docs/architecture.md b/docs/architecture.md index 5893af9..b1dc292 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -2,28 +2,17 @@ `route()` uses the same worker to search, replay seeds, and verify paths. An explicit mode configures the worker directly. Automatic routing sets a coverage target and tries different plans or worker settings. -- [Worker entry point](../inire/router/_stack.py#L65) -- [Complex-routing walkthrough](complex-routing-example-1.md) - ## Automatic routing ![Automatic routing sets a target for the number of verified nets and tries several ways to reach it. The router selects and optionally refines its best layout before returning a result for each net.](figures/automatic-stages.png) Follow the left column while coverage is below the target. Reaching the target skips the remaining attempts. If the attempts run out, the router selects the best layout it verified. -1. **Set a coverage target.** Conflicting aligned port faces and the number of tracks through a rectangular opening can bound how many nets fit. +1. **Set a coverage target.** Conflicting aligned port faces and [track capacity](../inire/router/_capacity.py#L29) at rectangular cuts can bound how many nets fit. 2. **Try constructive plans.** Bundles assign ordered tracks, columns schedule turns, and compact planners fit short links. Each plan supplies seeds for the worker to verify. 3. **Search for missing routes.** Early attempts use small budgets and can hold verified routes fixed. If the locks cut off a port, retry with movable seeds or different lanes. Lattice search handles custom outlines or proxies and is the fallback when corridor planning is unavailable. 4. **Select and refine.** Prefer higher verified coverage. Compare cost on matching verified net IDs. Refinement can replace the selected layout only if those IDs remain verified. -**Implementation** - -- [Coverage bounds](../inire/router/_capacity.py#L29) -- [Constructive trials](../inire/router/_automatic.py#L228) -- [Search order and budgets](../inire/router/_automatic.py#L488) -- [Trial selection](../inire/router/_routing_policy.py#L324) -- [Refinement handoff](../inire/router/_automatic.py#L610) - ### Example of a poor lock Holding the straight trunk fixed in `stress-retry-straight-decoy` blocks both vertical routes. The `residual-dogleg` stage finishes the trunk with a four-turn detour, bringing coverage to four out of four. When changing lock ordering, check which stage finishes the trunk. @@ -38,34 +27,23 @@ Holding the straight trunk fixed in `stress-retry-straight-decoy` blocks both ve - **Recheck installed paths.** A later route can conflict with one installed earlier. After each iteration, the driver rechecks the installed set and ranks snapshots by completed nets, then conflicts and dynamic collisions. - **Repair small conflict sets.** After restoring the best iteration, try rerouting up to two isolated pairs against the routes held fixed. -**Implementation** - -- [Move generation](../inire/router/_astar_moves.py) -- [Reroute scheduling](../inire/router/_congestion_policy.py#L99) -- [Pair repair trace](routing-diagnostics.md#follow-a-late-conflict-into-pair-local-repair) - ## Geometry and refinement - **Replay.** Results carry the requested net and the effective net with resolved ports. Seed replay builds physical geometry from the effective start port using the same endpoint and bend calculations as search. - **Verify.** Search uses collision proxies. Verification checks the physical polygons against the board, keepouts, and other paths. In zero-node replay, verify each path's own geometry first, then add cross-net conflicts. Fixed polygons retain their vertices and enter geometric operations at full coordinate precision. - **Refine.** Try replacing sections with at least four quarter turns. Rank detours before building their polygons and verify the complete updated layout. -**Details** - -- [Placement recipes](user/route-a-layout.md#save-a-placement-recipe) -- [Physical checks](../inire/geometry/collision.py#L687) -- [Custom outlines and port warnings](user/api-reference.md#searchoptions) -- [Collision and refinement metrics](routing-diagnostics.md#route-metrics) - ## Validate a change | If you change | What to check | Where to start | | --- | --- | --- | -| Stage order or budgets | Which stage wins and whether work reappears in a later attempt. Include tight passages and preplaced crossings. | [Automatic routing](../inire/router/_automatic.py) | -| Locks or candidate acceptance | The verified IDs and their paths after the complete layout is checked. | [Direct trials and selection](../inire/router/_routing_policy.py) | +| Worker setup or seed replay | Resolved ports and path geometry after replay. | [Worker entry point](../inire/router/_stack.py#L65), [placement recipes](user/route-a-layout.md#save-a-placement-recipe) | +| Stage order or budgets | Which stage wins and whether work reappears in a later attempt. Include tight passages and preplaced crossings. | [Constructive trials](../inire/router/_automatic.py#L228), [search trials](../inire/router/_automatic.py#L488) | +| Locks or candidate acceptance | The verified IDs and their paths after the complete layout is checked. | [Direct trials](../inire/router/_routing_policy.py#L288), [trial selection](../inire/router/_routing_policy.py#L324) | | Corridor or seed allocation | Coverage through shared openings and search work when a corridor reaches the wrong lane or leaves too little turn room. | [Corridor planning and realization](topological-routing.md#corridor-planning-and-realization) | -| Collision or caching | Clearance and boundary decisions for both physical and proxy shapes. Compare candidate counts and exact checks along with time. | [Collision world](../inire/geometry/collision.py) | -| Pair-local repair | Coverage and conflict edges before repair, plus the final installed geometry. | [Pair-local search](../inire/router/_pair_local.py) | -| Cost or refinement | Per-net costs on equal verified ID sets and validity after the final check. | [Path refinement](../inire/router/refiner.py) | +| Moves or reroute scheduling | Which moves reach admission and which nets are retried. | [Move generation](../inire/router/_astar_moves.py), [reroute scheduling](../inire/router/_congestion_policy.py#L99) | +| Collision or caching | Clearance and boundary decisions for both physical and proxy shapes. Compare candidate counts and exact checks along with time. | [Physical checks](../inire/geometry/collision.py#L687), [work counters](routing-diagnostics.md#route-metrics) | +| Pair-local repair | Coverage and conflict edges before repair, plus the final installed geometry. | [Pair-local search](../inire/router/_pair_local.py), [pair repair trace](routing-diagnostics.md#follow-a-late-conflict-into-pair-local-repair) | +| Cost or refinement | Per-net costs on equal verified ID sets and validity after the final check. | [Path refinement](../inire/router/refiner.py), [refinement handoff](../inire/router/_automatic.py#L610) | Use [benchmark profiles](benchmarks.md#choose-a-profile) for policy comparisons and [exact parity](routing-diagnostics.md#reproduce-and-compare) for behavior-preserving changes. diff --git a/docs/complex-routing-example-1.md b/docs/complex-routing-example-1.md index 6072e60..ba17777 100644 --- a/docs/complex-routing-example-1.md +++ b/docs/complex-routing-example-1.md @@ -18,10 +18,6 @@ The 2,500 by 1,000 board has seven keepouts and nine nets. Width is 2, clearance Open circles mark sources and filled squares mark targets. The inset shows 24 tracks fitting through the purple cut after allowing for width and clearance. -- [Board inputs](../examples/advanced-layouts.json) -- [Problem builder](../examples/advanced_layouts.py#L37) -- [Capacity calculation](../inire/router/_capacity.py#L29) - ## 2. Assign lanes and compile path seeds The bundle planner groups nets by their passages and spaces the lanes at a pitch of 9. The first `net_08` plan takes the bottom lane at `y = 1`, rises on the right, and approaches its target heading west. @@ -30,9 +26,6 @@ The bundle planner groups nets by their passages and spaces the lanes at a pitch The dots mark waypoints. In the lower inset, only `net_08` and `net_00` fit below the tower. The planner compiles straight runs, right-angle corners, and diagonals into straight, quarter-turn, and S-bend seeds. -- [Lane assignment](../inire/router/_bundle.py#L114) -- [Waypoint compiler](../inire/router/_waypoints.py#L33) - ## 3. Fit the required eastbound arrival The turnaround planner shifts the upper shelf route `net_07` and brings `net_08` beneath it. The return rises west of its target and takes a final right turn. The planner recompiles both changed seeds. @@ -41,8 +34,6 @@ The turnaround planner shifts the upper shelf route `net_07` and brings `net_08` Compare the heading arrows above the red target squares. -- [Turnaround candidates](../inire/router/_perimeter.py#L103) - ## 4. Verify the seeds and refine the layout A worker in mode `off` replays the `bundle-turnaround` seeds with a zero-node budget. It checks the resulting polygons against the board, keepouts, and other routes. All nine verify, so automatic skips search. @@ -57,10 +48,6 @@ Automatic replays the seeds again with refinement enabled. The refiner replaces Compare the solid and dashed approaches of `net_07` near the top edge. -- [Seeded worker](../inire/router/_automatic.py#L173) -- [Physical verification](../inire/geometry/collision.py#L687) -- [Refinement handoff](../inire/router/_automatic.py#L610) - ## 5. Inspect the result Find the two stages under `runs[0].samples[0].stages` in the benchmark JSON. Both report zero A* expansions. @@ -121,4 +108,13 @@ python -m scripts.render_complex_routing_example --output-dir /tmp/inire-complex ``` - [Corridor planning](topological-routing.md#corridor-planning-and-realization) -- [Figure generator](../scripts/render_complex_routing_example.py) + +## Implementation + +| Stage | Inputs and code | +| --- | --- | +| Board and routing target | [Board inputs](../examples/advanced-layouts.json), [problem builder](../examples/advanced_layouts.py#L37), [capacity calculation](../inire/router/_capacity.py#L29) | +| Lanes and seeds | [Lane assignment](../inire/router/_bundle.py#L114), [waypoint compiler](../inire/router/_waypoints.py#L33) | +| Eastbound arrival | [Turnaround candidates](../inire/router/_perimeter.py#L103) | +| Verification and refinement | [Seeded worker](../inire/router/_automatic.py#L173), [physical verification](../inire/geometry/collision.py#L687), [refinement handoff](../inire/router/_automatic.py#L610) | +| Figures and mode comparison | [Figure generator](../scripts/render_complex_routing_example.py) | diff --git a/docs/development.md b/docs/development.md index 0d779f7..0394363 100644 --- a/docs/development.md +++ b/docs/development.md @@ -6,8 +6,11 @@ - [Complex-routing walkthrough](complex-routing-example-1.md) - [Router architecture](architecture.md) +- [Topological routing](topological-routing.md) - [Routing diagnostics](routing-diagnostics.md) - [Benchmarks](benchmarks.md) +- [Benchmark fixtures](benchmark-fixtures.md) +- [Benchmark results](benchmark-results.md) - [Public API](user/api-reference.md) ## Check a change