"Simple" generative design script not optimizing

Hey guys,

I have a script that fills a surface with smaller surfaces. All are rectangles. In 1 direction it always places the same small surface and in the other direction it checks which lengths fit best to fill the big surface.

I have simple inputs, the small surface sizes (3 diff sizes for now). They only differ in length. 3 integers that show how many of each size is used and the big surface.

My outputs are the count of the different sizes used, the % the big surface is filled and the % of surface that is outside the big surface.

Problem: The answers always go wide by a large amount. Its never even close to filling the surface just right. Do you guys now why?

result:

Expected result:

Does someone know why?

What’s your population size and number of generations? Are you changing the seed value between runs? If you’re expecting a “perfect” solution, you’re likely going to have to wait a very long time with this method.

I would look at using a Packing node or similar process. In general, you can make your graph more efficient by pre-filtering your options based on your requirements. You have options like;

  • checking the available length in a row and filtering out rectangles that are larger than that space
  • calculating the difference in row area (% outside or % leftover) and using the smallest relative result
  • prioritizing the largest valid rectangle to utilize your space better

Your graph is working and generative design is doing what it’s supposed to. It’s just a slow process. Building more intelligent logic is always the best way to improve your efficiency.

Also, 0-800 for three inputs is a crazy number of variations. That’s more than half a billion variations just between those inputs.

1 Like

Hard to say without the graph, but some things to consider:

  1. The two outputs are in direct proportional conflict with each other, causing one to go up by the same the other goes down. Weight an output to resolve this.
  2. The inputs are not diverse enough so the optimum cannot be found. This could even by that the inputs provided do not alter the outputs.
  3. The optimization method is incorrect, meaning you are minimizing a variable which you want to maximize. Multiplying by -1 in your graph before setting the output can keep to a ‘always minimize’ context.
  4. The optimization settings are too small to get good results. This bit is more of an art form, but as a base you want a population that is 7x larger than the number of inputs, setting the number of generations as low as needed to find the optimal (you can also do an absurdly high number and stop when you see it looking optimized).
1 Like

So the panels used are in one direction. The only reason I i have the 0-800 as input is so the quantity can differ and be counted. How would you simplify this when in reality you just need variation in 1 direction?

Gonna take u guys advice today and try to rebuild and check where I can simplify. What it needs to do is just check in 1 direction which size combination of panels would fit and then fill it with the same one in the other direction and give me the count in the end.

So it does prioritize large panels first. Then the 2nd largest and third the smallest.

I am also already using % surface is filled and % outside the surface to try and optimize more. But still doesnt get close to results. Just tried it with 10 generations and 40 population just to test it out.

Direction it places panels is right to left as the line in the big surface shows

Which 2 outputs are in direct conflict, the 2 different %? Is that because to get lower % in one output it needs to do the same thing that lowers the % in the other (eventhough you want that one to be as high as possible)?

If you use the same panel for a single column then you only need to determine the panel type once per column. The total number of panel selections you’d have to make then is the maximum number of columns that fit on your total area (per panel size).

I’m suggesting that for each possible panel you check to see if you’re “better off” with placing a panel and having excess area (%+) or not placing a panel and having missing area (%-). This helps determine whether placing an additional panel is even necessary. For example, the last column of red panels is almost exclusively excess area - you’d be better off not placing another column of panels because you’d be closer to 100% with the gap than with the extra.

There also seems to be some issues with your graph logic if you’re getting partial columns and extra columns that are completely outside the bounds of your total area. Why is this happening? Is it because your number of panels/columns is determined before they’ve been placed? That’s where you may need to check if placing a new column is even valid before you do so.

This is a pretty big tell - the logic seems off. Paneling isn’t easy, but can be done quite a few ways. Can you define / outline your steps / logic sequence @verdisweet ?