Verify route continuity and simplify automatic search setup

This commit is contained in:
Jan Petykiewicz 2026-11-27 15:21:37 -08:00
commit def1e4ea1d

View file

@ -414,14 +414,12 @@ def _column_sbend_schedules(
problem: RoutingProblem,
layout: _ColumnLayout,
radius: int,
spans: dict[int, int],
weights: Mapping[str, float],
*,
weighted: bool,
sbend_penalty: float,
) -> Iterator[tuple[tuple[_BendSequence, ...], ...]]:
spans = exact_sbend_spans(radius)
if not spans:
return
modulus = gcd(*spans)
launch, arrival = layout.launch, layout.arrival
residues = tuple(y % modulus for y in launch)
@ -476,12 +474,17 @@ def column_seed_candidates(
bend = min(search.sbend_radii, default=0.0)
if problem.initial_paths or physical_geometry != "arc" or not isfinite(bend) or bend <= 0 or bend != int(bend):
return
radius = int(bend)
spans = {d: span for d, span in exact_sbend_spans(radius).items() if search.allows_sbend_offset(d) or search.allows_sbend_offset(-d)}
if not spans:
return
layout = _column_layout(problem)
if layout is None:
return
radius = int(bend)
for moves in _column_sbend_schedules(problem, layout, radius, weights, weighted=weighted, sbend_penalty=sbend_penalty):
yield _seeds(layout.tracks, layout.spans, moves, radius)
for moves in _column_sbend_schedules(problem, layout, radius, spans, weights, weighted=weighted, sbend_penalty=sbend_penalty):
seeds = _seeds(layout.tracks, layout.spans, moves, radius)
if all(search.allows_seed(seed) for seed in seeds.values()):
yield seeds
def _jog_pivots(