Illustrate the intermediate stages of complex-routing example 1

This commit is contained in:
Jan Petykiewicz 2026-11-27 19:28:48 -08:00
commit c3e420eadb

View file

@ -28,6 +28,9 @@ if TYPE_CHECKING:
from inire import RoutingRunResult
INPUTS = Path(__file__).with_name("advanced-layouts.json")
COMPLEX_EXAMPLE = "complex-routing-example-1"
COMPLEX_EXAMPLE_POINTS = f"{COMPLEX_EXAMPLE}-point-terminals"
_CASE_ALIASES = {"terminal-bench": COMPLEX_EXAMPLE, "terminal-bench-point-terminals": COMPLEX_EXAMPLE_POINTS}
COLORS = ("#007189", "#af511b", "#654a99", "#427326", "#b73c62", "#975b2d", "#2f569a", "#734359", "#328179")
@ -108,7 +111,10 @@ def _plot_case(problem: RoutingProblem, options: RoutingOptions, run: RoutingRun
def main() -> int:
layouts = loads(INPUTS.read_text(encoding="utf-8"))
parser = ArgumentParser(description=__doc__)
parser.add_argument("--case", action="append", choices=layouts, help="Layout to route. Repeat to select several. Defaults to all.")
parser.add_argument(
"--case", action="append", choices=layouts, type=lambda name: _CASE_ALIASES.get(name, name),
help="Layout to route. Repeat to select several. Defaults to all.",
)
parser.add_argument("--output-dir", type=Path, default=INPUTS.parent, help="Directory for the setup and result PNGs.")
args = parser.parse_args()
args.output_dir.mkdir(parents=True, exist_ok=True)