Hi!
When trying to use lazy callbacks in JuMP I get the following error if CPLEX is used as solver:
ERROR: LoadError: TypeError: in typeassert, expected Tuple{CPLEX.Model,Function}, got a value of type Tuple{UInt64,Int64}
from function callback_wrapper(::Ptr{Nothing}, ::Int32, ::Ptr{Nothing}) at
at .julia\packages\CPLEX\DgohF\src\cpx_generic_callbacks.jl:15
The MWE is simply the callback example found in the Julia manual:
model = Model(GLPK.Optimizer)
@variable(model, x <= 10, Int)
@objective(model, Max, x)
function my_callback_function(cb_data)
x_val = callback_value(cb_data, x)
if x_val > 2 + 1e-6
con = @build_constraint(x <= 2)
MOI.submit(model, MOI.LazyConstraint(cb_data), con)
end
end
MOI.set(model, MOI.LazyConstraintCallback(), my_callback_function)
The same error is obtained with both CPLEX 12.10 and CPLEX 12.8 on a machine running Windows 8.1. The error disappears when using GLPK as a solver.
I am using Julia 1.5.0.
Any idea of how to solve this problem?
Thanks,
Michele