imagine you have a list of ingredients. Each ingredient has five traits, let's call them A, B, C, D and E. You want a mix of ingredients for which the sum of each trait is known.
for example:
- ingredient 1 has 5 A, 2 B, 0 C, 0 D and 3 E.
- ingredient 2 has 0 A, 3 B, 2 C, 2 D and 0 E
- ingredient 3 has 0 A, 0 B, 6 C, 6 D and 4 E.
- the goal is 10 A, 10 B, 10 C, 10 D and 10 E.
- the algorithm finds that you need 2 x ingredient 1, 2 x ingredient 2 and 1 x ingredient 3.
the algorithm should work
- for any amount of ingredients (my real problem has 206)
- for ingredients which could contain any combination of the five traits
- for any finite sum goal
- if there is no possible combination, the algorithm should return it is impossible
thanks for the help! Aron