Honestly, i have a testing calculate how many containers of a given size and weight capacity it takes to pack the specified goods. But i'm really bad at algorithm, so i post this to looking some hint from you guys. Any help is appreciate. Thank you guys !
I have three container sizes and their capacities like this :
Container Size : Large
Maximum Volume (m3) : 76
Maximum Weight (kg) : 29,600
Container Size : Medium
Maximum Volume (m3) : 67.3
Maximum Weight (kg) : 27,397
Container Size : Small
Maximum Volume (m3) : 33
Maximum Weight (kg) : 22,100
Given a total weight and volume for goods in a shipment, the algorithm must output the most efficient combination of containers to pack the goods in. The system should use larger containers where possible, but empty space should be minimised.
For input of volume 213m3 and weight 22,421kg, the expected output is:
array(
‘L’ => array(
‘quantity’ => 2,
‘volume’ => 152,
‘weight’ => 16000
),
‘M’ => array(
‘quantity’ => 1,
‘volume’ => 61,
‘weight’ => 6421
),
‘S’ => array(
‘quantity’ => 0,
‘volume’ => 0,
‘weight’ => 0
),
)
For input of volume 182m3 and weight 19,158kg, the expected output is:
array(
‘L’ => array(
‘quantity’ => 2,
‘volume’ => 152,
‘weight’ => 16000
),
‘M’ => array(
‘quantity’ => 0,
‘volume’ => 0,
‘weight’ => 0
),
‘S’ => array(
‘quantity’ => 1,
‘volume’ => 30,
‘weight’ => 3158
),
)
I can't understand how it work ....
So please hint me.
Thank you.