Skip to content

Reduction: lift item dimensions for box, boxstacks and rectangleguillotine - #715

Merged
fontanf merged 1 commit into
masterfrom
reduction-lift-item-dimensions
Oct 16, 2026
Merged

fontanf merged 1 commit into
masterfrom
reduction-lift-item-dimensions

Conversation

@fontanf

@fontanf fontanf commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Ports rectangle's subset-sum item dimension lift (against the bin shrunk to the largest total length of the items) to the box, boxstacks and rectangleguillotine reductions, and fixes cases where rectangle's own lift could break weight distribution, unloading or fixed-item constraints. New lift_item_dimensions parameter (enabled by default, exposed in the Python bindings). An item type with a single copy is enlarged along an axis to close a gap beside it that no combination of the other items can fill.

The soundness argument compacts any solution along the lifted axis, so constraints that depend on positions along that axis block it.

box

  • Only along an axis on which every allowed rotation of the item type puts the same dimension.
  • Not with fixed items, nor along an axis measured by the objective (open dimension, leftover mode).

boxstacks

  • Only item types alone in their stack (unique stackability id). Along z, up to the height of the bin.
  • Along x/y: single rotation only, and only if the item satisfies the maximum stack density with its true footprint.
  • Nothing along x with a semi-trailer truck (axle weights depend on x positions and centers).
  • Unloading constraints: x blocked for OnlyYMovements/IncreasingX, y blocked for OnlyXMovements/IncreasingY.
  • unreduce_solution rebuilds the stacks with the true footprints.

rectangleguillotine

  • The argument is a compaction of the cut tree. Lengths are increased by the cut thickness; the maximum distances between 1-cuts/2-cuts are additional capacities.
  • NonExact lifts both axes, Exact only the last-stage cut axis, Roadef2018 only the extra cut axis (both with a fixed first-stage orientation). Homogenous is excluded.
  • Skipped with a minimum distance between cuts, a minimum waste length, a maximum number of cuts, defects, fixed items, trims together with a cut thickness, and objectives depending on more than which items and bins are used (open dimension: other axis only).
  • unreduce_solution rewrites the cut tree around each enlarged item: the node is shrunk and the freed length goes to the next waste, or the true item goes into a child node, or (at the deepest allowed level) its parent is shrunk.

rectangle (fixes)

  • Lifting is now skipped with fixed items, along x with a semi-trailer truck, and along the axis whose compaction could break the unloading constraint (same rule as boxstacks).
  • Instance::weight_matters now accounts for the axle maximum weights of a semi-trailer truck, so companion absorption is skipped for weighted items in a truck with an infinite maximum weight.

Not covered

  • irregular: item lengths don't apply to polygons, and summing widths isn't a valid bound when shapes can nest.

Testing

  • 16 new reduction test scenarios across the four problem types; full C++ suites for box, boxstacks, rectangle and rectangleguillotine pass, as do the Python tests.
  • Randomized comparison of solves with and without reduction through the CLIs: 750 rectangleguillotine instances (about half lift at least one item), 200 box and 200 boxstacks instances. Objective values matched, and no unreduced solution was infeasible.

…otine

Port rectangle's subset-sum item dimension lift, against the bin shrunk
to the largest total length of the items, to the box, boxstacks and
rectangleguillotine reductions ('lift_item_dimensions' parameter, enabled
by default, exposed in the Python bindings). An item type with a single
copy is enlarged along an axis to close a gap beside it that no
combination of the other items can fill. The shared multiple-choice
subset-sum bound is in 'algorithms/subset_sum_bound.hpp'.

- box: only along an axis on which every allowed rotation of the item
  type puts the same dimension; not with fixed items, nor along an axis
  measured by the objective (open dimension, leftover mode).
  'InstanceBuilder::set_item_type_box' is added.
- boxstacks: only item types alone in their stack (unique stackability
  id). Along 'z', up to the height of the bin. Along 'x'/'y', with a
  single rotation, if the item satisfies the maximum stack density with
  its true footprint; nothing along 'x' with a semi-trailer truck (axle
  weights), and nothing along an axis whose compaction could break the
  unloading constraint. 'unreduce_solution' rebuilds the stacks with the
  true footprints. 'InstanceBuilder::set_item_type_box' is added.
- rectangleguillotine: the argument is a compaction of the cut tree;
  lengths are increased by the cut thickness, and the maximum distances
  between 1-cuts/2-cuts are additional capacities. NonExact lifts both
  axes, Exact only the last-stage cut axis and Roadef2018 only the extra
  cut axis (both with a fixed first stage orientation). Skipped with a
  minimum distance between cuts, a minimum waste, a maximum number of
  cuts, defects, fixed items, trims with a cut thickness, and objectives
  depending on more than the items and bins used. 'unreduce_solution'
  rewrites the cut tree around each enlarged item.

rectangle: lifting is now also skipped with fixed items, along 'x' with
a semi-trailer truck, and along the axis whose compaction could break the
unloading constraint ('x' for OnlyYMovements/IncreasingX, 'y' for
OnlyXMovements/IncreasingY). 'Instance::weight_matters' now also accounts
for the axle maximum weights of a semi-trailer truck, so that companion
absorption is skipped with weighted items in a truck with an infinite
maximum weight.
@fontanf
fontanf merged commit 3be7e78 into master Oct 16, 2026
13 of 16 checks passed
@fontanf
fontanf deleted the reduction-lift-item-dimensions branch October 16, 2026 22:02
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