Originally posted by: Philippe_Refalo
The simplest way to express your constraints is to use constraints as expressions. For the sake of simplicity, assume that K is an array, you can count and restrict the number of variables of K having the same value of X this way
(X == K[0]) + (X == K[1]) + .... + (X == K[n]) == C
I your case C is equal to 3.
Is that the constraint that you want to state ?
It might be better for the search strategy to start to instantiate the X,Y and Z variables before the K variables to discover dead-ends earlier but it depends on other constraints of your model.
#CPOptimizer#DecisionOptimization