Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bin-packing algorithm

64 views
Skip to first unread message

Musatov

unread,
Feb 5, 2011, 8:14:57 PM2/5/11
to
<b>binpackFFd(S,n,bin)</b>
float[] used=new float[n+1];
//used[j] is the amount of space in bin j already used up.
inti,j;
Initialize all used entries to 0.0
Sort S into descending(nonincreasing)order,giving the sequence
s1>=S2>=...>=Sn.
for(i=1;i<=n;i++)
//Look for a bin in which s[i] fits.
for(j=1;j<=n;j++)
if(used[j]+si<+1.0)
bin[i]=j;
used[j] +=si;
break; //exit for(j)
//continue for(i).
0 new messages