Reuse the verified review of the installed best iteration
This commit is contained in:
parent
0319274163
commit
16145714a8
2 changed files with 10 additions and 3 deletions
|
|
@ -1139,12 +1139,16 @@ class PathFinder:
|
|||
timed_out = self._run_iterations(state, iteration_callback)
|
||||
self.accumulated_expanded_nodes = list(state.accumulated_expanded_nodes)
|
||||
# A partial iteration or a callback can leave the index out of sync with the saved results.
|
||||
if timed_out or iteration_callback is not None or not state.best_is_installed:
|
||||
best_is_live = not timed_out and iteration_callback is None and state.best_is_installed
|
||||
if not best_is_live:
|
||||
self._restore_best_iteration(state)
|
||||
|
||||
diagnostics = self.context.options.diagnostics
|
||||
if not timed_out or diagnostics.capture_conflict_trace or diagnostics.capture_pre_pair_frontier_trace:
|
||||
review = self._review_restored_best(state)
|
||||
capture_restored = diagnostics.capture_conflict_trace or diagnostics.capture_pre_pair_frontier_trace
|
||||
if not timed_out or capture_restored:
|
||||
review = state.best_review if best_is_live and not capture_restored else None
|
||||
if review is None:
|
||||
review = self._review_restored_best(state)
|
||||
if not timed_out:
|
||||
self._run_pair_local_search(state, review)
|
||||
if not timed_out:
|
||||
|
|
|
|||
|
|
@ -258,6 +258,8 @@ def test_installed_best_iteration_respects_callback_edits(mutate_results: bool)
|
|||
assert world.has_dynamic_paths() is not mutate_results
|
||||
assert finder.metrics.snapshot().dynamic_path_objects_added == 1
|
||||
assert finder.metrics.snapshot().dynamic_path_objects_removed == int(mutate_results)
|
||||
if not mutate_results:
|
||||
assert finder.metrics.snapshot().verify_path_report_calls == 3
|
||||
|
||||
|
||||
def test_capture_conflict_trace_preserves_route_outputs() -> None:
|
||||
|
|
@ -764,6 +766,7 @@ def test_route_all_restores_best_iteration_snapshot(monkeypatch: pytest.MonkeyPa
|
|||
assert results["netA"].outcome == "completed"
|
||||
assert results["netB"].outcome == "unroutable"
|
||||
assert evaluator.collision_engine.has_dynamic_paths()
|
||||
assert pathfinder.metrics.snapshot().verify_path_report_calls == 1
|
||||
|
||||
|
||||
def test_first_iteration_and_pair_length_tie_break() -> None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue