I want to find all ways to distribute n
elements to b
bins but without "duplicates" and empty bins.
Example
If I have n = 3
elements and b = 2
bins and apply the bruteforce method from this stackoverflow thread Bin packing bruteforce method I get these results:
[[0, 1, 2, 3], []]
[[0, 1, 2], [3]]
[[0, 1, 3], [2]]
[[0, 1], [2, 3]]
[[0, 2, 3], [1]]
[[0, 2], [1, 3]]
[[0, 3], [1, 2]]
[[0], [1, 2, 3]]
[[1, 2, 3], [0]]
[[1, 2], [0, 3]]
[[1, 3], [0, 2]]
[[1], [0, 2, 3]]
[[2, 3], [0, 1]]
[[2], [0, 1, 3]]
[[3], [0, 1, 2]]
[[], [0, 1, 2, 3]]
Definition of "duplicates"
Half of the results are duplicates. Only the order of the bins is switched: First and last is the same, 2nd and 2nd to last is the same, etc...
Definition of empty bins
I don't want any bins to be empty. If you look at the previous example the first and the last line have an empty bin.