Unfortunately your problem is "hard". There looks to be quite a bit of published material on it--for instance, see this article. You might try searching for "rectangular packing problem" or variants on that. Various proposed solutions tend to get evaluated, so people have definitely coded it before. Perhaps you'll be able to find someone else's code and simply run it. I suppose if you're desperate, unable to find code online, unwilling to implement a published solution, and it's a really big cost savings to you, you could get into contact with paper authors and ask for their code. It sounds like you really only need to run your specific incarnation of this problem through someone else's solver, which might be even easier.

Sorry I can't be more specific.