I'm trying to list all permutations of variables, where each variable has 2 alternatives which can not be in the same permutation.
Let's say we have 2 variables A and B but I need to use them with an Index as A1, A2 and B1, B2. To make it even more complicated, the "1" index can occur alone and is not allowed with another "1", the "2" index can not occur alone. So what I need would be:
- A1
- B1
- A1 B2
- B1 A2
Using 3 variables A1, A2, B1, B2, C1, C2:
- A1
- A1 B2
- A1 C2
- A1 B2 C2
- B1
- B1 A2
- B1 C2
- B1 A2 C2
- C1
- C1 A2
- C1 B2
- C1 A2 B2
And I would need it for n variables (n1, n2). I found this one, but it didn't really help me:permutations variable length, but it doesn't quite fit. Actually I don't have a clue at all at the moment how to handle this.