Tighter A* estimate on the orthogonal track, and --heuristic-weight

The grid search estimated the remaining distance as a straight line even
when only orthogonal steps exist; Manhattan is the tighter estimate those
moves admit and still never overestimates. --heuristic-weight W (default
1) makes it weighted A*: routes at most W times the shortest (tested).
This commit is contained in:
2026-09-27 10:55:15 -06:00
parent 8929fd367e
commit 67c6c205f1
5 changed files with 47 additions and 1 deletions
+2
View File
@@ -93,6 +93,7 @@ def route_board_exact(
via_half: int | None = None,
edge_clearance: int | None = None,
resolution: int = 1,
heuristic_weight: float = 1.0,
) -> ExactRouteResult:
"""Route ``board`` orthogonally and verify the result with exact geometry.
@@ -120,6 +121,7 @@ def route_board_exact(
via_half=via_half,
edge_clearance=edge_clearance,
resolution=resolution,
heuristic_weight=heuristic_weight,
)
edge = 0 if edge_clearance is None else edge_clearance
outline = board.outline