var 1..5: k=1;
array[1..2] of var 1..48: key2;
constraint forall(i in 1..4,j in 1..48 where k= ceil(j/24))(if
table[i,j]!=0 then key2[k]=j else true endif);
I am trying to apply this constraint in my minizinc program.Objective is to maximize cost function and this is one of the constraints but when i run this code it shows
Finished in 203msec
Compiling first.mzn with data empdata2.dzn
Running first.mzn
=====UNSATISFIABLE=====
Finished in 189msec
If I replace key2[k]=j with true then it compiles and run without any errors. I am not using key2 array anywhere else in my program.I am using datafile to give input and i have initiailised key2 array as key2=[1,1]. I am beginner in minizinc and I am not understanding why is there problem in assigning number to array in this case?
I ran the following model and it gave a lot of solutions (using "solve satisfy") for both Gecode and G12fd solvers. Which MiniZinc version do you use? I use the latest Git version MiniZinc 2.0 which is about the same as v2.0.2.
var 1..5: k=1;
array[1..2] of var 1..48: key2;
array[1..4,1..48] of var 0..1: table;
solve satisfy;
constraint forall(i in 1..4,j in 1..48 where k= ceil(j/24))(if
table[i,j]!=0 then key2[k]=j else true endif);
output [
"key2:", show(key2), "\n",
"table: ", show(table), "\n",
];
Do you have other constraints in the model not shown here?