Given a set of blocks whose length, width, and height respectively are $A:1 \times 3 \times 2$, $B: 2 \times 2 \times 1$, $C \text{ and } D: 2 \times 1 \times 1$, and $E,F,G\text{ and }H: 1 \times 1 \times 1$. The blocks can be rotated in any direction, but cannot be replaced once laid down.
If we have control over the order of the blocks handed to us, we can for example stack all boxes into a $3 \times 3 \times 2$ box, as shown in the picture below, an optimal solution:
Now assume that we have no control over the order of the blocks handed to us, and we cannot move blocks once placed, what is the smallest volume box that guarantees to fit all the blocks? An obvious upper bound is to place all boxes in one layer, but this will result in too much wasted space.
It might also be too difficult to find the exact smallest volume, but any solution improved upon the obvious upper bound is welcomed.
My intuition is that you need to divide the blocks into a few groups, the placement of each group is independent of the other groups, and inside each groups, the total occupied space is the same for any ordering within the group. One such group could be $C$ and $D$, since the volume from stacking these $2$ is the same regardless of which appears first.
Updates: Inspired by the accepted answer, I found those optimal solutions to the problem:
- Sort the items into stack height of 1:
AADDCF
AABBCG
AABBEH
- Sort the items into stack height of 2:
See the accepted answer
- Sort the items into stack height of 3:
Assume stacked product of BC = X, stacked product of DG = Y, stacked product of EFH = Z
AXY
AXZ
- Sort the items into stack of height>3:
Obviously, to achieve an optimal solution, the stack height can only be 6,9 and 18.
Stack height of 6: Combine ABC, and DEFGH
Stack height of 9: Not possible
Stack height of 18: Not possible
Correct me if I am interpreting the problem incorrectly, but I think you can always achieve an optimal packing. To do so, build this arrangement, which has a height of $2$, and where the X's refer to stacks of two $1 \times 1 ×1$ blocks.
Every block touches the floor, so every block can be placed when it is handed to you (except for the top blocks atop the two X towers, but these are placed on top of the previous small blocks).