"Tetris" Optimization

I am trying to create an optimization script that works a bit like an automated Tetris solver in that the solver determines the maximum number of rectangles that can fit in an arbitrary shape. This is the first time I’ve tried to use Gene Pool, Opossum, and combining multiple fitness criteria into one overall fitness goal. And, it isn’t working :slight_smile:

Several issues. Solver isn’t converging. I’m testing with Galapagos and Opossum. Opossum seems to fail. Galapagos takes so long it’s not even worth it. Fitness criteria are not being met (out of bounds boxes and clashes).

Is my logic wrong? Fitness incorrect? Too hard of a challenge? :smiley:
Please help!

rect_omptz 2.3dm (2.0 MB)
rectangle_optmz_send.gh (48.3 KB)



Do you want to solve the problem to understand it better or do you “just” need something that nests the rectangles within a shape?

For the latter there are several plug-ins that achieve exactly that eg https://www.food4rhino.com/en/app/opennest

It comes up regularly with CNC or laser cutting, the term you want to search for is “nesting” or “packing”

:astonished_face: :astonished_face: :astonished_face: That’s amazing!! I will definitely have to try this out.

Even with this solution (OpenNest), I do you want to solve the problem to understand it better. I want to learn where I went wrong with the GenePool + Opossum, approach, etc. Any help is appreciated!
Thanks Konrad!

Have you seen this topic?