I'm trying to find a formula that gives the number of unique permutations of a set of 3 values of n length given a set of constraints.
The values: $-1, 0, 1$
Example Set: $[0, -1, 1, 1, 1, 1]$
the constraints:
- '$-1$' must follow more '$1$'s than '$-1$'s
- i.e: The sum of the values preceding a '$-1$' must be >= $0$
- '$-1$' must precede at least 2 '$1$'s
For instance, if given the example set above ($[0, -1, 1, 1, 1, 1]$) there would be 12 valid permutations.
For any combination of '$1$'s and '$0$'s, as there are no constraints for those values, I am able to use the formula:
$$\frac{ N! }{ A! \cdot B! \cdot C! ... ! }$$
Where $N$ is the total length of the set and $A, B, C$ are the counts of each value in the set.
I have seen ways to implement simple constraints to this formula in the way of pairs, such that for the set $A, A{'}, B, B{'}$ for every item $X$: $X$ must come before $X{'}$. However, I couldn't think of a way to apply the constraints I have to the formula.
Any help is appreciated, even if it's just that there is no way to do this. Thank you!