Originally posted by: SystemAdmin
Hi,
The simplest way to observe search behavior in your case is to use the following goal:
ILCGOAL2(IlcMySetValue, IlcIntVar, var, IlcInt, val) {
//cout << " " << var << " == " << val << endl;
var.setValue(val);
return 0;
}
ILCGOAL2(IlcMyRemoveValue, IlcIntVar, var, IlcInt, val) {
//cout << " " << var << " != " << val << endl;
var.removeValue(val);
return 0;
}
ILCGOAL1(IlcMyInstantiate, IlcIntVar, var) {
if (var.isBound()) return 0;
IlcInt val = var.getMin();
return IlcOr(IlcMySetValue(getManager(), var, val),
IlcAnd(IlcMyRemoveValue(getManager(), var, val),
this));
}
ILCGOAL1(IlcMyGenerate, IlcIntVarArray, vars) {
IlcInt index = IlcChooseMinSizeInt(vars);
if (index == -1) return 0;
else return IlcAnd(IlcMyInstantiate(getManager(), vars
index), this);
}
ILOCPGOALWRAPPER1(IloMyGenerate, cp, IloIntVarArray, iloVars) {
return IlcMyGenerate(cp, cp.getIntVarArray(iloVars));
}
This goal behaves like IloGenerate(_env, vars, IlcChooseMinSizeInt). You can use this goal in CP and in CP Optimizer. If you uncomment the cout lines in IlcMySetValue and IlcMyRemoveValue then the choices made by the search are displayed.
If there is a difference in the search route between CP and CPO then this means that there are differences in domain reduction. There are two possible reasons for such a difference:
-
change in propagation between CP and CPO (due to bug correction or a stronger propagation);
-
change in your model between CP and CPO ; even a small change can have a large impact on the search.
If there is no difference, this mean that the progation itself is slower.
In the case the difference is not on your side, we would appreciate to have a code demonstrating the problem in order to correct it and to give you a workaround. The code will not be disclosed outside CP Optimizer team and we can eliminate it once we have solved the problem.
Regards
Philippe
#CPOptimizer#DecisionOptimization