What is the optimal way to select a combination of n values so that their sum (n1+n2+n3+n4+n5) is minimized?
maxDiff = D
requiredLength = L
lengthArray = [l1, l2, l3, l4, l5, l6]
1st constraint,
diff = L - (n1*l1 + n2*l2 + n3*l3 + n4*l4 + n5*l5)
2nd constraint,
0 >= diff <= D
In this scenario, the l
values represent various sheet lengths (e.g. 1000mm, 1100mm, ..., 2000mm, etc.)
The user inputs the maximum required length, represented by L
.
The goal is to determine the best combination of n
values (greater than or equal to 0) that will minimize the number of sheets needed.
If there is a difference, it signifies the gap between the sheets and could potentially be zero.