# Easy nesting coding suggestion

Hey I was just reading a few threads on nesting and couldnt participate due to them being closed. Please forgive me starting a new one.

I see that it has been suggested that the nesting coding would be hard to do.
Can I suggest a different approach?
Agreed it would be hard to do if you wanted to work out the perfet nest, BUT what if only a semi decent nest was all you needed? Think of it like this…To break a cipher you can have software look for patterns, and crack the cyper with lots of AI (artificial intelegence), OR you can brute force the cypher and try every combination until you finally break it. The latter takes no AI at all, just computer crunching.
What if nesting was as simple as, there are X amount of shapes on the page, calculate thier area, calculate the material area, now randomly place the shaped into the origin corner ensuring they are seperate from each other by 2mm. Calculate the average area (elastic band area) they are taking and subtract it from the material area.The computer does this randomly 100 times and keeps the result that has the smallest average area taken up. ‘Bang’ thats your nest. Users dont care about a nest where the difference is 30% size redeuction for a brute force nest vs 40% for a calculated reduction.
Currently I nest my stuff by hand, It made me think, if I can nest with my own brain, then surely a computer can do this in a nano second with just a few rules. I think ‘dumb’ nesting would be better than no nesting. The user might also be offered the option on how many brute force trials the computer does before it selects the best answer.
Am I being too simplistic in my thinking?

A little - you’re not far off how it will likely be implemented. Most of the complexity is in deciding where you can place shapes. If you and I look at this pair, it’s dead obvious where to place them:

For a computer, it has to iterate through all the geometry and figure out where the intersections happen, and how to place the shapes so they don’t intersect. That by itself is very expensive, so you want to do it as little as possible. There are ways to make this faster, but they’re complex to write.

It’s not so much the “try a bunch of things and pick the best” that’s the hard part, it’s the “find any arrangement at all that works in a reasonable amount of time” that’s hard.