title: 2D Bin Packing Algorithm
body: <p>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 :)</p>
  
  <p>The perfect example of what I need to achieve is demonstrated here <a href="http://www.cutlistoptimizer.com" rel="noreferrer">http://www.cutlistoptimizer.com</a>. It works, but I can't figure out what algorithm it uses.</p>
  
  <p>I have tried many approaches some of them are very simple like <a href="https://codeincomplete.com/posts/bin-packing/" rel="noreferrer">https://codeincomplete.com/posts/bin-packing/</a> <a href="https://codeincomplete.com/posts/bin-packing/demo/" rel="noreferrer">DEMO here</a>, but it doesn't support rotation which is essential. </p>
  
  <p>Most promising for me was <a href="https://ssbothwell.github.io/greedypacker-react/" rel="noreferrer">https://ssbothwell.github.io/greedypacker-react/</a>
  Not sure am I doing something wrong but it doesn't calculate best fit for me. I have tried different combinations with different algorithms.</p>
  
  <p>DEMO DATA:
  Sheet size: w:2655, h: 2100</p>
  
  <pre><code>{ 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 }
  </code></pre>
  
  <p>These parts should fit within one sheet.</p>
  
  <p>Reference image
  <a href="https://i.stack.imgur.com/8FFT2.png" rel="noreferrer"><img src="https://i.stack.imgur.com/8FFT2.png" alt="enter image description here"></a></p>
  
  <p>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?</p>