Share the forward detour candidate budget across lanes
This commit is contained in:
parent
0847413ff6
commit
ccfe958cc3
2 changed files with 22 additions and 8 deletions
|
|
@ -312,10 +312,10 @@ def perimeter_detour_candidates(problem: RoutingProblem, search: SearchOptions)
|
|||
for x in (floor(left - radius - margin), ceil(right + radius + margin))
|
||||
if net.start.x + radius <= x <= net.target.x - radius
|
||||
)
|
||||
for y in lanes:
|
||||
for first, last in combinations(sorted(pivots), 2):
|
||||
if last - first < 2 * radius:
|
||||
continue
|
||||
for first, last in combinations(sorted(pivots), 2):
|
||||
if last - first < 2 * radius:
|
||||
continue
|
||||
for y in lanes:
|
||||
points = (
|
||||
(net.start.x, net.start.y),
|
||||
(first, net.start.y),
|
||||
|
|
|
|||
|
|
@ -126,9 +126,23 @@ def test_return_detours_try_inner_lanes_when_keepouts_reach_board_edges() -> Non
|
|||
assert run.results_by_net[net.net_id].is_valid
|
||||
|
||||
|
||||
def test_return_detours_try_both_sides_within_the_candidate_budget(monkeypatch) -> None:
|
||||
net = NetSpec("return", Port(130, 60, 0), Port(40, 60, 0))
|
||||
obstacles = (box(135, 42, 199, 48), *(box(x, 100, x + 1, 104) for x in (*range(10, 29, 3), *range(142, 181, 4))))
|
||||
@pytest.mark.parametrize(
|
||||
("start", "target", "obstacles", "direction"),
|
||||
[
|
||||
pytest.param(
|
||||
Port(130, 60, 0), Port(40, 60, 0),
|
||||
(box(135, 42, 199, 48), *(box(x, 100, x + 1, 104) for x in (*range(10, 29, 3), *range(142, 181, 4)))),
|
||||
"CCW", id="return",
|
||||
),
|
||||
pytest.param(
|
||||
Port(20, 60, 0), Port(120, 60, 0),
|
||||
(box(20, 67, 80, 73), box(85, 54, 90, 65), *(box(x, 100, x + 1, 104) for x in range(35, 86, 5))),
|
||||
"CW", id="forward",
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_perimeter_detours_try_both_sides_within_the_candidate_budget(monkeypatch, start, target, obstacles, direction) -> None:
|
||||
net = NetSpec("net", start, target)
|
||||
problem = RoutingProblem((0, 0, 200, 130), (net,), obstacles, clearance=0)
|
||||
original_detours = _automatic.perimeter_detour_candidates
|
||||
generated = 0
|
||||
|
|
@ -145,7 +159,7 @@ def test_return_detours_try_both_sides_within_the_candidate_budget(monkeypatch)
|
|||
result = run.results_by_net[net.net_id]
|
||||
assert run.automatic.selected_planner == "perimeter"
|
||||
assert result.is_valid
|
||||
assert next(move.direction for move in result.as_seed().segments if isinstance(move, Bend90Seed)) == "CCW"
|
||||
assert next(move.direction for move in result.as_seed().segments if isinstance(move, Bend90Seed)) == direction
|
||||
assert 0 < generated <= 32
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue