Refine routing geometry checks and streamline documentation
Report coincident terminals and unusable seeds per net, update custom bend handling and verification, and cover the revised behavior with regression tests. Shorten the user and developer guides around reader tasks and keep the illustrated routing walkthrough and reference links easy to find.
This commit is contained in:
parent
8b32d68496
commit
eac083a37d
1 changed files with 1034 additions and 594 deletions
|
|
@ -1,54 +1,61 @@
|
|||
# Router architecture
|
||||
|
||||
An explicit mode starts one worker with that mode’s settings. Guide and seed can retry with zero guidance cost. Automatic routing can try several combinations of obstacles, locks, and starting paths. All modes use the same worker and assign iteration indices across attempts. See [`route_once()`](../inire/router/_stack.py#L65).
|
||||
`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.
|
||||
|
||||
Follow one complete run from board input through planning, verification, and plotting in [Complex-routing example 1](complex-routing-example-1.md).
|
||||
- [Worker entry point](../inire/router/_stack.py#L65)
|
||||
- [Walk through one complete run](complex-routing-example-1.md)
|
||||
|
||||
## Automatic routing
|
||||
|
||||

|
||||
|
||||
Follow the left column down while the number of verified nets is below the target. The router selects a layout when an attempt reaches that target or the attempts run out. It uses lattice search directly for custom physical bends or polygonal proxies. If constructive planning falls short and constrained triangulation is unavailable, it continues with lattice search.
|
||||
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 the coverage target.** A pair of nets with aligned terminal faces that violate clearance can supply at most one route. At zero clearance, faces that touch also conflict. Count such pairs using each net at most once. For rectangular keepouts, also bound the number of paths that can cross a vertical cut by packing tracks at the narrowest requested width. To see how the openings are counted, start with [`cut_capacity()`](../inire/router/_capacity.py#L28).
|
||||
2. **Try constructive planners.** Bundles assign ordered tracks through barriers. Column schedules place turns between openings. Compact planners fit short connections between constrained ports. Each produces seeds whose physical geometry the worker checks.
|
||||
3. **Start with a small search budget.** Lock verified straight links and search for the remaining nets. A different lock order or a small unlocked probe can free room for a turn. Promising guide and column attempts can run first.
|
||||
4. **Decide what to keep fixed.** If the remaining ports are connected, route around the locked geometry. If the locks disconnect them, pass the previously verified paths as seeds that can move. A joint retry can assign different lanes through a shared opening. If recovery stalls, seed and lattice attempts can search the whole layout. The final lattice retry can use the caller's full node limit.
|
||||
5. **Select a verified layout.** Prefer more verified nets and compare cost when the verified net IDs match. A completed `incumbent-residual` trial or an improving `joint-portal-lanes` trial must pass another check with the original keepouts before it can win. Refinement can replace the selected layout only if it preserves the verified net IDs. See [the refinement handoff](../inire/router/_automatic.py#L610).
|
||||
1. **Set a coverage target.** Conflicting aligned port faces and the number of tracks through a rectangular opening 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.
|
||||
|
||||
The near-port attempt uses up to 100 nodes per search and two congestion iterations with the arc proxy. Alternate proxies use the configured iteration limit because a later shallow iteration can find a cheaper path. Wider lookahead uses up to 500 nodes per search and the configured iteration limit. Follow the caps and early exits in [the initial search trials](../inire/router/_automatic.py#L509).
|
||||
**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
|
||||
|
||||
1. The straight trunk in `stress-retry-straight-decoy` fits on its own. Fixing it in place would block both vertical routes.
|
||||
2. The early search can keep the vertical routes and the lower rail. A four-turn detour connects the trunk before the router tries a larger search budget. See where it bends in the [layout and route figure](../examples/advanced.md#trunk-that-detours-around-branches).
|
||||
3. If you change lock ordering or acceptance, run the [single-case benchmark command](benchmarks.md#run-a-benchmark) with `--case stress-retry-straight-decoy`. Check that all four nets still verify and compare which stage finishes the trunk.
|
||||
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.
|
||||
|
||||
- [Trunk detour figure](../examples/advanced.md#trunk-that-detours-around-branches)
|
||||
- [Run a single-case benchmark](benchmarks.md#run-a-benchmark)
|
||||
|
||||
## Detailed search and congestion
|
||||
|
||||
- **Build and admit moves.** Weighted A* searches snapped positions and headings. Rays, visible corners, and corridor waypoints propose straight endpoints. If a ray blocks a launch, a flat-ended trace scan checks for room to move. An aligned target goes directly to admission, which checks the straight's rectangular footprint for clearance. A long lead can use consecutive straights when a single forward scan cannot cover it. Search releases turns away from a distant target when preferred moves run out or the reserved share of the expansion budget begins. Searches with up to 16 expansions consider these turns immediately. Larger searches release them with at least one tenth of the budget left, rounded down with a minimum of one expansion. S-bends can follow each other when the configured moves permit it. Admission also checks cost and state dominance. [Move generation](../inire/router/_astar_moves.py)
|
||||
- **Propose moves.** Weighted A* searches snapped positions and headings. Rays, corners, and corridor waypoints suggest straight endpoints. Admission checks the footprint, cost, and state dominance.
|
||||
- **Prune histories.** The closed set groups arrivals by position and heading. Paths with different final straights or footprints can have different valid continuations, so pruning can discard an alternative.
|
||||
- **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.
|
||||
|
||||
The closed set groups states by snapped position and heading. Arrivals with different final straight lengths, seed progress, or occupied path geometry can offer different continuations. This pruning keeps the search bounded in practice and can discard an alternative history. A regression test demonstrates different straight proposals from equal-cost arrivals at one port.
|
||||
**Implementation**
|
||||
|
||||
- **Recheck the installed set.** Paths that reach their targets and pass geometry checks against themselves, the board, and keepouts participate in congestion. Partial and geometrically invalid paths remain available for diagnosis. After an iteration the driver verifies the installed paths, since a later route can collide with one completed earlier. It ranks snapshots by completed nets, then by conflicts and dynamic collisions. A narrowed retry includes every net that still fails verification. [`next_reroute_net_ids()`](../inire/router/_congestion_policy.py#L99)
|
||||
|
||||
- **Repair a small conflict set.** The driver returns to the best iteration and can reuse its verification when those paths are still installed and restored-stage traces are disabled. If the conflicts form separate pairs, the router can try repairing up to two of them. It holds the other paths fixed, tries both routing orders as needed, and checks proposed replacements against the installed layout. For a worked trace, [follow a late conflict](routing-diagnostics.md#follow-a-late-conflict-into-pair-local-repair).
|
||||
- [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
|
||||
|
||||
A result carries the requested and effective net specs. The effective net records the resolved ports for replaying the move sequence after heading inference. Fixed routes carry their owner and physical polygons into the same collision world used by search and verification. The world applies distinct-net clearance to fixed geometry, and planners see fixed routes alongside keepouts. Routing preserves the vertices of imported polygons and clears their GEOS precision metadata so geometric operations use full coordinate precision. [Placement recipes](user/route-a-layout.md#save-a-placement-recipe)
|
||||
- **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.
|
||||
|
||||
Search, seed replay, and refinement share analytic endpoint and circular sampling calculations. Preparation rejects oversized sampling requests before allocating the outline. Verification uses the materialized polygons for exact containment and clearance.
|
||||
**Details**
|
||||
|
||||
Zero-node replay checks each complete path against the board, itself, and fixed geometry before adding eligible paths to the collision index. A second pass adds cross-net conflicts to those reports. Iteration review and final reporting reuse the results while the indexed routes stay the same.
|
||||
|
||||
Search uses proxies to check moves and estimate congestion. Verification rejects invalid polygons and checks each port for a finite-width face with material on the correct side. It checks for overlap within components and unintended contact between components, and checks the route against keepouts, other nets, and the board rectangle in every routing mode. Search and seed materialization use the same custom S-bend outline when one is configured. A circular S-bend with a fractional forward span ends with a short tangent extension to the next grid point, keeping the requested radius. Boundary contact with the board is allowed.
|
||||
|
||||
At a keepout corner, a mitred clearance buffer can reach farther than the specified clearance. Verification checks the actual distance before counting these hits as collisions. For an example with a corner close to the required clearance, see the [mitred-corner test](../inire/tests/test_collision.py#L146).
|
||||
|
||||
Dynamic congestion queries use a grid for small spans and an R-tree for large spans. When expansion counts are similar but routing time rises, inspect ray casts for repeated visibility queries and exact pair checks for an overly broad dynamic lookup. The [metrics guide](routing-diagnostics.md#route-metrics) maps those questions to counters.
|
||||
|
||||
Refinement tries replacing sections of routes with at least four 90-degree bends. It indexes endpoints by heading and forward position to find eligible sections, then scores proposed detours before constructing their polygons. With a finite budget above one, it tries sections with bends at both ends first. With a budget of one or no window limit, it starts with the longest eligible section by component count. It can check just the replacement when the original route is valid against the installed geometry. Final verification checks the entire updated route. Automatic refinement also rechecks retained partial paths against the updated layout.
|
||||
- [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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue