Reuse geometry and conflict reports during seed replay
Check a replayed route against itself and fixed geometry before adding it to the collision index. Add cross-net conflicts once the index is populated, then share reports across review, traces, and the callback. Recheck changed geometry after refinement.
This commit is contained in:
parent
fd6f96f341
commit
8b32d68496
1 changed files with 129 additions and 54 deletions
|
|
@ -709,28 +709,15 @@ class RoutingWorld:
|
|||
frozen_net_ids=frozen_net_ids,
|
||||
)
|
||||
|
||||
def verify_path_details(
|
||||
self,
|
||||
net_id: str,
|
||||
components: Sequence[ComponentResult],
|
||||
*,
|
||||
capture_component_conflicts: bool = False,
|
||||
include_invalid_dynamic: bool = True,
|
||||
) -> PathVerificationDetail:
|
||||
if self.metrics is not None:
|
||||
self.metrics.total_verify_path_report_calls += 1
|
||||
def verify_path_geometry(self, components: Sequence[ComponentResult]) -> RoutingReport:
|
||||
"""Check continuity, self-spacing, the board, and static obstacles."""
|
||||
static_collision_count = 0
|
||||
dynamic_collision_count = 0
|
||||
total_length = sum(component.length for component in components)
|
||||
valid_geometry, continuous = check_path_geometry(components)
|
||||
if not valid_geometry:
|
||||
return PathVerificationDetail(RoutingReport(total_length=total_length, invalid_geometry=True))
|
||||
conflicting_net_ids: set[str] = set()
|
||||
component_conflicts: set[tuple[int, str, int]] = set()
|
||||
return RoutingReport(total_length=total_length, invalid_geometry=True)
|
||||
|
||||
static_obstacles = self._static_obstacles
|
||||
dynamic_paths = self._dynamic_paths
|
||||
|
||||
self._ensure_static_raw_tree()
|
||||
if static_obstacles.raw_tree is not None:
|
||||
raw_geometries = static_obstacles.raw_tree.geometries
|
||||
|
|
@ -749,14 +736,36 @@ class RoutingWorld:
|
|||
if violates(polygon, obstacle, self.clearance):
|
||||
static_collision_count += 1
|
||||
|
||||
report = RoutingReport(
|
||||
return RoutingReport(
|
||||
static_collision_count=static_collision_count,
|
||||
self_collision_count=count_path_self_collisions(components, self.self_clearance),
|
||||
total_length=total_length,
|
||||
out_of_bounds=self.board is not None and not path_within_board(components, self.board),
|
||||
discontinuous=not continuous,
|
||||
)
|
||||
if (include_invalid_dynamic or not report.intrinsic_collision_count) and dynamic_paths.has_physical_paths():
|
||||
|
||||
def verify_path_details(
|
||||
self,
|
||||
net_id: str,
|
||||
components: Sequence[ComponentResult],
|
||||
*,
|
||||
capture_component_conflicts: bool = False,
|
||||
include_invalid_dynamic: bool = True,
|
||||
geometry_report: RoutingReport | None = None,
|
||||
) -> PathVerificationDetail:
|
||||
"""Check the full path, optionally reusing its report against unchanged static geometry."""
|
||||
if self.metrics is not None:
|
||||
self.metrics.total_verify_path_report_calls += 1
|
||||
report = self.verify_path_geometry(components) if geometry_report is None else geometry_report
|
||||
dynamic_collision_count = 0
|
||||
conflicting_net_ids: set[str] = set()
|
||||
component_conflicts: set[tuple[int, str, int]] = set()
|
||||
|
||||
if (
|
||||
not report.invalid_geometry
|
||||
and (include_invalid_dynamic or not report.intrinsic_collision_count)
|
||||
and self._dynamic_paths.has_physical_paths()
|
||||
):
|
||||
for component_index, component in enumerate(components):
|
||||
component_hits: set[str] = set()
|
||||
for polygon in component.physical_geometry:
|
||||
|
|
@ -777,8 +786,10 @@ class RoutingWorld:
|
|||
dynamic_collision_count += len(component_hits)
|
||||
conflicting_net_ids.update(component_hits)
|
||||
|
||||
if dynamic_collision_count != report.dynamic_collision_count:
|
||||
report = replace(report, dynamic_collision_count=dynamic_collision_count)
|
||||
return PathVerificationDetail(
|
||||
report=replace(report, dynamic_collision_count=dynamic_collision_count) if dynamic_collision_count else report,
|
||||
report=report,
|
||||
conflicting_net_ids=tuple(sorted(conflicting_net_ids)),
|
||||
component_conflicts=tuple(sorted(component_conflicts)),
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue