My objective is optimizing a 2D grid space reducing the unoccupied space as much as possible. The objects to place in the grid have some dimension HxW and the have some constraints to fullfill.
As you can see in the picture I have several objects to put in the grid, each of one has a priority (they must be placed in the grid respecting a priority, if it won't fit, then a lower priority smaller object will be placed in the grid) and also a requisite.
Is there anything that can help to achieve this? Some theoric algorithm, some library in any programming language etc... Something to not start from the beginning.
Many thank#!!
This is a rectangle packing problem. There are many variations on the problem. The linked Wikipedia article describes three variations, with links to references that include algorithm descriptions and code.