-
-
Notifications
You must be signed in to change notification settings - Fork 164
Description
Hi,
I have a problem with optimal packaging of items in a box.
I have 3 types of box depths that are cut to the desired length but not exceeding the courier's limit.
So I made a while loop from the smallest possible size to the longest package + mountings box length in the order
$w=400;
while ($w<=2360) {
$packer->addBox(new MyBox('Box120 '.$w, $w, 285, 120, 1200, 25000));
$packer->addBox(new MyBox('Box160 '.$w, $w, 285, 160, 1200, 25000));
$packer->addBox(new MyBox('Box250 '.$w, $w, 285, 250, 1200, 25000));
$w += 10;
}
For now, in the example, I made the same outer dimensions as the inner ones
Items to pack are blinds and a box with mountings
$packer->addItem(new MyItem('mountings', 282, 110, 160, 500), 1);
$packer->addItem(new MyItem('blind 50mm', 2260, 218, 80, 1380), 1);
$packer->addItem(new MyItem('blind 35mm ', 1585, 192, 60, 5050), 1);
$packer->addItem(new MyItem('blind 50mm', 1175, 218, 80, 5190), 1);
$packer->addItem(new MyItem('blind 35mm', 1028, 191, 60, 3210), 1);
$packer->addItem(new MyItem('blind 35mm', 1028, 192, 60, 3200), 1);
And the problem is that the algorithm uses the box with mountings to pack it into two 250 boxes instead of two 160 boxes.
When I removed
$packer->addBox(new MyBox('Box250 '.$w, $w, 285, 250, 1200, 25000));
it was packed as it should be.
I thought that maybe it doesn't rotate the box with mountings, but this option is enabled.
In my example, I would rather have a box with mountings to make the box longer than choose a larger one.
But idk how to do this.