We have a problem we are trying to solve where we have a number of different containers. Each container can hold a number of different items (call them "item A" through to "item H"). Each container can handle a different ratio of the items before it is full. So taking just three of the containers the ratios the can handle may be:
Container 1 may be able to hold the items in the ratio like below:
A B C D E F G H 1 2 3 3 3 3 2 1
Container 2 may be able to hold the items in the ratio like below:
A B C D E F G H 1 2 3 4 4 3 2 1
Container 3 may be able to hold the items in the ratio like below:
A B C D E F G H 1 1 2 2 3 3 4 4
What we need to try and find out is how to best fit packs of items with smaller ratios with a maximum number of items (say 5 or 6) into the containers. We can find all the different permutations of packs using combinatorics. We have a limit that out of all of the pack ratio permutations we can only select 3 or 4 different ones to use, so have to discard the worst fits and keep the best 3 or 4.
What we are struggling with is a technique that can test for the best of the smaller packs into the larger containers that is both accurate and performant. Currently we have one or the other!
Any maths geniuses out there that can help?