views:

79

answers:

2

I'm taskd with developing a packing algorithm for parts bought from our online store. Is there a widget or control that is open-source or for sale that takes in a list of products (with dimensions / weight) and a list of possible packing boxes (with max dimensions and weight) and returns the best possible arrangement? I find it hard to believe that the million of developers before me haven't come up with something, but if not, it's off to the lab to get some work done.

Thanks Josh

A: 

I seem to remember that this is commonly used as an example of a NP-Hard problem. As such, I'm not aware of any algorithm , let alone any implementation of it that will always give the best answer (You'll get a reasonable, but not best, answer by starting with the largest item, and putting it in the first box it'll fit, repeating until you run out of items).

Rowland Shaw
+1  A: 

It seems to me that you're looking for an implementation of the Bin Packing Problem. It's an NP Hard problem, so you'll not find any fast-and-correct algorithm. I did a quick search and couldn't find any components that even use a heuristic for this, but found plenty of papers describing heuristics for getting approximations of the answer. Good luck!

Neil Williams