Try googling for `two dimensional knapsack'. That gives some promising looking hits.
For the non-CS types in the audience, this type of problem is known as `the knapsack problem' because it's analagous to finding the largest amount of fixed sized objects weighing wi units each that can fit in a bag that can hold x units.
Update: Glancing over some of the google results seems to indicate you've picked a doozy. Having a few fixed layouts for the groupings you're most likely to use probably would be the quicker solution.
Oh, and: Post #300. Wh00t.
In reply to Re: Rectangle packing...
by Fletch
in thread Rectangle packing...
by suaveant
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |