misc doc updates

This commit is contained in:
Jan Petykiewicz 2026-03-08 23:34:18 -07:00
commit 4714bed9a8
14 changed files with 65 additions and 28 deletions

View file

@ -25,11 +25,26 @@ class RoutingResult:
class PathFinder:
"""Multi-net router using Negotiated Congestion."""
def __init__(self, router: AStarRouter, cost_evaluator: CostEvaluator) -> None:
def __init__(
self,
router: AStarRouter,
cost_evaluator: CostEvaluator,
max_iterations: int = 10,
base_congestion_penalty: float = 100.0,
) -> None:
"""
Initialize the PathFinder.
Args:
router: The A* search engine.
cost_evaluator: The evaluator for path costs.
max_iterations: Maximum number of rip-up and reroute iterations.
base_congestion_penalty: Starting penalty for overlaps.
"""
self.router = router
self.cost_evaluator = cost_evaluator
self.max_iterations = 10
self.base_congestion_penalty = 100.0
self.max_iterations = max_iterations
self.base_congestion_penalty = base_congestion_penalty
def route_all(self, netlist: dict[str, tuple[Port, Port]], net_widths: dict[str, float]) -> dict[str, RoutingResult]:
"""Route all nets in the netlist using Negotiated Congestion."""

View file

@ -40,8 +40,8 @@ def test_astar_sbend(basic_evaluator: CostEvaluator) -> None:
def test_pathfinder_negotiated_congestion_resolution(basic_evaluator: CostEvaluator) -> None:
router = AStarRouter(basic_evaluator)
pf = PathFinder(router, basic_evaluator)
pf.max_iterations = 10
# Increase base penalty to force detour immediately
pf = PathFinder(router, basic_evaluator, max_iterations=10, base_congestion_penalty=1000.0)
netlist = {
"net1": (Port(0, 0, 0), Port(50, 0, 0)),
@ -57,9 +57,6 @@ def test_pathfinder_negotiated_congestion_resolution(basic_evaluator: CostEvalua
basic_evaluator.collision_engine.add_static_obstacle(obs_bottom)
basic_evaluator.danger_map.precompute([obs_top, obs_bottom])
# Increase base penalty to force detour immediately
pf.base_congestion_penalty = 1000.0
results = pf.route_all(netlist, net_widths)
assert results["net1"].is_valid