One step forward, one step backward
While it was nice to be able to get a faster 2D nesting code, its efficiency was far from perfect. So, looking at the nesting results, you could see how it could have been done much better in certain cases.
And what we usually do when we overcome a hurdle is to look for the next one. In my case, I realized one of the heuristics of the code was to place small parts inside the unused space of the bounding box of the larger parts. That is ok, but what could be better is to use all the free space of a bin once the first placement of large parts is over.
This time, I leaned on another Chinese AI tool, called GLM-4.5 from the z.AI company. I explained the above idea in the chat, and I waited for the magic to happen. I used Roo Code within Visual Studio Code, accessing GLM-4.5 API. A few minutes later, I had a newer version of the library. I was pleasantly surprised when I saw a significant improvement in its packing ability, proving that the new heuristic was a better choice.
But it all came at a cost: the new set of operations reclaimed most of the runtime savings, so the process was now working at a similar pace to before but was 7-10% more efficient. I have discarded more sophisticated optimizations (genetic algorithms, simulated annealing, etc) not becase they cannot do it better but because they can take days to compute an only slightly better solution.
The next step for reducing the computing needs and speeding up nesting will be to optimize the input data.
Comments