Problem with Intersecting shapes in galapagos area minimization

Hello
I am very new to grasshopper and Rhino and would appreciate some help on this matter. I am trying to write a program that minimizes the area of a box (Galapagos) by rotating two different sized shapes on the xy plane.
My problem is that I do not know how to program the project to not count instances when the shapes intersect. I tried to write a python script that took object collisions and culled only the instances returning false, but i soon got lost in syntax errors. I was wondering if there was a better way to approach this problem.

here is a refined script

Actually, you can also create a negative reinforcement parameter that punishes the algorithm when the curves intersect, which will also be an interesting way to achieve similar results, however if might take longer to converge into a solution!

Since you haven’t uploaded the script, I assume that one object does not fit inside the other:
if there is an intersect, the area is increased to a really large number:


You then try to minimise the summed area.

Yep that’s it! So simple and efficient

minimize bounding of 2 geometries.gh (17.2 KB)