Populate rooftop (surface) avoiding obstacles

Hello everyone. I am fairly new to GH and I am trying to figure out a way of automatically populating a parametric roof I created with PV panels.
I have more or less the idea of what I have to do, but not the knowledge of how to implement it. So I have a roof (surface) with some kind of obstacle (any geometry I add on the surface - HVAC or exhausters) and what I would like to happen is that the script automatically creates the biggest rectangle possible on the roof avoiding the obstacle(s), and within that rectangle, add the maximum number of smaller geometries representing the PV panels.

That’s more or less a diagram of what I would like to happen:
image

And this is the GH file of what I have so far:
Grasshopper_Roof.gh (9.6 KB)

If it’s too much work I don’t need a final solution but some direction on how to proceed would be greatly appreciated!

Thank you,
Vitor

Hi,

The Galapagos evolutionary solver that comes with Grasshopper can for instance be used to optimize stuff like this. What you should know though is that with an evolutionary approach like this the optimal solution is never guaranteed, much like in nature. :slight_smile:

In my example definition, I simply maximize the PV-panel area, while penalizing it going over the roof border and it colliding with the exhaust and/or HVAC unit.

Maximizing happens from 0 to 1, where 1 is the maximum or optimum fitness value.
The area of the PV-array thus gets remapped between 0 and 1.
The collision and inclusion values are either 0 or 1.
These three values are divided by 3, because all three values are weighted equally (different weights could also be possible), and added together to form a fitness value between 0 to 1.0 that Galapagos maximizes towards.

Some results:

The Galapagos solver is the pink component with the googly eyes icon. A dialogue should open when double-clicking it, in which you can start a simulation.

Here’s the definition:
Grasshopper_Roof_Evo.gh (43.2 KB)

1 Like

That is exactly what I was looking for. Thank you so much for taking your time to write this script.
I’m quite familiar with Galapagos because of energy loads/daylighting optimization scripts but I didn’t think about utilizing it for this kind of task.

Once again thank you!!

1 Like