Dear folks,
I use JuMP (v0.21.4) and CPLEX (v0.7.3) to solve a MILP with lazy and user cuts added in a generic callback. However, I am confused with the output. To obtain the number of cuts after solving, I wrote the function:
function cpx_getnumcuts( model::Model, cuttype::Int )
moi_model = backend(model)
data_p = Ref{Cint}()
ret = CPXgetnumcuts(moi_model.env, moi_model.lp, cuttype, data_p)
if ret != 0
@warn "error retrieving $cuttype"
end
return data_p[]::Int32
end
cuttype
with values CPLEX.CPX_CUT_TABLE
or CPLEX.CPX_CUT_USER
should return the number of lazy and user cuts, respectively, as far as I understand the cplex documentation. Now there are two issues:
(i) If I deactivate adding user cuts, the function with cuttype = CPLEX.CPX_CUT_TABLE
always returns zero whereas the returned value coincides with the CPLEX output “User cuts applied:” if cuttype = CPLEX.CPX_CUT_USER
. It is the same behavior when the user cuts are activated.
(ii) When I submit a cut, I also count the number of submissions manually, e.g.,
MOI.submit(model, MOI.LazyConstraint(cb_data), con)
nLCUTS += 1
and
MOI.submit(model, MOI.UserCut(cb_data), con)
nUCUTS += 1
However, the number of cuts never coincide, for instance, here is an output of an instance
nCUTS: 76 #return value of the above function with cuttype = CPLEX.CPX_CUT_USER
nLCUTS: 550
nUCUTS: 17
Which values are correct? And/or how can I retrieve the correct numbers of added lazy and user cuts (separately)?
Many thanks in advance, mike_k