Make retry exports optional and report benchmark placement and selection
This commit is contained in:
parent
f247cff54a
commit
f6e7bac4c5
1 changed files with 78 additions and 20 deletions
|
|
@ -61,6 +61,7 @@ class RunSample:
|
|||
bundle_rejection: str | None = None
|
||||
bundle_duration_s: float | None = None
|
||||
selected_stage: int = 0
|
||||
selected_attempt: int | None = None
|
||||
capacity_limit: CapacityLimit | None = None
|
||||
planner_rejections: tuple[str, ...] = ()
|
||||
port_conflicts: tuple[tuple[str, str], ...] = ()
|
||||
|
|
@ -116,7 +117,17 @@ def _order_trials(problem: RoutingProblem, options: RoutingOptions, strategy: st
|
|||
def _measure(case: BenchmarkCase, options: RoutingOptions, strategy: str) -> RunSample:
|
||||
board = box(*case.problem.bounds)
|
||||
attempt_options: list[RoutingOptions] = []
|
||||
run_route = partial(_route, run_router=partial(_dispatch_route, attempt_callback=attempt_options.append))
|
||||
selected_attempt: int | None = None
|
||||
|
||||
def select_attempt(index: int) -> None:
|
||||
nonlocal selected_attempt
|
||||
selected_attempt = index
|
||||
|
||||
dispatch = partial(
|
||||
_dispatch_route, attempt_callback=attempt_options.append,
|
||||
selected_attempt_callback=select_attempt if strategy in ("guide", "seed") else None,
|
||||
)
|
||||
run_route = partial(_route, run_router=dispatch)
|
||||
run_worker = partial(route_once, attempt_callback=attempt_options.append)
|
||||
|
||||
def measure_direct(problem: RoutingProblem, policy: str) -> tuple[RoutingRunResult, list[Trial]]:
|
||||
|
|
@ -203,6 +214,7 @@ def _measure(case: BenchmarkCase, options: RoutingOptions, strategy: str) -> Run
|
|||
bundle_rejection=bundle_rejection,
|
||||
bundle_duration_s=bundle_duration,
|
||||
selected_stage=next(i for i, trial in enumerate(trials) if trial is best),
|
||||
selected_attempt=selected_attempt,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue