Originally posted by: Didier Vidal
You should call the next() method of the CP engine. This is straightforward in C++, java or C#. If you do this from OPL, you have first to create a 'main' function, where you can invoke the CP engine in the non default way (ie not just solve). I have written a simple example below. You can find other similar codes in the OPL examples of the distribution.
using CP; main
{ var runConfig =
new IloOplRunConfiguration(
"draft.mod"); runConfig.oplModel.generate(); runConfig.cp.startNewSearch();
while (runConfig.cp.next())
{ writeln(runConfig.oplModel.i);
} writeln(
"All solutions found");
} dvar
int i[1..5] in 1..5; constraints
{ allDifferent(i);
}
#ConstraintProgramming-General#DecisionOptimization