Finding the smallest box that would fit different sets or stacks of other boxes

306 Views Asked by At

I am trying to find an efficient way of solving this.

I have 3 sets of boxes. Each set of boxes goes together. I want to find a one size bigger Box that can hold each of these sets. By this I mean one shipping box, that can hold either of the 3 sets. All the boxes are rectangular. The cost of the bigger box is charged per unit volume, so ideally I want the smallest bigger box that can fit any of the sets.

Here are the box sizes.

SET 1 SET 2 SET 3
11.1 x 10.0 x 4.0 17.8 x 11.7 x 3.4 15.0 x 8.3 x 2.8
9.3 x 6.8 x 4.8 10.0 x 10.0 x 2.0 23.5 x 7.5 x 3.0
17.0 x 3.3 x 1.7 12.5 x 5.0 x 4.5 11.3 x 9.3 x 9.3
5.1 x 4.7 x 3.9 13.4 x 13.4 x 3.7 22.5 x 5.3 x 4.5
17.7 x 11.8 x 2.8

What I have tried so far

I found the max length of all the boxes and the max width. Then I found the total height of each set. Then i found the max height. Then those were the dimensions of the box I came up with. It basically just stacked the boxes in each set one on top of the other.

But I am certain this is not the most efficient way or even accurate way of finding the box. Some boxes might fit two or three on top of one, just depending on size so the stack would be smaller. The boxes can be oriented in anyway so you could have two or three boxes placed next to each other on top of one box.

So I need help in finding an algorithmic or formulaic way of solving this. I would also want the steps to be reproducible so that if I were to add another set, i can use the same method to determine the new box size.

Also, if anyone could figure out the lowest volume box that can fit either of these 3 sets, I would love to know the dimensions and how you got them