inire/inire/__init__.py

59 lines
1.7 KiB
Python

"""
inire Wave-router
"""
from collections.abc import Callable
from .geometry.primitives import Port as Port # noqa: PLC0414
from .model import (
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
from .results import RoutingResult as RoutingResult, RoutingRunResult as RoutingRunResult # noqa: PLC0414
from .seeds import Bend90Seed as Bend90Seed, PathSeed as PathSeed, SBendSeed as SBendSeed, StraightSeed as StraightSeed # noqa: PLC0414
__author__ = 'Jan Petykiewicz'
__version__ = '0.1'
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),
)
__all__ = [
"Bend90Seed",
"CongestionOptions",
"DiagnosticsOptions",
"NetSpec",
"ObjectiveWeights",
"PathSeed",
"Port",
"RefinementOptions",
"RoutingOptions",
"RoutingProblem",
"RoutingResult",
"RoutingRunResult",
"SBendSeed",
"SearchOptions",
"StraightSeed",
"route",
]