Originally posted by: EhsanN
I'm solving an optimization problem using a B&C algorithm in CPLEX. In my algorithm, I've used a lazy cut callback to derive the cuts. This process requires solving a separation problem based on the current node solution. As the solution is a 4-index decision variable, I've implemented the following code to retrieve the solution:
fourDNumArray myCallbackAlloc(myMainEnv, nbNodes);
for(i = 0; i < nbNodes; i++){
myCallbackAlloc[i] = IloArray<IloArray<IloNumArray> >(myMainEnv, nbNodes);
for(j = 0; j < nbNodes; j++){
myCallbackAlloc[i][j] = IloArray<IloNumArray>(myMainEnv, nbNodes);
for(k = 0; k < nbNodes; k++){
myCallbackAlloc[i][j][k] = IloNumArray(myMainEnv);
getValues(myCallbackAlloc[i][j][k], allocation[i][j][k]);
}
}
}
The above procedure is fast enough for instances of 10 nodes or less. However, for instances of 20 nodes or more, this is ineffective. In fact, this procedure requires 20 seconds for a 20-node instance, while solving the separation problem itself requires just 2 or 3 seconds.
My understanding is the getValues method only retrieves one-dimensional arrays of decision variables, and not 2D or more arrays. So, I'm wondering if there is any other way to retrieve the solution information faster.
PS. I'm using the 64-bit edition of CPLEX 12.5 on both Windows 7 64-bit and Linux 64-bit Machines with enough memory and CPU power.
#CPLEXOptimizers#DecisionOptimization