Bin Packing

Decreasing Algorithms

   There is a method, for all algorithms, to make packing more efficient.  And that is to sort the Elements array in descending order before applying the algorithm in question.  This usually benefits the process because large, bulky Elements get placed at the bottom of the first Bins, allowing the smaller Elements which come at the end of the array to (usually) fit nicely on top of them and to fill or almost fill the Bin (usually).

That is why the following lines of code appear in each algorithm:
      'Sort in descending order if needed
If Me.Decreasing = True Then
Array.Sort(ElementsCopy)
Array.Reverse(ElementsCopy)
End If

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Owning a computer without programming is like having a kitchen and using only the microwave oven” - Charles Petzold