TheCPUWizard
December 21st, 2008, 08:10 PM
Here is the problem with a twist....
a) I have a number X of data objects I (items) ranging in size from 1...S. [each is Is]
b) I want to group them into a set of files (>1) that are all the same size C(Knapsack Capacity)
c) I want to use the smallest size knapsacks N , the has the minimum amount of wasted space.
Trivial (non-valid) solutions:
1) One single Knapsack that is Sum(Is). Obviously no wasted space, but does not meet the >1 criteria.
2) X knapsacks of size Smax. This will be the smallest possible size (a goal), but is likely to have significant wasted space....
X is <1000, and performance is not overly important (it can easily take up to one minute without causing a serious problem - obviously I would like it faster).
a) I have a number X of data objects I (items) ranging in size from 1...S. [each is Is]
b) I want to group them into a set of files (>1) that are all the same size C(Knapsack Capacity)
c) I want to use the smallest size knapsacks N , the has the minimum amount of wasted space.
Trivial (non-valid) solutions:
1) One single Knapsack that is Sum(Is). Obviously no wasted space, but does not meet the >1 criteria.
2) X knapsacks of size Smax. This will be the smallest possible size (a goal), but is likely to have significant wasted space....
X is <1000, and performance is not overly important (it can easily take up to one minute without causing a serious problem - obviously I would like it faster).