# CPLEX Auto-Benders: How do I get the number of optimality and feasibility cuts?

I am using CPLEX's 12.9 auto-Benders decomposition feature (from the CPLEX Java API). Following the documentation I let CPLEX decide the decomposition strategy as

// model is an IloCplex object and is currently modeling a MIP problem.
// The following lets Cplex decide how to decompose the problem.


It works, and in the output to screen I read

CPXPARAM_Benders_Strategy                        3
CPXPARAM_Simplex_Tolerances_Feasibility          9.9999999999999995e-08
CPXPARAM_MIP_Tolerances_MIPGap                   9.9999999999999995e-07


and

Benders cuts applied:  120


However, I cannot manage to access that number 120. I tried

model.getNcuts(IloCplex.CutType.Benders);


but it returns 0. So my question is: How do I access the number of Benders cuts? And is there a way to tell optimality and feasibility cuts apart?

• Take a look at the question and the accepted answer in this question at IBM forum. Although it's for c++ but maybe it helps for your first question. – EhsanK Nov 23 '19 at 15:45
• Thanks @EhsanK. The answer lists the possible cut types, and confirms that among these there are Benders cuts which only apply when using a branch-and-cut based Benders decomposition (as in my case). It basically confirms that what I am doing should return me the number of Benders cuts. – k88074 Nov 25 '19 at 8:58
• I am having exactly the same problem in C++/Concert. The method cplex.getNcuts(IloCplex::CutType::CutBenders)reports the wrong number of Benders cuts added. Btw, I am using V.12.10.0. The 12.7.0 version documented already this method for obtaining the cuts count, but it brought up compilation error whenever I tried to use it. – cesarknbv Feb 3 '20 at 5:48

Related to my previous comment:

About the issue you reported on the function getNcuts(), we looked at it and I can confirm that we have a bug in the number of Benders cuts reported by the function getNcuts() (the issue is there with all CPLEX APIs).

The issue which I described will be fixed in the next CPLEX release.

About the issue you reported on the function getNcuts(), we looked at it and I can confirm that we have a bug in the number of Benders cuts reported by the function getNcuts() (the issue is there with all CPLEX APIs).

The Benders algorithm implemented in CPLEX consists of two main phases. In the first phase, we solve the continuous relaxation of the (reformulated) problem, by applying the so-called Benders cut loop. In the second phase, we apply a branch-and-cut starting from the formulation that we have at the end of the first phase (which already contains some Benders cuts). In CPLEX 12.10, the log displays information also for the first phase (the Benders cut loop), so the two phases should be clearly visible. If you are interested in more details on the Benders implementation in CPLEX, you can find a quite detailed description of the algorithm here: http://www.optimization-online.org/DB_HTML/2019/12/7506.html

In the log, the "Benders cuts applied" information which is reported in the end gives that total number of Benders cuts that were applied, considering both phases described above. However, due to a bug in the cut counting, from the APIs, the function getNcuts() only returns the number of Benders cuts applied in the second phase. Note that this issue only affects the counting of the Benders cuts but it has no impact on the behavior of the algorithm. Also note that, with "applied cuts", we mean the cuts that were added to the problem and that were kept in the problem, so cuts that were temporarily added and removed afterwards are not counted.

About your other question on the distinction between number of optimality and number of feasibility cuts, currently there is no way for the user to have separate information about optimality and feasibility Benders cuts.