JamesBremner / knapsack

3D Bin packing code direct from psuedocode
3 stars 1 forks source link

Staging error in DPS3UK pseudo code #5

Closed JamesBremner closed 4 years ago

JamesBremner commented 4 years ago

The algorithm DPS3UK (dynamic programming for the k-staged 3UK) described in Algorithm 2 ... computes, for each stage b, the best solution for cuts done only in one direction

However the pseudo code does NOT do this. Instead it changes the cut orientation each time a cut is made.

======= STAGE 1============
horizontal cut 0 0 2 64 0 1 64<64+0
depth cut 0 1 0 64 0 0 64<64+64
horizontal cut 0 1 2 64 0 1 64<64+0
depth cut 0 2 0 64 0 1 64<64+0
horizontal cut 0 2 2 64 0 1 64<64+0
vertical cut 1 0 1 64 0 0 64<64+64
horizontal cut 1 0 2 64 0 1 64<128+64
depth cut 1 1 0 64 0 0 64<128+128
vertical cut 1 1 1 64 0 0 64<64+64

The reason this happens is that the update of previous occurs in the wrong place, after each iteration among the dimensions, instead of after each iteration along the stages.

The lines at 2.25, 2,36 and unnumbered must be removed abd replace with a single update at the end of the dody of the loop through stages.

JamesBremner commented 4 years ago

Since this algorithm is unbounded ( creates as many duplicate orders as will fit and permits some order to be ignored ) we will not be using it for timber allocation. So closing this issue.