example fixes and improvements

This commit is contained in:
Jan Petykiewicz 2026-03-30 23:40:29 -07:00
commit e2c91076f7

View file

@ -253,6 +253,7 @@ def run_example_06() -> ScenarioOutcome:
box(40, 60, 60, 80),
box(40, 10, 60, 30),
]
custom_physical = Polygon([(0, -11), (11, -11), (11, 0), (9, 0), (9, -9), (0, -9)])
scenarios = [
(
_build_evaluator(bounds, obstacles=obstacles),
@ -268,12 +269,12 @@ def run_example_06() -> ScenarioOutcome:
),
(
_build_evaluator(bounds, obstacles=obstacles),
{"clipped_model": (Port(10, 20, 0), Port(90, 40, 90))},
{"clipped_model": 2.0},
{"custom_geometry": (Port(10, 20, 0), Port(90, 40, 90))},
{"custom_geometry": 2.0},
{
"bend_radii": [10.0],
"bend_collision_type": "clipped_bbox",
"bend_clip_margin": 1.0,
"bend_physical_geometry": custom_physical,
"bend_proxy_geometry": custom_physical,
"use_tiered_strategy": False,
},
),
@ -353,27 +354,29 @@ def run_example_07() -> ScenarioOutcome:
def run_example_08() -> ScenarioOutcome:
bounds = (0, 0, 150, 150)
netlist = {"custom_bend": (Port(20, 20, 0), Port(100, 100, 90))}
widths = {"custom_bend": 2.0}
custom_model = Polygon([(-10, -10), (10, -10), (10, 10), (-10, 10)])
evaluator = _build_evaluator(bounds)
netlist = {"standard_arc": (Port(20, 20, 0), Port(100, 100, 90))}
widths = {"standard_arc": 2.0}
custom_physical = Polygon([(0, -11), (11, -11), (11, 0), (9, 0), (9, -9), (0, -9)])
custom_proxy = box(0, -11, 11, 0)
t0 = perf_counter()
results_std = _build_pathfinder(
evaluator,
_build_evaluator(bounds),
bounds=bounds,
nets=_net_specs(netlist, widths),
bend_radii=[10.0],
sbend_radii=[],
max_iterations=1,
use_tiered_strategy=False,
metrics=AStarMetrics(),
).route_all()
results_custom = _build_pathfinder(
evaluator,
_build_evaluator(bounds),
bounds=bounds,
nets=_net_specs({"custom_model": netlist["custom_bend"]}, {"custom_model": 2.0}),
nets=_net_specs({"custom_geometry_and_proxy": netlist["standard_arc"]}, {"custom_geometry_and_proxy": 2.0}),
bend_radii=[10.0],
bend_collision_type=custom_model,
bend_physical_geometry=custom_physical,
bend_proxy_geometry=custom_proxy,
sbend_radii=[],
max_iterations=1,
use_tiered_strategy=False,