dvdoug / BoxPacker

4D bin packing / knapsack problem solver
MIT License
612 stars 156 forks source link

Depth not summarised #622

Closed JapSeyz closed 4 days ago

JapSeyz commented 4 days ago

Hey,

It's possible that I don't understand how the BoxPacker works, we have it putting 100mm worth of items, into a package that is at max 45mm deep.

The maxContentDepth is correctly set to 45mm.

Adding the 4 items gives me the following output:

item 1 was packed at coordinate (0, 0, 0) with w200, l150, d40
item 2 was packed at coordinate (0, 150, 0) with w200, l150, d40
item 3 was packed at coordinate (200, 0, 0) with w141, l128, d10
item 4 was packed at coordinate (200, 150, 0) with w142, l124, d10

I can't seem to notice that they all have a depth, but are all placed at depth 0. I can't tell if it is intended, but it seems to select a wrong box as the depth here should be 100 and not 40, right?

> $packed->top()->getUsedDepth();
40

I am on v. 4.0.1

JapSeyz commented 4 days ago

Edit, this is neat, and shows that I was completely wrong:

https://boxpacker.io/en/master/visualiser.html?packing={"items":[["item 1",200,150,40],["item 2",200,150,40],["item 3",128,141,10],["item 4",124,142,10]],"boxes":[["L1",345,345,45,[[0,0,0,0,200,150,40],[1,0,150,0,200,150,40],[2,200,0,0,141,128,10],[3,200,150,0,142,124,10]]]]}