Python Forum
2D Bin packing - brute force in python - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: 2D Bin packing - brute force in python (/thread-33462.html)



2D Bin packing - brute force in python - WBPYTHON - Apr-27-2021

Hi everyone,

Does anybody has written in python an optimized solution for brute forcing 2D-BIN packing ?

For instance I have a number of rectangles like 12x54 ; 10x14 ; 58x35 ; 50x50 , etc. And a standard size of bin of 100x100 And i would like to try all combination possibles in order to select the best fit (when we have max remaining place). We can rotate the rectangle by 90°.And if the bin is full, we can put it in another bin.

I have already found and tried plenty of algorithms (like MaxRect, Guillotine, etc). But sometimes the human find better packing than these aglso. so I'll try to see what it cost to brute force.

I am aware that I might be long and hard for my machine to calculate but I want to try.

In order to make sure I understand well, for instance the number of possibilities for my example upper would be 4x2(rotate of 90°)x7x6x5x4x3x2x1 ) = 40320 ?

Thank you in advance for helping me.


RE: 2D Bin packing - brute force in python - Gribouillis - Apr-27-2021

How do you define the remaining place? (the objective function)


RE: 2D Bin packing - brute force in python - WBPYTHON - Apr-28-2021

Hi,

The red rectangle is the remaining space.

[Image: None-13600x2400-1.png]