Originally posted by: MariusGi
Hello, I am trying to solve my problem with Benders decomposition cutting plate algorithm.
My main problem right now is that I'm running the calculations 3 times and I need to get all the dual values, but after calculations when I call cplex2.getDuals(vals2, con2); I get only dual values of the last calculation.
Secondly I will need to multiply 2x2 matrix and 1x2 different dual values 3x times. Is IloExpr function is capable of doing it and how to do it?
I want to calculate G, gradient, which needs dual values of each calculation in vector.
Really looking forward your awnser, thanx.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
IloRangeArray IRA2(env2);
for(int i=0;i<l;i++){
IRA2.add(IloRange(env2,0,T[i][0]*cplex.getValue(vars[0])+T[i][1]*cplex.getValue(vars[1])+W[i][0]*vars2[0]+W[i][1]*vars2[1]));
con2.add(IRA2[i]);
model2.add(IRA2[i]);
IloCplex cplex2(model2); // only extract once
for(int i=0;i<3;i++){
for(int j=0;j<2;j++) {
IRA2[j].setLB((float)rand()/(float)(RAND_MAX));
}
if ( !cplex2.solve() ) {
env2.error() << "Failed to optimize LP." << endl;
throw(-1);
}
IloNumArray vals2(env2);
cplex2.getDuals(vals2, con2);
env2.out() << "Dual values = " << vals2 << endl;
}
cplex2.getDuals(vals2, con2);
env2.out() << "Dual values = " << vals2 << endl; //TYPES JUST THE LAST DUAL VALUES
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#CPLEXOptimizers#DecisionOptimization