Skip to content

rectangle: add the tree search on packing classes - #812

Merged
fontanf merged 1 commit into
masterfrom
rectangle-tree-search-packing-classes
Nov 5, 2026
Merged

fontanf merged 1 commit into
masterfrom
rectangle-tree-search-packing-classes

Conversation

@fontanf

@fontanf fontanf commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Adds tree_search_packing_classes, an exact algorithm for the feasibility objective with a single bin, following Fekete, Schepers and van der Veen (2007). Unlike the contiguity Benders decomposition, its running time doesn't depend on the size of the bin.

Algorithm

For each axis and each pair of items, the search decides whether their projections overlap or are disjoint, without fixing positions. The positions are computed at the end from transitive orientations of the graphs of the disjoint pairs (Fekete and Schepers, 2004).

  • Rotations are fixed first, the largest items first.
  • Propagation:
    • pairs too long to fit side by side overlap;
    • every pair is disjoint along at least one axis;
    • greedy cliques of disjoint pairs must fit in the bin;
    • the overlap graphs contain no induced cycle of length 4.
  • Branching on obstructions: the graph of the pairs not known to overlap is not a comparability graph (implication classes, Golumbic 1980), or its longest chain doesn't fit in the bin. The chosen pair is the one taking the largest fraction of the bin along the other axis.
  • Symmetry breaking of indistinguishable items (Lemma 8 of the paper).

It supports rotations and eligibilities. It doesn't support defects, fixed items, unloading constraints, maximum weight or resources.

Integration

  • It runs in the exact mode for the feasibility objective with a single bin, alongside the other algorithms. It can be selected with --use-tree-search-packing-classes / use_tree_search_packing_classes.
  • New options benders_decomposition_subproblem_use_benders_decomposition_contiguity and benders_decomposition_subproblem_use_tree_search_packing_classes (CLI and Python) select the algorithms solving the feasibility subproblems of the Benders decomposition. The tree search is kept to find the packings of the feasible subproblems. If neither option is set, the selection stays automatic as before.

Benchmark

The benchmark used the subproblems that the Benders decomposition solves on the oriented knapsack instances (data_knapsack_oriented.csv): 771 distinct infeasible subproblems that took more than 10 ms. Each was solved alone, in the exact mode, with a 10 s time limit:

Proven infeasible Total time
Tree search on packing classes 770 121 s
Benders decomposition with contiguity 718 691 s
  • The new algorithm is much faster on fekete1997/okp1, okp2 and cung2000/CHL2.
  • It is slower on hifi1997a/A2 and christofides1977/cgcut2. There, the infeasibility comes from item lengths that can't be combined to fill the bin along an axis: the contiguity master problem proves it at its first iteration, while the packing-class search has no reasoning on coordinates until the packing class is complete.
  • The two algorithms are complementary and run in parallel in the exact mode.

Tests and documentation

  • Validation and eligibility tests.
  • Parametrized test on instance and solution files:
    • new fixtures;
    • the feasibility fixtures of the contiguity decomposition test;
    • three subproblems from the benchmark.
  • Brute-force test: on 5000 random small instances, the search must find a packing iff a brute-force enumeration on normal patterns does, and otherwise prove infeasibility. It catches a broken induced-cycle rule, a broken symmetry rule and an off-by-one in the clique bound.
  • Documentation page doc/internals/rectangle/tree_search_packing_classes.rst, with figures, and an update of the algorithm selection page.

Exact algorithm for the 'Feasibility' objective with a single bin, following
Fekete, Schepers and van der Veen (2007): for each axis and each pair of
items, the search decides whether their projections overlap or are
disjoint, and only computes the positions once these relations form a valid
packing class. Its running time doesn't depend on the size of the bin.

- Propagation: pairs too long to be side by side, pairs disjoint along at
  least one axis, greedy cliques of disjoint pairs, induced cycles of length
  4 of the interval graphs of the overlapping pairs.
- Branching on the obstructions (non-comparability graphs and chains longer
  than the bin), with the symmetry breaking of indistinguishable items.
- Run in the 'Exact' mode for the 'Feasibility' objective with a single bin.
- Add the options 'benders_decomposition_subproblem_use_*' to select the
  algorithms solving the subproblems of the Benders decomposition.
- Add the documentation page and unit tests.
@fontanf
fontanf merged commit c42b4ee into master Nov 5, 2026
16 checks passed
@fontanf
fontanf deleted the rectangle-tree-search-packing-classes branch November 5, 2026 23:03
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