Function CONT(Cx, Cy, Cz, x, y, z, o)
'Cx Cy Cz dimensions container
'x y z dimensions colis
'Si o = "oui", z1 = z
'La fonction renvoie un vecteur(n,p,x1,y1,z1,a,b,c,d,e,f,g) où:
'n nombre maximum de colis
'p coefficient de remplissage
'Sur Cx: a*x1(sur b rangs)+c*y1(sur d rangs)
'Sur Cy: b*y1(sur a rangs)+e*x1(sur f rangs)
'Sur Cz: g*z1
Dim U, V
Cx = Abs(Cx)
Cy = Abs(Cy)
Cz = Abs(Cz)
x = Abs(x)
y = Abs(y)
z = Abs(z)
U = Fo(Cx, Cy, Cz, x, y, z)
V = Fo(Cx, Cy, Cz, y, x, z)
If V(0) > U(0) Then U = V
If o <> "oui" Then
V = Fo(Cx, Cy, Cz, x, z, y)
If V(0) > U(0) Then U = V
V = Fo(Cx, Cy, Cz, z, x, y)
If V(0) > U(0) Then U = V
V = Fo(Cx, Cy, Cz, y, z, x)
If V(0) > U(0) Then U = V
V = Fo(Cx, Cy, Cz, z, y, x)
If V(0) > U(0) Then U = V
End If
CONT = U
End Function
Function Fo(Cx, Cy, Cz, x, y, z)
Dim a!, a1!, b!, b0!, b1!, c!, c1!, d!, e!, e1!, f!, g!, n!, n1!
d = Int(Cy / x)
f = Int(Cx / y)
g = Int(Cz / z)
b0 = Int(Cy / y)
For a = Int(Cx / x) * Sgn(g) To 1 Step -1
c = Int((Cx - a * x) / y)
For b = b0 To 1 Step -1
e = Int((Cy - b * y) / x)
n = a * b + c * (d - e) + e * f
If n > n1 Then
n1 = n
a1 = a
b1 = b
c1 = c
e1 = e
End If
Next
Next
Fo = Array(n1 * g, n1 * g * x * y * z / Cx / Cy / Cz, x, y, z, a1, b1, c1 * Sgn(d - e1), (d - e1) * Sgn(c1), e1 * Sgn(f), f * Sgn(e1), g)
End Function