Grasshopper- Galapagos arranging areas on site


I am new to grasshopper, and to galapagos too …
What I am trying to achieve is to place 5 squares, onto a site… only the sum of their area should not exceed 75 percent of the area of the site, and they should be clear from intersecting each other and the site boundary.
Im having issues on placing the squares,
Has enyone done something similar and is able to advise me oh how to overcome this ?

231121- Galapagos (59.0 KB)

It looks to me like you are leaving too much of the task to Galapagos. I would generate the five squares in random sizes to meet your criteria (“the sum of their area should not exceed 75 percent of the area of the site”), then use Galapagos to do nothing but position them randomly within the site boundary and without overlapping.

I see no reason for using Rotate Plane, especially with a choice of either 0 or 1 radians?

I see no reason for using Scale since random sizes can be done when creating the squares (rectangles).
P.S. I started puttering without a plan and got to this, which is not a very good algorithm. (18.1 KB)

Seems to me now that an iterative approach that places one square at a time might work best, with the squares sorted by size to place largest first, smallest last.

Similar to this, which places rods at random angles without colliding:

P.P.S. This algorithm is still flawed but the yellow group aligns each rectangle to it’s nearest edge, which might be useful. (22.3 KB)

Hi joseph,

thanks for your reply
this is amazing ! And looks way simpler than what i have, as a constraint im trying to get all my squares not touching the boundary line

the iterative approach is very useful
thank you

Yes, and even with the auto-align-to-nearest-edge feature, it’s obvious that rectangle center points must be a minimum distance from the perimeter, based on each rectangle’s size.

I dont know if populating the surface is the correct way to go as you have liittle controle on the position of the center of the rectangle, Ive tried adding a distance between the center and the far corner but still no success (altough ive probably not done it correctly)