Fill volume algorithm

帅比萌擦擦* 提交于 2020-01-01 08:57:05

问题


I have a Box with some dimension length, width, height.

I have items with different length, width, height.

Is there an existing algorithm that can determine the best items to use to put inside the box?


回答1:


This is called a Bin Packing/Cutting Stock/Knapsack problem, and it is NP hard. In general you can only get an approximate solution by using heuristics, see for example

http://en.wikipedia.org/wiki/Knapsack_problem

http://en.wikipedia.org/wiki/Bin_packing_problem

http://en.wikipedia.org/wiki/Cutting_stock_problem




回答2:


This perhaps isn't actually an answer, but I believe the answer is that the problem is unanswerable. Yes, it is a version of a packing problem. But take a look at Erich Friedma's research in 2 dimensions: It seems the problem for equal sized rectangles in square is still unsolved - Look at the complexity of some of these solutions!

http://www2.stetson.edu/~efriedma/squinsqu/

http://www2.stetson.edu/~efriedma/rigidrect/

(The problem is posed slightly differently, i.e. how to best arrange a certain number of items to occupy the least space, as opposed to choosing which items. But I expect your problem reduces to iterating this kind of calculation over several combinations of objects.)

and a 3-d variant which looks only very partially solved: http://www2.stetson.edu/~efriedma/cubincub/

Presumably your best bet is a heuristic as Anders suggests, though it almost certainly will be suboptimal for almost every problem. Interestingly, most optimal solutions appear to be highly irregular, so you probably wouldn't find them.



来源:https://stackoverflow.com/questions/6988300/fill-volume-algorithm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!