Hello,
I’m experiencing the same problem and I didn’t get how to fix it.
I’m using MOI v0.9.12, JuMP v0.21.1, CPLEX v0.6.3 in julia and ILO CPLEX 12.8.
Here’s my code
function my_Lazy_callback_function(cb_data)
TOL = 1e-6
for s in S,t in S, u in U, m in N, f in F, g in F
if my_condition == true && callback_value(cb_data, x[s,f,m,u])*callback_value(cb_data, x[t,g,m,u])>0 + TOL
con = @build_constraint(x[s,f,m,u] + x[t,g,m,u] <= 1)
MOI.submit(my_model, MOI.LazyConstraint(cb_data), con)
end
end
end
set_optimizer_attributes(my_model, "CPX_PARAM_REDUCE" => 0)
set_optimizer_attributes(my_model, "CPX_PARAM_PRELINEAR" => 0)
MOI.set(my_model, MOI.LazyConstraintCallback(), my_Lazy_callback_function)
And here’s the error I got (after starting the branch and bound process):
CPLEX.CplexError(1811, "CPLEX Error 1811: Attempt to invoke unsupported operation..\n")
Stacktrace:
[1] return_status_or_throw at /home/wesley/.julia/packages/CPLEX/VVr3o/src/cpx_generic_callbacks.jl:24 [inlined]
[2] cbrejectcandidate(::CPLEX.CallbackContext, ::Int32, ::Int32, ::Array{Float64,1}, ::Array{Int8,1}, ::Array{Int32,1}, ::Array{Int32,1}, ::Array{Float64,1}) at /home/wesley/.julia/packages/CPLEX/VVr3o/src/cpx_generic_callbacks.jl:161
[3] submit(::CPLEX.Optimizer, ::MathOptInterface.LazyConstraint{CPLEX.CallbackContext}, ::MathOptInterface.ScalarAffineFunction{Float64}, ::MathOptInterface.LessThan{Float64}) at /home/wesley/.julia/packages/CPLEX/VVr3o/src/MOI/MOI_callbacks.jl:130
[4] submit(::MathOptInterface.Bridges.LazyBridgeOptimizer{CPLEX.Optimizer}, ::MathOptInterface.LazyConstraint{CPLEX.CallbackContext}, ::MathOptInterface.ScalarAffineFunction{Float64}, ::MathOptInterface.LessThan{Float64}) at /home/wesley/.julia/packages/MathOptInterface/XiH8D/src/Bridges/bridge_optimizer.jl:1195
[5] submit(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}, ::MathOptInterface.LazyConstraint{CPLEX.CallbackContext}, ::MathOptInterface.ScalarAffineFunction{Float64}, ::MathOptInterface.LessThan{Float64}) at /home/wesley/.julia/packages/MathOptInterface/XiH8D/src/Utilities/cachingoptimizer.jl:667
[6] submit(::Model, ::MathOptInterface.LazyConstraint{CPLEX.CallbackContext}, ::ScalarConstraint{GenericAffExpr{Float64,VariableRef},MathOptInterface.LessThan{Float64}}) at /home/wesley/.julia/packages/JuMP/CZ8vV/src/callbacks.jl:35
[7] (::var"#my_Lazy_callback_function#260"{Instance,Array{VariableRef,4}})(::CPLEX.CallbackContext) at /disk2/wesley/Codes/Lazy/include/NSDP_solver.ipynb:In[+4]:632
[8] (::CPLEX.var"#45#46"{CPLEX.Optimizer})(::CPLEX.CallbackContext, ::Int64) at /home/wesley/.julia/packages/CPLEX/VVr3o/src/MOI/MOI_callbacks.jl:85
[9] (::CPLEX.var"#43#44"{CPLEX.Optimizer,CPLEX.var"#45#46"{CPLEX.Optimizer}})(::CPLEX.CallbackContext, ::Int64) at /home/wesley/.julia/packages/CPLEX/VVr3o/src/MOI/MOI_callbacks.jl:28
[10] callback_wrapper(::Ptr{Nothing}, ::Int64, ::Ptr{Nothing}) at /home/wesley/.julia/packages/CPLEX/VVr3o/src/cpx_generic_callbacks.jl:17
[11] optimize! at /home/wesley/.julia/packages/CPLEX/VVr3o/src/cpx_solve.jl:7 [inlined]
[12] optimize!(::CPLEX.Optimizer) at /home/wesley/.julia/packages/CPLEX/VVr3o/src/MOI/MOI_wrapper.jl:1838
[13] optimize!(::MathOptInterface.Bridges.LazyBridgeOptimizer{CPLEX.Optimizer}) at /home/wesley/.julia/packages/MathOptInterface/XiH8D/src/Bridges/bridge_optimizer.jl:239
[14] optimize!(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}) at /home/wesley/.julia/packages/MathOptInterface/XiH8D/src/Utilities/cachingoptimizer.jl:189
[15] optimize!(::Model, ::Nothing; bridge_constraints::Bool, ignore_optimize_hook::Bool, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/wesley/.julia/packages/JuMP/CZ8vV/src/optimizer_interface.jl:131
[16] optimize! at /home/wesley/.julia/packages/JuMP/CZ8vV/src/optimizer_interface.jl:107 [inlined] (repeats 2 times)
[17] macro expansion at /disk2/wesley/Codes/Lazy/include/NSDP_solver.ipynb:In[+10]:9 [inlined]
[18] macro expansion at ./util.jl:234 [inlined]
[19] solve_NSDP_model(::Model, ::Parameters, ::Instance) at /disk2/wesley/Codes/Lazy/include/NSDP_solver.ipynb:In[+10]:8
[20] top-level scope at ./In[2]:126
If a change the LazyConstraint routine by UserCut as described in Callbacks · JuMP, it works. However, I have to use LazyConstraints cause I want to cut some integer solutions (since I initiate the process with a reduced model).
Also, some cuts are added during the pre-processing, but it stops with the above error in the first node of the B&B tree.
Could you please help me?
Regards,
Wesley