<p>Unfortunately, the problem you want to solve here is NP-complete, so there are no great absolute solutions to this problem, but the following papers provide some nice heuristic algorithms which are not difficult to implement.</p>

<p><a href="https://pdfs.semanticscholar.org/bb99/86af2f26f7726fcef1bc684eac8239c9b853.pdf?_ga=1.50320358.1394974689.1485463187" rel="nofollow noreferrer">OPTIMIZING THREE-DIMENSIONAL BIN PACKING THROUGH SIMULATION</a></p>

<p><a href="http://www.ic.unicamp.br/~fkm/publication/rotation.pdf" rel="nofollow noreferrer">Three-dimensional packings with rotations</a></p>

<p><a href="https://arxiv.org/pdf/1305.1961.pdf" rel="nofollow noreferrer">An Improved Three-Weight Message-Passing Algorithm</a></p>
3D BPP algorithm in Python
<p>I'm working on an algorithm to optimize the packing of items in boxes. </p>

<p>I can have up to 20 items which I need to pack in as few boxes as possible (6 possible box sizes), while minimizing the wasted volume within the boxes. I thought of implementing a variation of the <strong>3D BPP algorithm</strong> - which solves part of my problem - but cannot find any algorithm <strong>written in Python</strong>. </p>

<p>Does anyone have suggestions of the way to go or of python algorithms for 3D BPP which I could use?</p>

<p>Thanks!</p>