Skip to content

boxstacks: limit the weight of stacks to the bin maximum weight - #617

Merged
fontanf merged 1 commit into
masterfrom
fix-boxstacks-stack-maximum-weight
Oct 1, 2026
Merged

fontanf merged 1 commit into
masterfrom
fix-boxstacks-stack-maximum-weight

Conversation

@fontanf

@fontanf fontanf commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Problem

sequential_onedimensional_rectangle builds stacks with a maximum weight of maximum_stack_density * x * y, ignoring the bin's maximum weight. It could therefore build stacks heavier than the bin can hold, which the rectangle subproblem then couldn't pack. It also didn't report a failure, so the tree search fallback wasn't run either.

For example, with two items of weight 6 and bins with a maximum weight of 10, both items were stacked together and no solution was found at all. In anytime mode, the solve never returned.

Fix

Use the minimum of both limits, as the tree search already does (tree_search.cpp).

Testing

  • test_weight_constraints in python/tests/test_boxstacks.py is no longer an expected failure.
  • Built and tested together with the other open fixes: C++ unit tests 692 passed, Python tests 292 passed (1 expected failure).

'sequential_onedimensional_rectangle' builds stacks with a maximum weight
of 'maximum_stack_density * x * y', ignoring the maximum weight of the bin.
It could therefore build stacks heavier than the bin can hold, which the
rectangle subproblem then couldn't pack: e.g. with two items of weight 6
and bins of maximum weight 10, both items were stacked together and no
solution was found at all. Use the minimum of both limits, as the tree
search already does.
@fontanf
fontanf merged commit 5c52db4 into master Oct 1, 2026
11 checks passed
@fontanf
fontanf deleted the fix-boxstacks-stack-maximum-weight branch October 1, 2026 21:43
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