I want to maximise the number of pallets of material I can send in a shipment. My pallets of material are one of three different classes:
I need to calculate how many pallet footprints or bottom pallets are required for any order if I am given a list of the materials pallets are ordered. For example: 10 Pallets of Material Type 1 and 20 pallets of Material Type 2 and 3 pallets of Material type 3. How many Bottom Pallets would the order take up?
EDIT: Let's set the limit of bottom pallets for the truck to 24. The max pallets stackable are two, that is to say, you can not stack more than two pallets on top of each other. Note: Material 2 cannot be stacked on top of Material 1.
Given the current constaints, the number of footprints necessary for the stacking would be
t3 + ( 1 if t1 + t2 > 0, 0 otherwise )
where t1
denotes number of pallets of Type 1, t2
denotes the number of pallets of Type 2 and t3
denotes the number of pallets of Type 3. The pallets of Type 3 cannot be stacked together with anything else; if pallets of Type 1 or Type 2 are present, they can be stacked together, first the pallets of Type 2 and then the pallets of Type 1.
Edit
Since at most 2 pallets can be stacked on top of each other and each truck can load at most 24 stacks, the answer is different. The number of total stacks would be
#Stacks = t3 + ceil( ( t1 + t2 ) / 2 )
where ceil
denotes rounding up to the nearest integer. Each pallet of Type 3 must be stacked alone, so at least t3
stacks are necessary. The remaining pallets of Type 1 and Type 2 can be organized in stacks of height at most 2 with apparently no real limitation; if Type 1 and Type 2 go alone into one stack there is no problem, if both Type 1 and Type 2 are present, put Type 2 to the bottom.
Finally, the total number of trucks necessary would be
#Trucks = ceil(#Stacks/24)
where the last truck possibly has some unused space left.