Resolving spatial arrangement

Hi all…
How can we find an optimal arrangement of rooms within a constrained space? E.g. if we have a big box, in which we want to arrange a set of 10 boxes where each box is associated to every other box through a pre-defined value ranging between -1 (should never be attached to) and +1(must be attached to)… is this even possible? The main question here is, can we generate spatial layouts based only on the association’s between the objects, within a constrained space?
Thanks!