Share worker setup, residual preparation, and scenario capture
This commit is contained in:
parent
591560949c
commit
0c059cc7d6
1 changed files with 88 additions and 151 deletions
|
|
@ -34,7 +34,7 @@ from inire.router._routing_policy import (
|
|||
_disconnected_nets,
|
||||
_is_short_shift,
|
||||
_residual_problem,
|
||||
_route_residual,
|
||||
_route_prepared_residual,
|
||||
_trial,
|
||||
)
|
||||
from inire.router._seed_materialization import materialize_path_seed
|
||||
|
|
@ -379,7 +379,8 @@ class _AutomaticRun:
|
|||
|
||||
policy = "incumbent-residual"
|
||||
locks = LockPlan(retained)
|
||||
run, stage = _route_residual(problem, options, locks, residual_mode="seed", run_route=partial(self._run, policy=policy))
|
||||
residual = _residual_problem(problem, locks)
|
||||
run, stage = _route_prepared_residual(residual, options, locks, residual_mode="seed", run_route=partial(self._run, policy=policy))
|
||||
stage = replace(stage, kind=policy, policy=policy, retry_reason="Residual terminals remain connected with the incumbents locked")
|
||||
trial = self._trial(run, stage)
|
||||
if len(trial.valid_costs) == len(problem.nets):
|
||||
|
|
@ -389,7 +390,7 @@ class _AutomaticRun:
|
|||
dogleg = self._residual_dogleg_trial(options, _best_trial([best, trial]))
|
||||
if dogleg is not None:
|
||||
return [trial, dogleg]
|
||||
joint = self._joint_lane_trial(options, locks, trial)
|
||||
joint = self._joint_lane_trial(residual, options, locks, trial)
|
||||
if joint is not None:
|
||||
trials.append(replace(joint, selection="requires-layout-check"))
|
||||
if joint.improves_on(_best_trial([best, trial])):
|
||||
|
|
@ -540,8 +541,7 @@ class _AutomaticRun:
|
|||
stage = RoutingStage("seed", (), run.metrics.nodes_expanded, options.search.node_limit, policy="seed-fallback")
|
||||
trials.append(self._trial(run, stage))
|
||||
|
||||
def _joint_lane_trial(self, options: RoutingOptions, locks: LockPlan, previous: Trial) -> Trial | None:
|
||||
residual = _residual_problem(self.problem, locks)
|
||||
def _joint_lane_trial(self, residual: RoutingProblem, options: RoutingOptions, locks: LockPlan, previous: Trial) -> Trial | None:
|
||||
if len(residual.nets) < 2:
|
||||
return None
|
||||
policy = "joint-portal-lanes"
|
||||
|
|
@ -560,8 +560,8 @@ class _AutomaticRun:
|
|||
if not corridors:
|
||||
return None
|
||||
retry = replace(options, congestion=replace(options.congestion, max_iterations=min(3, options.congestion.max_iterations)))
|
||||
run, stage = _route_residual(
|
||||
self.problem, retry, locks, residual_mode="seed", run_route=partial(self._run, policy=policy, corridors=corridors)
|
||||
run, stage = _route_prepared_residual(
|
||||
residual, retry, locks, residual_mode="seed", run_route=partial(self._run, policy=policy, corridors=corridors)
|
||||
)
|
||||
stage = replace(
|
||||
stage,
|
||||
|
|
|
|||
Loading…
Reference in a new issue