I'm messing arround with minizinc and I want to have a static mzn file where I make the solving using only the dzn. For a better understanding of the question, here's a sample:
include "globals.mzn";
include "data.dzn";
int: time;
int: n;
int: l=n*n;
array[1..4,0..time,1..l] of var bool: X;
solve satisfy;
I now want to initialize only few elements of X using the dzn file (the other elements should be vars).
The dzn would look like this
time=1;
n=3;
X[4,1,7]=true;
Since this initialization is impossible, I also tried using X=array3d(1..4,0..time,1..l,[false,...,false]
where every element other than the element in position (4,1,7) is false. However this initializes every element and I cannot obtain the result I wish since it cannot satisfy the constraints I have.
Is there a way to initialize only one or some elements of this array using the dzn file?
One way to do this is to use the anonymous variable (
_
) in the data matrix in the dzn file. Here is a simple example:And the data file:
Note that this approach requires at least one non-anonymous value, otherwise this message is thrown:
array literal must contain at least one non-anonymous variable
.