Originally posted by: JorgeGarcíaCastillo
Hello,
I'm working with the version of CP Optimizer that comes with CPLEX Studio 12.4. I found a problem that I've been able to reproduce in a tiny trivial model.
The exception stacktrace is the following :
ilog.concert.IloException: The referenced IloExtractable has not been extracted by the IloAlgorithm
at ilog.cp.cppimpl.cp_wrapJNI.IloCP_startNewSearch__SWIG_2(Native Method)
at ilog.cp.cppimpl.IloCP.startNewSearch(IloCP.java:161)
at ilog.cp.IloCP.startNewSearch(IloCP.java:2296)
I attach the following code snippet where the problem occurs:
public class CPProblem {
public static void main(String[] args) {
IloCP cpo = new IloCP();
int[][] matrix = { { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 1 }, { 1 }, { 1 } };
List<Integer> listOfInts = new ArrayList<Integer>();
listOfInts.add(1);
listOfInts.add(0);
try {
int[] values = new int[listOfInts.size()];
int cont = 0;
for (Integer i : listOfInts) {
values[cont++] = i;
}
// Vars
IloIntVar[] x = new IloIntVar[7];
for (int d = 0; d < x.length; d++) {
String name = "X" + Integer.toString(d);
x[d] = cpo.intVar(values, name);
}
// Constraints
for (int i = 0; i < 7; i++) {
IloConstraint ct = cpo.member(x[i], matrix[i]);
cpo.add(ct);
}
cpo.setParameter(IloCP.IntParam.SearchType, IloCP.ParameterValues.DepthFirst);
cpo.setParameter(IloCP.IntParam.LogVerbosity, IloCP.ParameterValues.Verbose);
cpo.setParameter(IloCP.IntParam.Workers, 1);
// Search
IloSearchPhase sp = cpo.searchPhase(x);
cpo.startNewSearch(sp);
while (cpo.next()) {
processSolution(cpo);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (cpo != null) {
cpo.end();
}
}
}
public static void processSolution(IloCP cpo) {
System.out.println("Solution found");
}
}
This problem reproduces in a bigger instance of a complex model and there is no possibility to change CP version to a more recent one. Where does it come from and how can I solve it??
Note : I noticed that modifing very little the model the exception dissapears. For example, adding one more element to the listOfInts (listOfInts.add(6)) and one more number to the matrix ( matrix = {{0,1,6},{1,0},{1,0}{1,0}{1,0},{1},{1}}).
Thanks a lot.
Jorge Garcia
#CPOptimizer#DecisionOptimization