Skip to content

Separate the shape and the value of the leftovers, and add the variable-sized bin packing with leftovers objective - #887

Merged
fontanf merged 2 commits into
masterfrom
leftover-value
Nov 24, 2026
Merged

fontanf merged 2 commits into
masterfrom
leftover-value

Conversation

@fontanf

@fontanf fontanf commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Shape of the leftovers

New leftover modes for the rectangle, box, boxstacks and irregular problem types:

  • cut modes (area-cut, xy-cut, xyz-cut, bottom-left-cut, ...): the L-shape cut into two rectangles (or boxes) along the faces of the used space, in the order which gives the largest value;
  • staircase modes (staircase, bottom-left-staircase, ...): the bin minus the union of the boxes between the corner of the bin and each item.

Value of the leftovers

New parameter leftover_value_type:

  • squared-area (default): the square of the area (or volume) of the leftover, or the sum of the squares of its pieces. It ranks a single leftover like its area, but a single large leftover is worth more than several smaller ones of the same total area;
  • depth: the integral, over the leftover, of the distance to its edge. Compact leftovers are worth more than long and thin ones.

The total leftover value of a solution now counts the bins which are not used for their whole value.

New objective variable-sized-bin-packing-with-leftovers

Available for the rectangleguillotine, rectangle, box, boxstacks and irregular problem types.

  • The objective is to minimize the net cost of the bins: the cost of the bins used, minus a refund for each of their leftovers. A leftover is refunded at the price of its bin per unit of space, for the space equivalent to its value: its value times a factor which makes the largest bin type worth its own space. With squared-area, a leftover of area a in a bin of cost c and area A is refunded c / A × a² / A_max.
  • The cost of the bins and the value of their leftovers are traded off in a single quantity, whether costs are set for the bin types or not; there is no special case. A leftover is refunded less than its space, and the smaller it is, the less it is refunded per unit of space, so a single large leftover is worth more than several smaller ones.
  • The net cost is reported in the NetCost field of the output.
  • The solutions are found by the algorithms of the variable-sized bin packing objective; only their comparison differs. Since there is no bound on the net cost, solutions are never proven optimal.
  • For rectangleguillotine, the leftovers of a bin are the plate after its last 1-cut and the sub-plate after the last 2-cut of its last first-level sub-plate.
  • The one-dimensional sub-instances (bounds, Benders master problems) use the variable-sized bin packing objective.

Other changes

  • New documentation page dedicated to the leftovers, and an example of the new objective in the objectives page.
  • The new options are exposed in the command line, the CSV/JSON instance formats, the Python package and the website.
  • The documentation examples are regenerated.
  • The reference solution of data/irregular/users/2024-08-08 is regenerated (near-tie at the noise level).

Tests

  • C++: 1310/1310 tests pass, with new tests for the leftover values (against a brute-force grid for the staircase), the new modes and value types, and the new objective.
  • Website: 117/117 tests pass.
  • Python: the leftover tests and the documentation snippet checks pass.

…le-sized bin packing with leftovers objective

Shape of the leftovers:
- add the cut modes (the L-shape cut into two rectangles or boxes, along
  the faces of the used space, in the order which gives the largest value)
  and the staircase modes (the bin minus the union of the boxes between the
  corner of the bin and each item) to the rectangle, box, boxstacks and
  irregular problem types

Value of the leftovers ('leftover_value_type'):
- 'squared-area' (default): the square of the area (or volume) of the
  leftover, or the sum of the squares of its pieces; a single large
  leftover is worth more than several smaller ones of the same total area
- 'depth': the integral, over the leftover, of the distance to its edge;
  compact leftovers are worth more than long and thin ones
- the total leftover value of a solution counts the bins which are not
  used for their whole value

New objective 'variable-sized-bin-packing-with-leftovers', for the
rectangleguillotine, rectangle, box, boxstacks and irregular problem types:
- minimize the net cost of the bins: their cost minus a refund for each of
  their leftovers; a leftover is refunded at the price of its bin per unit
  of space, for the space equivalent to its value (its value times a
  factor which makes the largest bin type worth its own space); the cost
  and the leftovers are traded off in a single quantity, whether costs are
  set for the bin types or not
- the solutions are found by the algorithms of the variable-sized bin
  packing objective; only their comparison differs
- for rectangleguillotine, the leftovers of a bin are the plate after its
  last 1-cut and the sub-plate after the last 2-cut of its last
  first-level sub-plate

Also add a documentation page dedicated to the leftovers, and expose the
new options in the command line, the Python package and the website.
Add an example of the variable-sized bin packing with leftovers objective,
and regenerate the solutions, outputs and images of the examples.
@fontanf
fontanf merged commit 16b83de into master Nov 24, 2026
13 of 16 checks passed
@fontanf
fontanf deleted the leftover-value branch November 24, 2026 17:28
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