EDIT: Thanks Alain for the correct description for this:
The problem is this: a store that is trying to find the optimal size of its cardboard boxes in order to be able to pack all the goods and try to minimize the wasted space in the boxes.
I currently have a dataset with volumes. I need to find out if, for example, the number of containers I can use is 5, what are the 5 best sizes for all of these volumes? For example, this array contains my volume:
var numbers =[10, 20, 20, 30, 50, 50, 50, 80];
And to make it simple, I have 2 containers. Each of them has a size of 50 and 80.
10 is suitable at 50, but the waste is 40. 20 is also suitable at 50, but the waste is 30 and so on. 50 fits in 50, but the waste is 0. The same goes for 80. In total, the waste is 120.
But what if the sizes were different? 60 and 80. Then the total amount of waste will be 180.
(60-10) + (60-20) + (60-20) + (60-30) + (60-50) + (60-50) + (60-50) + (80-80)
My question is: what is the most efficient way to determine how large the sizes are for containers? Given that you know how many containers you can use, and the numbers (in this case it was volume) in the array.
So, for example, that if I didn’t know that the sizes of my container should be 50 and 80. How would I calculate the best right size if I only know how many containers I can use and how much volume of each object
Is there any algorithm for this, and if so, can you give an example? I tried looking for things like bunker packaging, a backpack and k-tools, but I don’t really understand how I can apply them to this problem. I just want to calculate which sizes are best for storing all volumes with minimal waste.
I hope that I was clear with this example, if I do not ask more. Thanks in advance.