Allow residual dogleg seeds beyond the lattice scan length
This commit is contained in:
parent
5255b96e6a
commit
0e923daa9c
2 changed files with 23 additions and 3 deletions
|
|
@ -66,7 +66,7 @@ def residual_dogleg_candidates(problem: RoutingProblem, search: SearchOptions) -
|
||||||
lanes.update((floor(bottom), ceil(top)))
|
lanes.update((floor(bottom), ceil(top)))
|
||||||
lanes = {y for y in lanes if floor_y + half_width <= y <= ceiling_y - half_width}
|
lanes = {y for y in lanes if floor_y + half_width <= y <= ceiling_y - half_width}
|
||||||
ordered_lanes = sorted(lanes, key=lambda y: (abs(y - start_y) + abs(y - end_y), y))
|
ordered_lanes = sorted(lanes, key=lambda y: (abs(y - start_y) + abs(y - end_y), y))
|
||||||
minimum, maximum = max(0.0, search.min_straight_length), search.max_straight_length
|
minimum = search.min_straight_length
|
||||||
remaining = 16384
|
remaining = 16384
|
||||||
for radius in sorted({int(r) for r in search.bend_radii if isfinite(r) and r > 0 and r == int(r)}):
|
for radius in sorted({int(r) for r in search.bend_radii if isfinite(r) and r > 0 and r == int(r)}):
|
||||||
first, last = ceil(start_x + radius + minimum), floor(end_x - radius - minimum)
|
first, last = ceil(start_x + radius + minimum), floor(end_x - radius - minimum)
|
||||||
|
|
@ -89,14 +89,14 @@ def residual_dogleg_candidates(problem: RoutingProblem, search: SearchOptions) -
|
||||||
if not remaining:
|
if not remaining:
|
||||||
return
|
return
|
||||||
remaining -= 1
|
remaining -= 1
|
||||||
if not 2 * radius + minimum <= b - a <= 2 * radius + maximum:
|
if b - a < 2 * radius + minimum:
|
||||||
continue
|
continue
|
||||||
if not straight_clear(a + radius, y, b - radius, y):
|
if not straight_clear(a + radius, y, b - radius, y):
|
||||||
continue
|
continue
|
||||||
points = tuple(physical(x, h) for x, h in ((start_x, start_y), (a, start_y), (a, y), (b, y), (b, end_y), (end_x, end_y)))
|
points = tuple(physical(x, h) for x, h in ((start_x, start_y), (a, start_y), (a, y), (b, y), (b, end_y), (end_x, end_y)))
|
||||||
seed, end = compile_waypoints(points, net.start, radius)
|
seed, end = compile_waypoints(points, net.start, radius)
|
||||||
if end == net.target and all(
|
if end == net.target and all(
|
||||||
not isinstance(move, StraightSeed) or minimum <= move.length <= maximum for move in seed.segments
|
not isinstance(move, StraightSeed) or minimum <= move.length for move in seed.segments
|
||||||
):
|
):
|
||||||
yield seed
|
yield seed
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,26 @@ def test_stress_residual_dogleg_completes_layout_before_wider_search() -> None:
|
||||||
assert iterations == list(range(observed.metrics.route_iterations))
|
assert iterations == list(range(observed.metrics.route_iterations))
|
||||||
|
|
||||||
|
|
||||||
|
def test_residual_dogleg_seeds_can_use_straights_longer_than_the_lattice_scan() -> None:
|
||||||
|
case = next(case for case in STRESS_BENCHMARK_CASES if case.name == "stress-retry-straight-decoy")
|
||||||
|
options = replace(
|
||||||
|
case.options,
|
||||||
|
search=replace(case.options.search, node_limit=25, max_straight_length=180),
|
||||||
|
congestion=replace(case.options.congestion, max_iterations=1, warm_start_enabled=False),
|
||||||
|
refinement=replace(case.options.refinement, enabled=False),
|
||||||
|
topology=TopologyOptions(mode="automatic"),
|
||||||
|
)
|
||||||
|
|
||||||
|
run = route(case.problem, options=options)
|
||||||
|
|
||||||
|
assert run.automatic.selected_planner == "residual-dogleg"
|
||||||
|
assert all(run.results_by_net[net.net_id].is_valid for net in case.problem.nets)
|
||||||
|
assert any(
|
||||||
|
isinstance(move, StraightSeed) and move.length > options.search.max_straight_length
|
||||||
|
for move in run.results_by_net["trunk"].as_seed().segments
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(("iterations", "probe_limit"), [(1, 1), (3, 2)])
|
@pytest.mark.parametrize(("iterations", "probe_limit"), [(1, 1), (3, 2)])
|
||||||
def test_automatic_probe_caps_iterations_and_preserves_callback_order(monkeypatch, iterations, probe_limit) -> None:
|
def test_automatic_probe_caps_iterations_and_preserves_callback_order(monkeypatch, iterations, probe_limit) -> None:
|
||||||
(case,) = CASE_GROUPS["pic-splitter-tree-1x8-ew"]
|
(case,) = CASE_GROUPS["pic-splitter-tree-1x8-ew"]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue