I have a set of data of size $X$, say $X = 7$. I want to find all of the unique ways that the data can be grouped into two bins of a minimum size of two. For the example where $X = 7$, I have:
Bin A: 5 4
Bin B: 2 3
As the possible arrangements. What I need is what the actual arrangements are. So if the data for $X = 7$ up there is $A B C D E F G$ for the first column there then I need:
Combination 1:
Bin A: A B C D E
Bin B: F G
Combination 2:
Bin A: A B C D G
Bin B: F E
Combination 3:
Bin A: A B E D G
Bin B: F C
etc.
until I have all possible combinations for the data. The restictions I have are that a bin has to have a minimum size of 2 and the bins are non-unique, so {A B} is the same as {B A}.
What we need is to split set $A$ with $X$ elements into two subsets $C$ and $D$ with at least two elements each.
To split this into two sets of size $x$ and $X-x$ we can select randomly $x$ elements. We can do that in $\binom{X}{x}$ ways. Notice, that selecting $X-x$ elements out of $X$ would give the same result. Thus we need to do groupings for $x\leq \left\lfloor\frac{X}{2}\right\rfloor$
Finally the number of splitting elements into two bins with alt least two elements each is equal to
$$\sum_{x=2}^{\left\lfloor\frac{X}{2}\right\rfloor}\binom{X}{x}$$
For example for $X=7$ we have $$\sum_{x=2}^{3}\binom{7}{x} = \binom{7}{2}+\binom{7}{3}=21+35=56 $$
The algorithm could be represented simply by following python code: