Jacop, constraint solver

207 Views Asked by At

I am a beginner in Jacop constraint solver. I looked into its documents but couldn't find how to solve my following problem. I have a matrix[n][n] of nxn domain variables of IntVar. Now, I need to apply the following constraint to it:

matrix[matrix[i][j]][k] == x

Here x is a regular integer, I mean not domain variable. The problem that i am facing is that matrix[i][j] is a domain variable, and I am unable to give it as the first index in matrix[index][k] again. I will really appreciate your help.

1

There are 1 best solutions below

0
On

Basically you need to use element constraints to do that. First, create a vector matrix_k that represent a column k of matrix. Then, you can use Element constraint of the form Element(matrix[i][j], matrix_k, x).