-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
Description
When trying to pack identical boxes vertically (where width prevents horizontal placement), the algorithm fails to place all boxes despite having sufficient vertical space.
Reproduction
const { Bin, Box, Packer, heuristics } = require('binpackingjs').BP2D;
const boxes = Array(10).fill().map((_, i) => new Box(8604, 17470));
const bin = new Bin(12992, 251568, new heuristics.BestShortSideFit());
const packer = new Packer([bin]);
const pack = packer.pack(boxes);
console.log(`Packed ${pack.length} of ${boxes.length} boxes`);
Expected Behavior
- All 10 boxes should be packed vertically since:
- Bin width (12992) > Box width (8604)
- Total height needed (17470 × 10 = 174700) < Bin height (251568)
- Boxes can only stack vertically as 2 boxes won't fit horizontally (8604 × 2 > 12992)
Actual Behavior
- Only 3 boxes are packed
- Algorithm stops at y=34940 (exactly 2 boxes height)
- Remaining 7 boxes are left unpacked despite having sufficient vertical space
Environment
- binpackingjs version: latest (3.0.2)
- Node.js version used 18.15 & 20.0.0
Metadata
Metadata
Assignees
Labels
No labels