Working with PHP for this.
From a given set of items, each with its own weight, I need to automatically calculate the most effective way to package the items into 100 lbs packages (max package weight of 100 lbs is static, but can be changed in the future). A single package cannot exceed the maximum specified.
As an example, I have 5 items - with a total weight of 254 lbs:
- Item 1 -> 51 lbs
- Item 2 -> 28 lbs
- Item 3 -> 73 lbs
- Item 4 -> 51 lbs
- Item 5 -> 51 lbs
One would assume that 254 lbs would require 3 x 100 lbs packages. This example purposely demonstrates that this is not always the case. Certain item configurations could not work well together. This example would require 4 x 100 lbs packages in its optimal configuration.
The item count and weights are completely variable, and no single item will exceed 100 lbs.
What would be the most optimal way to achieve this?