Reputation: 21
I'm looking for an algorithm to figure out the maximum number of "products" that can be created given limited "resource choices".
For example, let's say I want to create an ABC and are given these resource choices:
In this case, I can create at most 2 ABC by selecting 2 A and 1 B from the first choice, and 1 C from the second choice. Then I have a total of 2 A, 2 B, and 2 C which can create 2 ABC.
Is there an algorithm, other than brute forcing the permutations, which solves this problem?
For completeness, here are the constraints in my actual problem:
Upvotes: 1
Views: 110
Reputation: 3058
It can be solved using Linear Programming or using the Ford-Fulkerson Algorithm to solve the so-called Maximum Network Flow problem. It would take me quiet some time to try to explain any of the 2 mentioned algorithms, so I think you should take a look at some online resources. If you need to solve some real problem I suggest you to go through the algorithm(s) just to get idea how you can model this particular problem and then use some of the existing libraries. If you want to learn algorithms, feel free to write your implementation :)
Upvotes: 1