I have a specific problem and I am kind of stuck. Don't know exactly where to begin defining what it is. Is someone could just give me a nodge in the right direction or even better, tell me what kind of problem it is, that would be nice. I can of course do the hard work myself but right now I need some help figuring out what to google basically.
The problem is like this, it involves balls of different colors and amounts.
Given something along the lines of this:
3 red balls
2 green balls
1 blue ball
I want to find combinations of the sets below that together contain exactly the combinations of balls that are given. There can be a lot of balls of other colors and I don't care about them.
The data to choose from looks like this:
Set 1
2 red
1 blue
2 yellow
Set 2
1 red
1 blue
3 purple
Set 3
1 purple
1 green
Set 4
1 red
1 green
Set 5
1 red
1 blue
2 greens
3 brown
A possible solution would be this:
Set 1 + Set 3 + Set 4 is a valid solution. It adds up to this:
3 red
1 blue
2 green
2 yellow
1 purple
Which contains the given specification, again, the amounts of balls contained within the solution that is of a color that is not in the given specification is not a problem. There can be multiple solutions, for example Set 1 + Set 5 is also a valid solution and I want to find that as well. There is no need to constraint to a specific amount of sets to be chosen, unless that is easier of course.
What kind of problem is this and what can be used to find the solutions?
Thanks in advance!
First, find every possible combination of sets that satisfy the requirement for number of red balls. For your example, these are:
$S_1 = \{1, 2\}$
$S_2 = \{1, 4\}$
$S_3 = \{1, 5\}$
$S_4 = \{2, 4, 5\}$
$S_5 = \{1, 2, 3\}$
$S_6 = \{1, 3, 4\}$
$S_7 = \{1, 4, 5\}$
$S_8 = \{1, 3, 5\}$
$S_9 = \{2, 3, 4, 5\}$
For each combination found above, find which of those combinations has the required number of green balls. These are:
$T_1 = \{1, 5\}$
$T_2 = \{1, 3, 4\}$
For each combination found above, find which of those combinations has the required number of blue balls. These are:
$U_1 = \{1, 5\}$
$U_2 = \{1, 3, 4\}$
You would need to repeat this for each color ball that you have a requirement for (here, we did this for red, green, and blue). Note the order doesn't matter. This ignores the balls of different colors that you don't have requirements for.