Reuse residual routing for perimeter recovery
This commit is contained in:
parent
15c2714f1f
commit
926b2645b5
1 changed files with 29 additions and 17 deletions
|
|
@ -35,6 +35,7 @@ from inire.router._routing_policy import (
|
|||
_is_short_shift,
|
||||
_residual_problem,
|
||||
_route_prepared_residual,
|
||||
_route_residual,
|
||||
_trial,
|
||||
)
|
||||
from inire.router._seed_materialization import materialize_path_seed
|
||||
|
|
@ -331,27 +332,20 @@ class _AutomaticRun:
|
|||
if not candidate.valid_costs:
|
||||
continue
|
||||
chosen = candidate.run.results_by_net[net.net_id]
|
||||
residual = replace(
|
||||
policy = "perimeter-residual"
|
||||
guide = replace(options, congestion=replace(options.congestion, max_iterations=1))
|
||||
run, stage = _route_residual(
|
||||
problem,
|
||||
nets=tuple(other for other in problem.nets if other != net),
|
||||
static_obstacles=problem.static_obstacles + chosen.locked_geometry,
|
||||
guide,
|
||||
LockPlan({net.net_id: chosen}),
|
||||
residual_mode="guide",
|
||||
run_route=partial(self._run, policy=policy),
|
||||
)
|
||||
guide = replace(options, topology=replace(options.topology, mode="guide"), congestion=replace(options.congestion, max_iterations=1))
|
||||
run = self._run(residual, options=guide, policy="perimeter-residual")
|
||||
combined = {net.net_id: chosen, **run.results_by_net}
|
||||
stage = RoutingStage(
|
||||
"guide",
|
||||
(net.net_id,),
|
||||
run.metrics.nodes_expanded,
|
||||
options.search.node_limit,
|
||||
kind="perimeter-residual",
|
||||
policy="perimeter-residual",
|
||||
planner="perimeter",
|
||||
)
|
||||
trials.append(self._trial(replace(run, results_by_net=combined), stage))
|
||||
stage = replace(stage, kind=policy, policy=policy, planner="perimeter")
|
||||
trials.append(self._trial(run, stage))
|
||||
if len(trials[-1].valid_costs) == len(problem.nets):
|
||||
trials[-1] = replace(trials[-1], selection="requires-layout-check")
|
||||
seeds = {net_id: result.as_seed() for net_id, result in combined.items()}
|
||||
seeds = {net_id: result.as_seed() for net_id, result in run.results_by_net.items()}
|
||||
trials.append(self._verify(replace(problem, initial_paths=seeds), "perimeter"))
|
||||
if len(trials[-1].valid_costs) == len(problem.nets):
|
||||
break
|
||||
|
|
|
|||
Loading…
Reference in a new issue