Skip to content

box, boxstacks: default bin cost is the bin volume - #612

Merged
fontanf merged 1 commit into
masterfrom
fix-box-default-bin-cost
Oct 1, 2026
Merged

fontanf merged 1 commit into
masterfrom
fix-box-default-bin-cost

Conversation

@fontanf

@fontanf fontanf commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Problem

The documentation of both box and boxstacks says that a bin type's default cost is its volume. However, add_bin_type sets it to the area of its base, x * y. So does set_bin_type_cost with -1, which means the default. This affects variable-sized bin packing when no cost is given.

Fix

Use the volume in both places, for both problem types.

Testing

  • New python/tests/test_bin_cost.py: the default cost and the cost -1 give the volume, and an explicit cost is kept, for box and boxstacks.
  • The box keyword defaults test now checks the volume explicitly.
  • Built and tested together with the other open fixes: C++ unit tests 690 passed, Python tests 282 passed (7 expected failures).

As documented, the default cost of a bin type is its volume, but
'add_bin_type' (and 'set_bin_type_cost' with -1, which means the default)
set it to the area of its base, 'x * y'.
@fontanf
fontanf merged commit 7e3ce03 into master Oct 1, 2026
9 of 11 checks passed
@fontanf
fontanf deleted the fix-box-default-bin-cost branch October 1, 2026 22:34
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