Originally posted by: open_ball
Hi,
I am implementing Benders decomposition with the lazy callback function in Java API. After I completed my implementation, the final result that I obtain turned out to be wrong (i.e., underestimated the true optimal for a maximization problem). When I get into the callback function, I solve the primal problem and use getDual() method to obtain the dual values to generate the Benders cut.
I created a toy example where only six cuts are added into the pool. For every iteration, I stored the objective value and the optimal values for the primal variable. For example, here is the results for the first iteration together with the cut generated.
objective of primal-> 1.0
x[0] ->0.0
x[1] ->0.0
x[2] ->0.0
x[3] ->1.0
IloRange : -infinity <= (1.0*dual_estimation - 1.25*masterVariable_0 - 1.5*masterVariable_1 - 2.5*masterVariable_2- 2.25*masterVariable_3 - 3.75*masterVariable_4 - 5.0*masterVariable_5 - 1.0*masterVariable_6 - 0.75*masterVariable_7) <= 0.0
Now, just to make sure that these are correct values, for each iteration, I took the fixed master variables and solved the primal problem outside of my Benders implementation. It seems like everything is correct. That is why only thing that could be wrong is the dual values that I obtain via the getDual() method.
Hence, I also stored the dual values and tried to match them by solving the dual problem outside of the Benders implementation (I also coded the dual problem and fed the fixed master values into the dual). It turned out that dual values are way different than each other.
When I create the primal, I store the constraints in a map.
ArcTime arcTime =new ArcTime(i,j,t)
…
IloRange constraint = (IloRange) sub.addLe(subVariable,upperBound.get(arc), "myConstraint_"+arcTime.toString());
constraintMap.put(arcTime, constraint);
Then, when I enter into the callback function, after solving the sub problem, I get the dual values as:
Iterator<ArcTime> set = indexSet.iterator();
while(set.hasNext()){
ArcTime arcTime = set.next();
IloRange constraint = constraintMap.get(arcTime);
expr = cplex.sum(expr, sub.getDual(constraint) * constraint.getUB());
}
My only guess is that when I call the getDual() method, I might be doing something wrong. I was wondering if someone has any thought on what I could be doing wrong.
#CPLEXOptimizers#DecisionOptimization