Improve automatic routing retries and reuse component geometry
Try verified perimeter construction early and reuse probe routes as movable hints during lookahead. Batch collision checks and cache component generation for repeated placement and refinement candidates.
This commit is contained in:
parent
9e41c1abf8
commit
ed52ea6ffd
1 changed files with 160 additions and 55 deletions
|
|
@ -54,7 +54,9 @@ def materialize_path_seed(
|
|||
clearance: float,
|
||||
bounds: tuple[float, float, float, float] | None = None,
|
||||
diagnostic: bool = False,
|
||||
component_cache: dict[tuple[Port, PathSegmentSeed], ComponentResult] | None = None,
|
||||
) -> tuple[ComponentResult, ...] | None:
|
||||
"""Materialize a seed, optionally reusing moves with the same geometry settings."""
|
||||
if diagnostic:
|
||||
error = seed_preparation_error(seed, start=start, net_width=net_width, search=search, clearance=clearance)
|
||||
if error is not None:
|
||||
|
|
@ -67,6 +69,13 @@ def materialize_path_seed(
|
|||
bend_clip_margin = search.bend_clip_margin
|
||||
|
||||
for index, segment in enumerate(seed.segments, start=1):
|
||||
if component_cache is not None:
|
||||
key = (current, segment)
|
||||
cached = component_cache.get(key)
|
||||
if cached is not None:
|
||||
path.append(cached)
|
||||
current = cached.end_port
|
||||
continue
|
||||
kind, parameters = seed_move(segment)
|
||||
try:
|
||||
template = search.sbend_template(segment.offset, segment.radius, net_width) if isinstance(segment, SBendSeed) else None
|
||||
|
|
@ -87,6 +96,8 @@ def materialize_path_seed(
|
|||
if diagnostic:
|
||||
raise SeedMaterializationError(f"segment {index} ({type(segment).__name__}) {exc}") from exc
|
||||
return None
|
||||
if component_cache is not None and len(component_cache) < 256:
|
||||
component_cache[key] = component
|
||||
path.append(component)
|
||||
current = component.end_port
|
||||
return tuple(path)
|
||||
|
|
|
|||
Loading…
Reference in a new issue