Originally posted by: SystemAdmin
>
>
> I already tried IloCplex.intVarArray() but I saw that I still was using a numVarArray somewhere else, and that causes problems when trying to retrieve variables with a range.
It should not. This is the Java API, correct? The following sample code mixes integer variables into a numVarArray and works fine:
IloCplex cplex = new IloCplex();
IloNumVar[] array = cplex.numVarArray(3, 0, 100);
array[0] = cplex.numVar(0, 100, "x");
array[1] = cplex.boolVar("y");
array[2] = cplex.numVar(0.0, Double.MAX_VALUE, "z");
//...
if (cplex.solve()) {
double[] v = cplex.getValues(array); // gets values for x, y and z
//...
}
Regarding error 1017, I doubt that has to do with the array declarations; more likely you asked for something (such as reduced costs) that exist for LPs but not for MIPs.
/Paul
Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
#CPLEXOptimizers#DecisionOptimization