[ library(fd_global) | Reference Manual | Alphabetic Index ]


Constrain the rows and columns of Matrix to be different values
A two dimensional square matrix of Variables or integer


This constraint is a matrix version of alldifferent. Matrix is a two dimensional square (NxN) matrix, and the constraint ensures that the elements in each row and column of the matrix are different. The same value can occur in different rows and columns. It is logically equivalent to imposing 2N alldifferent constraints, on each row and column, but it allows more reasoning because it considers the rows and columns together. The alldifferent constraint used is the lib(fd_global) version. The maximum propagation occurs when the variables' domains also have N values

This is currently a prototype -- the constraint has not been tested very extensively and little effort has been spent to optimise performance. We welcome any feedback on using this constraint.

This constraint is described in J.-C. Regin and C. Gomes, 'The Cardinality Matrix Constraint', CP 2004.

See Also

alldifferent / 1, ic_global : alldifferent_matrix / 1, fd_global_gac : alldifferent_matrix / 1, ic_global_gac : alldifferent_matrix / 1