Knapsack! And there is no way to determine the best solution before every combinations has been tried. I have been in the exact same spot as you but ended up making a specific module for it which didn't needed any computation beforehand.
Hold on, so you did you bruteforce all-all possible solutions and then just picked the best one out of them?
How many products you had? Was it close to what I have?
In my case there are just too many possible solution. I waited for an hour on my current one and it didn't finish :)
What was your strategy with regards of how much each bag type you select? Try all possible from current_max downto 7,500?
In which context were you solving this problem? I'm trying to optimize products distribution.