Counting lazy constraints
回答済みHi all,
I'm trying to apply Benders Decomposition to a problem using callback function in C++.
I understand that whenever Gurobi found a MIP solution (that is where == GRB_CB_MIPSOL), I must get the incumbent solution using getSolution, then solve the subproblem and check if a cut need to be added using addLazy.
The condition that I check at each iteration is as follows:
if (varVal[varIndex->thetaOmegaIndex[1]] - subProblem.get(GRB_DoubleAttr_ObjVal) > 0)
{
//So we need to add a cut!
addLazy(theCutExpr, GRB_GREATER_EQUAL, 0.0);
cutCounter++;
}
As you can see in the code, I've also defined the global variable cutCounter to count the cuts that are added to model. I know that the Gurobi gives me the numbers of lazy constraints that have been added to the model.
The problem is that when I check the Gurobi report and compare it with the cutCounter, I get two different values! (Please see the last sentence of the following log file)
Cutting planes:
Lazy constraints: 97
Explored 1569 nodes (188581 simplex iterations) in 30.06 seconds (38.02 work units)
Thread count was 1 (of 16 available processors)
Solution count 3: 1761 1508 1228
Time limit reached
Best objective 1.761000000000e+03, best bound 6.167127329585e+03, gap 250.2060%
User-callback calls 8903, time in user-callback 10.18 sec
---------------------------------------
cutCounter = 176
Why it's like that? Is it normal? or I'm missing something?
I can provide more details if required.
Thanks
-
Hi Amirhossein,
This is normal. Sometimes a lazy constraint that has been added becomes redundant and is removed from the model, lowering the number of lazy constraints reported.
- Riley
0
サインインしてコメントを残してください。
コメント
1件のコメント