Setup
I have a $N \times M$ matrix with integer values and I need to group it into $K$ groups (subject to constraints). Internally I work with a flattened 1D list as I don't see any benefits of using this two-dimensionality, but I can change this if needed.
I have already a working solution to create these different groups and I would like to improve this model via symmetry breaking.
Edit:
I have a binary matrix $x_{i,j} \in \{0,1\}$ that takes value 1 if the matrix value i is assigned to group j, as asked by @Kuifje. An additional constraint I didn't mention is that the group have to be roughly in equal size.
Example:
I have a $2 \times 4$ matrix, thus $8$ elements, and I want to group them into $3$ groups named $A, B$ and $C$.
One possible way to create these group is:
matrix value | -4 | 1 | -4 | 5 | 1 | -1 | 4 | 3 |
---|---|---|---|---|---|---|---|---|
group | A | A | C | B | C | B | B | C |
Which is the same as saying (group $A$ and $B$ flipped, marked in bold):
matrix value | -4 | 1 | -4 | 5 | 1 | -1 | 4 | 3 |
---|---|---|---|---|---|---|---|---|
group | B | B | C | A | C | A | A | C |
The only thing which matters is how these fields are grouped, not to which particular group they belong.
Ideas:
I already have a symmetry breaking constraint which fixes field $0$ to group $A$, this removes already a few of the possible permutations. But I believe there is more performance gain possible.
Question
How can I extend my idea above to create more symmetry breaking constraints? Alternatively: is there a better way to model this, so that no symmetry breaking is needed?