I'm trying to solve the problem of stacking objects into the most convenient size for postage. The size and shape of objects will be varied. Length, width and height of all objects is known.
For example a customer may order a (length x width x height) 200x100x10cm object (wide, long and flat) along with 2 50x50x50cm objects (cubes). If i was to pack this i would put the flat wide object on the bottom and the 2 cubes on top, side by side.
Does anybody have, or know of, a reasonably efficient algorithmic solution to this? Or even an approach to the way i should be thinking about solving this. I've been coding all week, it's late and my brain is fried. I'm not desperate yet but I just want to have a day off tomorrow.
The way I envisage it would be to create an array representing a 3d space, each array element representing 1 square/cm in that space. The 3d space length and width would be based on the longest object and the widest objects. Then you just work from the biggest object down to the smallest object, finding sufficient 'holes' and filling them up as you go.
Although i'm certain there would be a mathematical formula which does this a lot more effieiently.
Any ideas?