I have spent some time researching 2d bin packing algorithm. I have no extensive experience in algorithm especially in advanced math but I can code :)
The perfect example of what I need to achieve is demonstrated here http://www.cutlistoptimizer.com. It works, but I can't figure out what algorithm it uses.
I have tried many approaches some of them are very simple like https://codeincomplete.com/posts/bin-packing/ DEMO here, but it doesn't support rotation which is essential.
Most promising for me was https://ssbothwell.github.io/greedypacker-react/ Not sure am I doing something wrong but it doesn't calculate best fit for me. I have tried different combinations with different algorithms.
DEMO DATA: Sheet size: w:2655, h: 2100
{ w: 900, h: 320 },
{ w: 320, h: 900 },
{ w: 900, h: 320 },
{ w: 900, h: 320 },
{ w: 900, h: 320 },
{ w: 900, h: 320 },
{ w: 900, h: 320 },
{ w: 900, h: 320 },
{ w: 900, h: 320 },
{ w: 386, h: 310},
{ w: 386, h: 310},
{ w: 386, h: 310},
{ w: 386, h: 310},
{ w: 386, h: 310},
{ w: 860, h: 320},
{ w: 860, h: 320},
{ w: 564, h: 310 },
{ w: 452, h: 293},
{ w: 720, h: 530},
{ w: 720, h: 530},
{ w: 696, h: 530},
{ w: 696, h: 100 }
These parts should fit within one sheet.
After some time of researching, I have figure out that probably I should use a genetic algorithm in order to evolve these heuristic approaches. Does this make any sense?
w >= h
? – Moo