- #1
- 81
- 0
I'm trying to figure out the formula I need...
ok, say that r=5, so there are 5 items {A,B,C,D,E}
And we want to chose 5 of those
Order doesn't matter, repitions allowed
so for example {A,A,A,B,B} is a feasible solution
{A,B,C,D,E} is feasible
so on
But the formula (n+r-1)!/r!(n-1)! doesn't work because here n=r so it becomes (2n-1)!/(2n-1)! = 1.
Also, what happens when I want to put certain restrictions. Like for example, say I want an example of the above format with the exception that A and B can only be chosen if C is chosen. I know I would just find all those infeasible solutions and subtract them but I have a hard time finding those infeasibles. I mean, that situation seems obviosu but what if it has to do with ranking. Like say, A chosen --> B,C,D,E, are chosen. B chosen --> C,D,E chosen. D chosen --> E chosen. So what if there are n such rules. Do I make a case for each individually?
I suck at these stupid things
ok, say that r=5, so there are 5 items {A,B,C,D,E}
And we want to chose 5 of those
Order doesn't matter, repitions allowed
so for example {A,A,A,B,B} is a feasible solution
{A,B,C,D,E} is feasible
so on
But the formula (n+r-1)!/r!(n-1)! doesn't work because here n=r so it becomes (2n-1)!/(2n-1)! = 1.
Also, what happens when I want to put certain restrictions. Like for example, say I want an example of the above format with the exception that A and B can only be chosen if C is chosen. I know I would just find all those infeasible solutions and subtract them but I have a hard time finding those infeasibles. I mean, that situation seems obviosu but what if it has to do with ranking. Like say, A chosen --> B,C,D,E, are chosen. B chosen --> C,D,E chosen. D chosen --> E chosen. So what if there are n such rules. Do I make a case for each individually?
I suck at these stupid things