My minizinc model is working fine, but i need to convert it to Java code so i used choco to do it. The problem I am facing right now is the mechanism that minizinc woks with is different form choco. I wrote the constraints i used in minizinc exactly in choco but it didn't work.
Suppose that :
minizinc model is :
array[sub_set] of var cl_set: cl_id;
constraint alldifferent(cl_id);
constraint forall(i in sub_set) ( sub_cap[i] <= cl_cap[cl_id[i]]);
choco code is :
cl_id = VF.boundedArray("", sub_sz, 0, cl_sz - 1, solver);
solver.post(ICF.alldifferent(cl_id));
for (int i = 0; i < sub_sz; i++) {
Constraint a = ICF.arithm(VF.fixed(cl_cap[cl_id[i].getValue()], solver), ">=", sub_cap[i]);
solver.post(a);
}
- The cl_cap is an array of int.
cl_id[i].getValue()
is always 0 because it gets the lower bound of the domain and the constraint doesn't apply to cl_id
What should I do to make the choco constraint work the same way as minizinc?