0

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:

  • Material Type 1 (fragile): Can be stacked with another pallet of type 1, can be stacked on top of a pallet of material type 2.
  • Material Type 2 (sturdy): Can be stacked with another pallet of material type 2, can be stacked underneath material type 1. Cannot be stacked on top of Material 1
  • Material Type 3 (very fragile): Cannot be stacked.

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.

Bartley
  • 290
  • 2
  • 7
  • 21
  • 1
    And how many pallets can you load to one truck? – libik Nov 25 '15 at 11:17
  • 1
    First, all pallets of Type 3 have to be served, as they cannot be stacked. They must be considered alone and be seen as not contributing to the actual problem. – Codor Nov 25 '15 at 11:18
  • 2
    Is there a maximum of the number of pallets that can be stacked on top of each other? If not, all pallets of Type 2 and 1 can be stacked into a single stack; at the bottom Type 2 and on the top Type 1. – Codor Nov 25 '15 at 11:20
  • 1
    I've added the limit for the number of bottom pallets – Bartley Nov 25 '15 at 11:42

1 Answers1

2

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.

Codor
  • 17,447
  • 9
  • 29
  • 56
  • 1
    However I believe that some constraint is missing in the original problem statement... – Codor Nov 25 '15 at 11:27
  • would you be able to show the workings for the example I gave above? – Bartley Nov 25 '15 at 12:00
  • 1
    Is there a bound on the height of the pallet stacks? – Codor Nov 25 '15 at 12:02
  • no bound, sorry, updated my question: we can only stack up to max two pallets high – Bartley Nov 25 '15 at 12:02
  • added one more rule to be explicit "Material 2 cannot be stacked on top of Material 1" - does this have an impact on the formula you expressed above? (#Stacks = t3 + ceil( ( t1 + t2 ) / 2 )) – Bartley Nov 25 '15 at 14:28
  • 1
    No, the solution is still valid, as Type 2 would be put to the bottom. – Codor Nov 25 '15 at 14:30