Space Planning within a Polygon

Hello, I’m trying to use Dynamo and Refinery to create options for laying out rectangles within a polygon (or boundary). The goal is to use generative design to find different options for rectangle placements within a boundary and score the designs based on the rectangles proximity to one another and eventually what is the usability of the leftover space once all the rectangles have been placed. I haven’t built all the scoring criteria out yet, but my main issue is that I cannot get the rectangles to stay within the given boundary - which in my case is a polygon - and results in creating ONLY false options being shown in Refinery. I’ve tried scoring the outputs of the polygon.contains and geometry.doesintersect nodes to try and “maximize” those values in the optimization study in Refinery with no luck. How do I either filter out options which are not within the boundary before going into Refinery, or not allow the options to be created in the first place within the code? Below is my graph, the outputs I’m getting in Refinery (ran multiple ways using Randomize, Optimize, etc and all the results look like this), and and example of the expected outputs.

my graph:

my Refinery outputs (note: it only displays rectangles if they fit within the boundary which in this case is none, so that’s why you only see the 3 points which are the centerpoint of the rectangles):

and what I am trying to achieve by fitting the rectangles within the boundary:
Expected Results dynamo

Any help would be appreciated. I’m still quite new to this :slight_smile: Thank you!

Has your problem been solved? I also encountered a similar problem.

nope not yet, sorry

You can’t exactly tell GD not to create options that fail if it won’t know they fail until the option has been created. You have to take a more proactive approach. Think about the constraints of your design. Since the dimensions of your rectangles and boundary are already known, you can constrain the allowable locations for each rectangle to stay within the boundary. Rather than your number slider representing the location within the maximum extents of the boundary, have them represent a percentage within the allowable range of the boundary. This should drastically reduce the number of “bad” options you get. It also doesn’t look like you’re running nearly enough iterations for GD to determine an optimized location for something that is going to have a lot of failed options.

Hello! How to ensure that the rectangles in the generated plan do not overlap each other?

That’s where your fitness function comes in. Again, you can’t tell the computer not to do something that won’t actually fail until it happens. Your fitness function would probably just be to minimize the amount of overlap area.