The default goods can be placed at will except that they cannot be compressed and disassembled.
That is, it can be placed horizontally, vertically, upside down and horizontally.
When placed, the maximum size direction of the goods is consistent with the maximum size direction of the space.
This is relatively simple to consider. For example, the box size is X>Y>z and the product size is x>y>z.
Then aim the X direction of the goods at the X direction of the box first, and then consider other directions (horizontal or upside down) after it is full.
The number of commodities that can be placed is an integer, and the size of commodities: x= 1 1, y=5.8, and z=3.5.
Let the number of layers of goods that can be placed in each direction be a, b, c, b, c.
For the first box: X = 6 1, Y = 5 1, Z = 4 1.
Step one:
X direction: a1= [x/x] = [611] = 5, and residual dimension x' = 6 1-5 * 1 = 6.
Y direction: b1= [y/y] = [51/5.8] = 8, and residual dimension Y'=5 1-8*5.8=4.6.
Z direction: c1= [z/z] = [41/3.5] =11,and the remaining dimension z' = 41-kloc-0/* 3.5 = 2.5.
The maximum number of layers in Z'<Z and Z direction cannot be increased.
Step two:
The remaining space in the x direction is: X'*Y*Z, Y>Z>x', so it should be placed horizontally.
Y direction: B2 = [y/x] = [511] = 4, and residual dimension y'' = 51-4 *1= 7.
Z direction: c2=[Z/y]=[4 1/5.8]=7, and the residual dimension Z''=4 1-7*5.8=0.4.
X direction: a2=[X'/z]=[6/3.5]= 1, residual dimension X''=6- 1*3.5=2.5.
The maximum number of layers in X''<Z and X direction cannot be increased.
Step 3:
The remaining space in the y direction is: X*Y'*Z, X>Z> You can consider putting it aside.
X direction: a3 = [x/x] = [611] = 5, residual dimension x'' = 61-5 *165438 = 6.
Z direction: c3=[Z/y]=[4 1/5.8]=7, and residual dimension Z'''=4 1-7*5.8=0.4.
Y direction: b3=[Y'/z]=[4.6/3.5]= 1, and residual dimension y'' = 4.6- 1 * 3.5 = 1.
The maximum number of layers in Y'''<Z and Y direction cannot be increased.
Step 4:
At present, the largest remaining space is: x'' * y'' * z, Z>Y''>x'', considering the vertical.
Z direction: C4 = [z/x] = [411] = 3, and the residual dimension z''' = 4 1-3 * 1 = 8.
Y direction: b4=[Y''/y]=[7/5.8]= 1, residual dimension Y'' = 7- 1 * 5.8 = 1.2.
X direction: a4 =[X' '/z]=[6/3.5]= 1, residual dimension X'' = 6- 1 * 3.5 = 2.5.
Z''''<x, the remaining maximum size is less than the maximum size of the goods, and the goods cannot be loaded again.
∴ What's the maximum number of pieces in the first box?
n 1 = a 1 * b 1 * c 1+a2 * B2 * C2+a3 * B3 * C3+a4 * B4 * C4
=5*8* 1 1+4*7* 1+5*7* 1+3* 1* 1
=440+28+35+3
=506
For the second box: X = 5 1, Y = 4 1, Z = 3 1.
Step one:
X direction: a1= [x/x] = [511] = 4, and residual dimension x' = 5 1-4 * 1 = 7.
Y direction: b1= [y/y] = [41/5.8] = 7, and residual dimension Y'=4 1-7*5.8=0.4.
Z direction: c1= [z/z] = [31/3.5] = 8, and residual dimension Z'=3 1-8*3.5=3.
The maximum number of layers in Y'<Z, Z'<Z, Y and Z directions cannot be increased.
Step two:
The remaining space in the x direction is: X'*Y*Z, Y>Z>x', so it should be placed horizontally.
Y direction: B2 = [y/x] = [411] = 3, and residual dimension y'' = 41-3 *1= 8.
Z direction: c2=[Z/y]=[3 1/5.8]=5, and the residual dimension Z''=3 1-5*5.8=2.
X direction: a2=[X'/z]=[7/3.5]=2, residual dimension X''=7-2*3.5=0.
The maximum number of layers in X''<Z and X direction cannot be increased.
Step 3:
At present, the largest remaining space is: x' * y' * z, Z>Y''>x', considering verticality.
Z direction: C3 = [z/x] = [311] = 2, residual dimension z'' = 31-2 *165438 = 9.
Y direction: b3=[Y''/y]=[8/5.8]= 1, residual dimension y'' = 8- 1 * 5.8 = 2.2.
X direction: a3=[X'/z]=[7/3.5]=2, residual dimension X'=7-2*3.5=0.
Z'''<x, the remaining maximum size is less than the maximum size of the goods, and the goods cannot be loaded again.
∴ What's the maximum number of pieces in the second box?
N2 = a 1 * b 1 * c 1+a2 * B2 * C2+a3 * B3 * C3
=4*7*8+3*5*2+2* 1*2
=224+30+4
=258
(PS: In fact, there should be a fixed algorithm for this situation, and there seems to be a cow.
You can use the formula in excel to calculate it, and help you find it or think about it when you are free. )