这个属于2D knapsack problem. 有DP算法,复杂度为O(LW(n+L+W)) 。见 http://www.cs.kent.edu/~parallel/papers/ulm_wmpp04.pdf P.C. Gilmore and R.E. Gomory, Multistage cutting stock problems of two or more dimensions, Operations Research, 13:94-120, 1965.
w*s
16 楼
这个paper里的方法有一个额外的约束: This cutting problem allows only recursive side-to-side or guillotine cuts o f the knapsack. 就是说必须从一边割到另外一边(不能割到中间就停),原题里没有这个约束。
【在 h*****u 的大作中提到】 : 这个属于2D knapsack problem. 有DP算法,复杂度为O(LW(n+L+W)) 。见 : http://www.cs.kent.edu/~parallel/papers/ulm_wmpp04.pdf : P.C. Gilmore and R.E. Gomory, Multistage cutting stock : problems of two or more dimensions, Operations Research, : 13:94-120, 1965.
有道理。除了guillotine cut,Gilmore and Gomory 还允许 multiple items,但是这 个题目只是允许最多一个。 这个也不属于multi-dimensional knapsack, 因为不是简单的相加关系。 我找到最相关的是:An exact algorithm for general, orthogonal, two- dimensional knapsack problems, European Journal of Operational Research 83 ( 1995) 39-56。但是也不是DP. 感觉如果要表征solution,需要把已经剩余区域的所有极点(extreme points)都记录下 来。如此,怎么设计DP?
o
【在 w*******s 的大作中提到】 : 这个paper里的方法有一个额外的约束: : This cutting problem allows only recursive side-to-side or guillotine cuts o : f the knapsack. : 就是说必须从一边割到另外一边(不能割到中间就停),原题里没有这个约束。
j*g
19 楼
If we do not allow infinitely many copies for every photo dimension, then it 's NP-hard. Reduce subset sum to it. If infinitely many copies are allowed, I think there is a greedy+DP solution . Start by removing all "dominated" dimensions, i.e. axb dominates cxd if a <=c and b<=d.
l*r
20 楼
Still can't get the solution. Any more hints? Thanks