2026-03-06 18:48:04 -08:00
|
|
|
"""
|
2026-03-07 08:26:29 -08:00
|
|
|
inire Wave-router
|
2026-03-06 18:48:04 -08:00
|
|
|
"""
|
2026-03-30 19:51:37 -07:00
|
|
|
from collections.abc import Callable
|
|
|
|
|
|
|
|
|
|
from .geometry.primitives import Port as Port # noqa: PLC0414
|
|
|
|
|
from .model import (
|
2026-03-30 15:32:29 -07:00
|
|
|
CongestionOptions as CongestionOptions,
|
|
|
|
|
DiagnosticsOptions as DiagnosticsOptions,
|
|
|
|
|
NetSpec as NetSpec,
|
|
|
|
|
ObjectiveWeights as ObjectiveWeights,
|
|
|
|
|
RefinementOptions as RefinementOptions,
|
|
|
|
|
RoutingOptions as RoutingOptions,
|
|
|
|
|
RoutingProblem as RoutingProblem,
|
|
|
|
|
SearchOptions as SearchOptions,
|
|
|
|
|
) # noqa: PLC0414
|
2026-04-02 14:39:39 -07:00
|
|
|
from .results import ( # noqa: PLC0414
|
|
|
|
|
ComponentConflictTrace as ComponentConflictTrace,
|
|
|
|
|
ConflictTraceEntry as ConflictTraceEntry,
|
|
|
|
|
FrontierPruneSample as FrontierPruneSample,
|
2026-04-02 16:15:02 -07:00
|
|
|
IterationNetAttemptTrace as IterationNetAttemptTrace,
|
|
|
|
|
IterationTraceEntry as IterationTraceEntry,
|
2026-04-02 14:39:39 -07:00
|
|
|
NetConflictTrace as NetConflictTrace,
|
|
|
|
|
NetFrontierTrace as NetFrontierTrace,
|
2026-04-02 18:57:34 -07:00
|
|
|
PrePairFrontierTraceEntry as PrePairFrontierTraceEntry,
|
|
|
|
|
PrePairNetTrace as PrePairNetTrace,
|
2026-04-02 14:39:39 -07:00
|
|
|
RoutingResult as RoutingResult,
|
|
|
|
|
RoutingRunResult as RoutingRunResult,
|
|
|
|
|
)
|
2026-03-30 19:51:37 -07:00
|
|
|
from .seeds import Bend90Seed as Bend90Seed, PathSeed as PathSeed, SBendSeed as SBendSeed, StraightSeed as StraightSeed # noqa: PLC0414
|
2026-03-06 18:48:04 -08:00
|
|
|
|
|
|
|
|
__author__ = 'Jan Petykiewicz'
|
|
|
|
|
__version__ = '0.1'
|
2026-03-30 15:32:29 -07:00
|
|
|
|
2026-03-30 19:51:37 -07:00
|
|
|
|
|
|
|
|
def route(
|
|
|
|
|
problem: RoutingProblem,
|
|
|
|
|
*,
|
|
|
|
|
options: RoutingOptions | None = None,
|
|
|
|
|
iteration_callback: Callable[[int, dict[str, RoutingResult]], None] | None = None,
|
|
|
|
|
) -> RoutingRunResult:
|
|
|
|
|
from .router._stack import build_routing_stack
|
|
|
|
|
|
|
|
|
|
resolved_options = RoutingOptions() if options is None else options
|
|
|
|
|
stack = build_routing_stack(problem, resolved_options)
|
|
|
|
|
finder = stack.finder
|
|
|
|
|
results = finder.route_all(iteration_callback=iteration_callback)
|
|
|
|
|
return RoutingRunResult(
|
|
|
|
|
results_by_net=results,
|
|
|
|
|
metrics=finder.metrics.snapshot(),
|
|
|
|
|
expanded_nodes=tuple(finder.accumulated_expanded_nodes),
|
2026-04-02 14:39:39 -07:00
|
|
|
conflict_trace=tuple(finder.conflict_trace),
|
|
|
|
|
frontier_trace=tuple(finder.frontier_trace),
|
2026-04-02 18:57:34 -07:00
|
|
|
pre_pair_frontier_trace=finder.pre_pair_frontier_trace,
|
2026-04-02 16:15:02 -07:00
|
|
|
iteration_trace=tuple(finder.iteration_trace),
|
2026-03-30 19:51:37 -07:00
|
|
|
)
|
|
|
|
|
|
2026-03-30 15:32:29 -07:00
|
|
|
__all__ = [
|
2026-03-30 19:51:37 -07:00
|
|
|
"Bend90Seed",
|
2026-03-30 15:32:29 -07:00
|
|
|
"CongestionOptions",
|
2026-04-02 14:39:39 -07:00
|
|
|
"ComponentConflictTrace",
|
|
|
|
|
"ConflictTraceEntry",
|
2026-03-30 15:32:29 -07:00
|
|
|
"DiagnosticsOptions",
|
|
|
|
|
"NetSpec",
|
2026-04-02 14:39:39 -07:00
|
|
|
"NetConflictTrace",
|
|
|
|
|
"NetFrontierTrace",
|
2026-03-30 15:32:29 -07:00
|
|
|
"ObjectiveWeights",
|
2026-03-30 19:51:37 -07:00
|
|
|
"PathSeed",
|
2026-03-30 15:32:29 -07:00
|
|
|
"Port",
|
2026-04-02 14:39:39 -07:00
|
|
|
"FrontierPruneSample",
|
2026-04-02 16:15:02 -07:00
|
|
|
"IterationNetAttemptTrace",
|
|
|
|
|
"IterationTraceEntry",
|
2026-04-02 18:57:34 -07:00
|
|
|
"PrePairFrontierTraceEntry",
|
|
|
|
|
"PrePairNetTrace",
|
2026-03-30 15:32:29 -07:00
|
|
|
"RefinementOptions",
|
|
|
|
|
"RoutingOptions",
|
|
|
|
|
"RoutingProblem",
|
|
|
|
|
"RoutingResult",
|
|
|
|
|
"RoutingRunResult",
|
2026-03-30 19:51:37 -07:00
|
|
|
"SBendSeed",
|
2026-03-30 15:32:29 -07:00
|
|
|
"SearchOptions",
|
2026-03-30 19:51:37 -07:00
|
|
|
"StraightSeed",
|
2026-03-30 15:32:29 -07:00
|
|
|
"route",
|
|
|
|
|
]
|