Repository navigation
irregular: new linear programming engine for the local search - #736
Merged
Merged
Conversation
fontanf
force-pushed
the
irregular-local-search-linear-programming-eta
branch
from
October 22, 2026 21:03
d10092d to
a253105
Compare
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
force-pushed
the
irregular-local-search-linear-programming-eta
branch
from
October 22, 2026 21:15
a253105 to
aeaa20e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
LinearProgrammingSeparatorplugs into the shared iterated local search (run_iterated_local_searchis now a template on the separator type):The previous linear programming engine is removed, with
linear_programming_minimize_shrinkageand the parameternot_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_anchormoves fromsrc/irregular/linear_programming.{hpp,cpp}tosrc/irregular/linear_programming/anchor.{hpp,cpp}, andfind_best_edge_separatortosrc/irregular/utils.hpp.Benchmark
Literature strip packing instances, 120 s, seeds 0 and 1, best density (%):
("-": 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:
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.