Question: optimal arrangement of rectangles in a rectangle

I have a base rectangle with the size bx * by  and several rectangles which have all the same size ax*ay but can be arranged horizontally or vertically (ay*ax).

Is there a way to calculate the best arrangement?

 

Please Wait...