Fix retry accounting and preserve authored bend lengths in benchmarks
This commit is contained in:
parent
f609e5a695
commit
72f8fbda5a
1 changed files with 26 additions and 9 deletions
|
|
@ -59,12 +59,12 @@ class _RetryExperiment(_AutomaticRun):
|
|||
self.retry_policy = policy
|
||||
self.retry_attempts: list[dict] = []
|
||||
|
||||
def _record_retry(self, policy: str, outcome: str, started: float, first_run: int) -> None:
|
||||
def _record_retry(self, policy: str, outcome: str, started: float, first_attempt: int) -> None:
|
||||
self.retry_attempts.append({
|
||||
"policy": policy,
|
||||
"outcome": outcome,
|
||||
"elapsed_s": perf_counter() - started,
|
||||
"nodes_expanded": sum(metrics.nodes_expanded for metrics in self.metrics[first_run:]),
|
||||
"nodes_expanded": sum(metrics.nodes_expanded for metrics in self.attempts.samples[first_attempt:]),
|
||||
})
|
||||
|
||||
def _search_trials(self, trials: list[Trial], target: int) -> None:
|
||||
|
|
@ -105,10 +105,10 @@ class _RetryExperiment(_AutomaticRun):
|
|||
and _near_port_coverage_stalled(trials, target)
|
||||
):
|
||||
retry = replace(options, search=replace(options.search, node_limit=limit))
|
||||
started, first_run = perf_counter(), len(self.metrics)
|
||||
started, first_attempt = perf_counter(), len(self.attempts.samples)
|
||||
self._lattice_fallback(trials, retry, "Near-port and lookahead searches were one net short", policy="early-bounded-lattice")
|
||||
complete = len(trials[-1].valid_costs) == target
|
||||
self._record_retry("bounded-lattice", "complete" if complete else "incomplete", started, first_run)
|
||||
self._record_retry("bounded-lattice", "complete" if complete else "incomplete", started, first_attempt)
|
||||
if complete:
|
||||
return
|
||||
trials[-1] = replace(trials[-1], selection="incomplete-layout")
|
||||
|
|
@ -142,12 +142,12 @@ class _RetryExperiment(_AutomaticRun):
|
|||
policy: str,
|
||||
check_connectivity: bool = False,
|
||||
) -> list[Trial]:
|
||||
started, first_run = perf_counter(), len(self.metrics)
|
||||
started, first_attempt = perf_counter(), len(self.attempts.samples)
|
||||
if check_connectivity:
|
||||
with self._time("plan", policy=policy):
|
||||
blocked = _disconnected_nets(self.problem, self.board, options, retained)
|
||||
if blocked:
|
||||
self._record_retry(policy, "disconnected", started, first_run)
|
||||
self._record_retry(policy, "disconnected", started, first_attempt)
|
||||
return []
|
||||
|
||||
retry = replace(
|
||||
|
|
@ -164,7 +164,7 @@ class _RetryExperiment(_AutomaticRun):
|
|||
verified = self._verify_incumbent(trial)
|
||||
complete = len(verified.valid_costs) == target
|
||||
trials.append(verified if complete else replace(verified, selection="incomplete-layout"))
|
||||
self._record_retry(policy, "complete" if complete else "incomplete", started, first_run)
|
||||
self._record_retry(policy, "complete" if complete else "incomplete", started, first_attempt)
|
||||
return trials
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue