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
+9
View File
@@ -118,6 +118,14 @@ def build_parser() -> argparse.ArgumentParser:
help="grid and exact engines: cells K times finer than trace + clearance "
"(default 1); 2 or more reaches fine-pitch pins, at some cost in time",
)
parser.add_argument(
"--heuristic-weight",
type=float,
default=1.0,
metavar="W",
help="exact engine: weighted A* (W >= 1); larger is faster, routes at most "
"W times the shortest length (default 1)",
)
parser.add_argument(
"--edge-clearance",
type=float,
@@ -175,6 +183,7 @@ def main(argv: list[str] | None = None) -> int:
max_passes=max_passes,
edge_clearance_mm=args.edge_clearance,
resolution=args.grid_resolution,
heuristic_weight=args.heuristic_weight,
)
elif args.engine == "room":
result = build_rooms_routing_result(