I want to distribute x(i)
objects (x E {1...n})
, where each object has weight w(i)
, into n
portions.
The distribution should be done in such a way, that for all the portions the sum of weights is as equal as possible.
Cheers! Pratik
I want to distribute The distribution should be done in such a way, that for all the portions the sum of weights is as equal as possible. Cheers! Pratik 


Calculate the total sum of the weights, divide by n the number of portions to get the required portion weight. Then use a bin packing algorithm (http://en.wikipedia.org/wiki/Bin%5Fpacking%5Fproblem) to try and fill n bins of this maximum size. Note that all weights need to be less than the portion weight for this to work properly. Otherwise you won't be able to place the large weighted items anywhere. 

comments:

© Copyright ask.programmershare.com.
Design by ask.programmershare.com