Simplify residual routing and document seed precedence

This commit is contained in:
Jan Petykiewicz 2026-12-01 22:39:16 -08:00
commit f609e5a695
2 changed files with 5 additions and 16 deletions

View file

@ -35,7 +35,8 @@ Set `TopologyOptions(mode=...)` and pass it as `topology` in `RoutingOptions`.
### Mode requirements ### Mode requirements
- Inire requires Shapely 2.1 or newer with GEOS 3.10 or newer. In guide and seed modes, nets that receive no corridor can use ordinary lattice search. A caller-supplied seed takes precedence over a generated one. Set `node_limit=0` to verify supplied seeds without planning corridors. [Constrained triangulation requirements](https://shapely.readthedocs.io/en/2.1.2/reference/shapely.constrained_delaunay_triangles.html) - Inire requires Shapely 2.1 or newer with GEOS 3.10 or newer. In guide and seed modes, nets that receive no corridor can use ordinary lattice search. Set `node_limit=0` to verify supplied seeds without planning corridors. [Constrained triangulation requirements](https://shapely.readthedocs.io/en/2.1.2/reference/shapely.constrained_delaunay_triangles.html)
- Seed mode gives complete caller-supplied paths priority when they can be reserved without collisions. Partial paths are hints. Seed mode may replace them with complete paths generated from a corridor before the main search.
- Use `infer_terminal_headings` with automatic or bundle mode if your ports may change direction and the layout supports bundle planning. Compare fixed and flexible headings in [complex-routing example 1](../../examples/advanced.md#complex-routing-example-1). - Use `infer_terminal_headings` with automatic or bundle mode if your ports may change direction and the layout supports bundle planning. Compare fixed and flexible headings in [complex-routing example 1](../../examples/advanced.md#complex-routing-example-1).
- Automatic starts with smaller budgets and can retry up to your ceiling. It can try lattice search after constructive planning and corridor-guided search leave unresolved nets. - Automatic starts with smaller budgets and can retry up to your ceiling. It can try lattice search after constructive planning and corridor-guided search leave unresolved nets.

View file

@ -217,21 +217,9 @@ def _route_residual(
residual_mode: Literal["guide", "seed"] | None = None, residual_mode: Literal["guide", "seed"] | None = None,
run_route: RouteCall = route_once, run_route: RouteCall = route_once,
) -> tuple[RoutingRunResult, RoutingStage]: ) -> tuple[RoutingRunResult, RoutingStage]:
return _route_prepared_residual( residual_problem = _residual_problem(problem, locks)
_residual_problem(problem, locks), options, locks, residual_mode=residual_mode, run_route=run_route
)
def _route_prepared_residual(
problem: RoutingProblem,
options: RoutingOptions,
locks: LockPlan,
*,
residual_mode: Literal["guide", "seed"] | None = None,
run_route: RouteCall = route_once,
) -> tuple[RoutingRunResult, RoutingStage]:
direct = locks.direct direct = locks.direct
residual = problem.nets residual = residual_problem.nets
if not residual: if not residual:
mode = "off" mode = "off"
elif residual_mode is not None: elif residual_mode is not None:
@ -239,7 +227,7 @@ def _route_prepared_residual(
else: else:
max_offset = 2 * max(options.search.sbend_radii, default=0) max_offset = 2 * max(options.search.sbend_radii, default=0)
mode = "guide" if any(_is_short_shift(net, max_offset) for net in residual) else "seed" mode = "guide" if any(_is_short_shift(net, max_offset) for net in residual) else "seed"
run = run_route(problem, options=replace(options, topology=replace(options.topology, mode=mode))) run = run_route(residual_problem, options=replace(options, topology=replace(options.topology, mode=mode)))
skipped = tuple(sorted(locks.disconnected)) skipped = tuple(sorted(locks.disconnected))
return ( return (
replace(run, results_by_net={**direct, **run.results_by_net, **{net_id: RoutingResult(net_id, ()) for net_id in skipped}}), replace(run, results_by_net={**direct, **run.results_by_net, **{net_id: RoutingResult(net_id, ()) for net_id in skipped}}),