Hi

This is the first time i've dealt with this type of problem and i think I'm right in seeing it as a bin packing problem.

I have a number of rectangles that i need to fit into any number of bins, the bins must be filled (if possible) before the next bin is opened.

The rectangles are fixed dimensions of w:1 h:1, w:1 h:2, w:2 h:2.

The bin dimensions are w:3 h:2.

There can be any number of the rectangles.

Whats the best way to go around finding how many bins are required and the most efficient way of filling them?

I've looked at some of the formulas but they are a bit beyond me.

The solution i came up with was using

numberOfBins = ceil(totalVolumeOfRectangles / volumeOfbin)

you then get a remainder which is the part filled last bin. This works fine when all the bins up to the last can be filled, the problem is when they can't.

For example if there are 3 x rectangles of volume 4, 3 x rectangles of volume 1.

Im sure there's a simple formula to work this out, I'm just not getting it.

Any help would be much appreciated.

Thanks