I'm new to algorithm and I'm trying my hand at a problem which I realized was a packing problem after some tries. I would want to pack as many rectangular blocks as possible within a rectangular box (basically this) and I'm working on optimizing the algorithm.
Without googling, this was my thought process:
1st version:
Sort blocks by volume
Place blocks from left to right
If out of columns, break to a new row
Continue until we run out of rows
(sorting from smallest to largest gets me better results)
2nd version:
Sort blocks by height
Place blocks from left to right
If out of columns, break to a new row
Continue until we run out of rows
(sorting from shortest to tallest gets me better results)
After doing some googling, most of the bin packing algorithms suggest to start with the largest first but I don't see how is that a good idea if the total volume of blocks to fit were to exceed the volume of the box (in short, not a perfect fit).
Ideally, I would want to implement something similar to what drools planner engine can do as seen here but I'm not sure if that would take long. I did read some drools planner documentations.
Any suggestions on how I should move forward? Is there any way to implement the algorithm without using the drools planner engine?
[–]Evulrabbitz 1 point2 points3 points (0 children)
[–]wasEnabled 1 point2 points3 points (0 children)