I wonder how a problem of the following type can be solved. I have looked for a solution but I am not to identify the kind of problem I am facing. I would like to know if there is a close formula or if it has to be solved with an algorithm.
I expose the problem through an specific example:
I have N=7 bags. Each bag contains aways a single element, but elements can be repeated. For instances:
bag 1: Element 1
bag 2: Element 1
bag 3: Element 1
bag 4: Element 2
bag 5: Element 2
bag 6: Element 3
bag 7: Element 3
On how many ways I can withdraw for example i=4 elements from which S=3 are different. For example:
1 (Bag 1)
1 (Bag 2)
2 (Bag 4)
3 (Bag 6)
Or:
1 (Bag 1)
1 (Bag 3)
2 (Bag 4)
3 (Bag 6)
I think the problem is related to multisets since the elements of the set are repeated but I am not sure
Regards