Skip to content

irregular: new linear programming engine for the local search - #736

Merged
fontanf merged 1 commit into
masterfrom
irregular-local-search-linear-programming-eta
Oct 22, 2026
Merged

fontanf merged 1 commit into
masterfrom
irregular-local-search-linear-programming-eta

Conversation

@fontanf

@fontanf fontanf commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

The linear programming engine of the local search is rewritten on top of the population-based iterated local search shared with the direct trigonometry engine.

Model

The items may be shrunk instead of overlapping: an item with scale λ ∈ [0, 1] is its shape scaled by λ around its reference point.

For each pair of convex parts close to each other, the edge which separates them the best in the current state is selected. The constraint is that the signed distance from the line through this edge to the closest vertex of the other part is at least η (plus the minimum spacing). For a fixed edge, this vertex doesn't depend on the translations and the scales, so the constraint is linear in the positions and the scales, and a non-negative value proves that the two parts don't overlap.

A step solves the linear program maximizing η first, then the weighted sum of the scales, the items staying in a small box around their current positions (BinSeparationModel, one per bin).

Separator

LinearProgrammingSeparator plugs into the shared iterated local search (run_iterated_local_search is now a template on the separator type):

  • a separation runs linear programs until all the items have their full size, or until 4 linear programs without improvement of the loss (2 while the loss isn't below the reference loss);
  • trust region: after a linear program without improvement, the separation restarts from the best layout with a movement box halved;
  • the weights of the items which stay shrunk increase, as in guided local search;
  • the perturbation takes the most shrunk item out and inserts it again in a random bin, at a random position, with a random allowed orientation and a null scale.

The previous linear programming engine is removed, with linear_programming_minimize_shrinkage and the parameter not_anytime_local_search_maximum_number_of_iterations_without_improvement (C++, command line, Python). It also avoids the HiGHS issue with initial solutions (ERGO-Code/HiGHS#3454): no initial solution is passed to the solver.

The directories of the engines are renamed: src/irregular/local_search_direct_trigonometry → src/irregular/direct_trigonometry, src/irregular/local_search_linear_programming → src/irregular/linear_programming. linear_programming_anchor moves from src/irregular/linear_programming.{hpp,cpp} to src/irregular/linear_programming/anchor.{hpp,cpp}, and find_best_edge_separator to src/irregular/utils.hpp.

Benchmark

Literature strip packing instances, 120 s, seeds 0 and 1, best density (%):

instance BKS previous LP engine new LP engine DT engine
albano 89.54 64.71 83.30 88.48
blaz 85.49 53.89 78.73 83.65
dagli 89.33 46.88 83.16 87.69
fu 92.40 58.41 85.88 90.44
jakobs1 89.09 42.78 81.66 89.07
jakobs2 84.90 - 76.30 83.52
mao 86.43 - 78.79 84.75
marques 91.02 50.29 84.32 89.85
shapes0 68.79 - 61.37 67.18
shapes1 76.05 31.67 65.71 74.74
shirts 89.91 48.02 81.80 87.88
swim 78.37 40.04 64.36 76.27
trousers 91.82 64.23 84.17 90.46
mean gap to BKS 37.21 (10 instances) 7.97 1.47

("-": no solution, the previous engine crashed or didn't find any.)

The direct trigonometry engine stays much better: its separations move each colliding item to the best of many sampled positions in the whole bin, while the linear programs only move the items slightly. Variants tried for the new engine, mean gap to BKS:

variant mean gap
perturbation: swap two large items with random orientations 14.26
perturbation: reinsertion of the most shrunk item 8.22
reinsertion at the best of 16 random placements (smallest penetration) 8.35
reinsertion at the best of 4 random placements 8.80
separation patience 32 / 8 (instead of 8 / 3) 10.70
separation patience 4 / 2 (kept) 7.97
weights increased by 1 - λ instead of 1 8.13

The reinsertion perturbation was also tried for the direct trigonometry engine: mean gap 1.84 instead of 1.47 with the swap, so it isn't kept.

@fontanf
fontanf force-pushed the irregular-local-search-linear-programming-eta branch from d10092d to a253105 Compare October 22, 2026 21:03
The linear programming engine of the local search is rewritten on top of the
population-based iterated local search shared with the direct trigonometry
engine.

The items may be shrunk instead of overlapping: an item with scale lambda is
its shape scaled by lambda around its reference point. For each pair of
convex parts close to each other, the edge which separates them the best is
selected; the separation constraint is then linear in the positions and the
scales. A separation solves linear programs which maximize the separation
first, then the weighted sum of the scales, the items staying in a small box
around their positions (trust region). The weights of the items which stay
shrunk increase, as in guided local search. The perturbation takes the most
shrunk item out and inserts it again at a random position, with a random
allowed orientation.

The previous linear programming engine, with
'linear_programming_minimize_shrinkage' and the parameter
'not_anytime_local_search_maximum_number_of_iterations_without_improvement',
is removed.

The directories of the engines are renamed 'direct_trigonometry' and
'linear_programming'. 'linear_programming_anchor' moves to
'linear_programming/anchor', and 'find_best_edge_separator' to 'utils.hpp'.
@fontanf
fontanf force-pushed the irregular-local-search-linear-programming-eta branch from a253105 to aeaa20e Compare October 22, 2026 21:15
@fontanf
fontanf merged commit 3156893 into master Oct 22, 2026
16 checks passed
@fontanf
fontanf deleted the irregular-local-search-linear-programming-eta branch October 22, 2026 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant