Dear Julia Discourse community,
When running my Unit tests to make my package solver-agnostic:
import RingStarProblems as RSP
using Test
@testset "RingStarProblems.jl" begin
# Write your tests here.
include("aqua.jl")
include("solutionchecker.jl")
pars = RSP.SolverParameters(
solve_mod = RSP.Both(), # ILP, B&BC or Both
sp_solve = RSP.Poly(),
writeresults = RSP.WHTML(), # output results locally, html or no output ""
o_i = 0, # opening costs
s_ij = RSP.Euclidian(), # star costs
r_ij = RSP.Euclidian(), # ring costs
backup_factor = 0.01, # backup_factor c'=0.01c and d'=0.01c
do_plot = false, # plot_results (to debug)
two_opt = 0, # use two_opt heuristic (not functional yet)
tildeV = 100, # uncertain nodes set
timelimit = 120, # Gurobi TL
log_level = 1, # console output log_level
redirect_stdio = false, # redirecting_stdio to output file
F = 183, # total failing time F, see PhD manuscript
use_blossom = false, # use blossom inequalities (not functional yet)
alphas = [3], # See [Labbé et al., 2004](ttps://doi.org/10.1002/net.10114)
nthreads = 4, # Number of threads used in GUROBI, set 0 for maximum number of available threads
ucstrat = true, # use user cut
)
using SCIP
@info "Testing with SCIP"
@test RSP.rspoptimize(pars, 1 ; solutionchecker = true, optimizer = SCIP.Optimizer) == 0
@test RSP.rspoptimize(pars, 3 ; solutionchecker = true, optimizer = SCIP.Optimizer) == 0
@info "Testing with Gurobi"
using Gurobi
@test RSP.rspoptimize(pars, 1 ; solutionchecker = true, optimizer = Gurobi.Optimizer) == 0
@test RSP.rspoptimize(pars, 3 ; solutionchecker = true, optimizer = Gurobi.Optimizer) == 0
end
All tests pass for Gurobi, but for SCIP, there is an error saying that Lazy constraints are not supported, see:
RingStarProblems.jl: Error During Test at /home/julien/Documents/Travail/Julia/RingStarProblems.jl/test/runtests.jl:33
Test threw exception
Expression: RSP.rspoptimize(pars, 3; solutionchecker = true, optimizer = SCIP.Optimizer) == 0
MathOptInterface.UnsupportedAttribute{MathOptInterface.LazyConstraintCallback}: Attribute MathOptInterface.LazyConstraintCallback() is not supported by the model.
Stacktrace:
[1] throw_set_error_fallback(model::SCIP.Optimizer, attr::MathOptInterface.LazyConstraintCallback, value::Function; error_if_supported::MathOptInterface.SetAttributeNotAllowed{MathOptInterface.LazyConstraintCallback})
@ MathOptInterface ~/.julia/packages/MathOptInterface/aJZbq/src/attributes.jl:589
[2] throw_set_error_fallback(model::SCIP.Optimizer, attr::MathOptInterface.LazyConstraintCallback, value::Function)
@ MathOptInterface ~/.julia/packages/MathOptInterface/aJZbq/src/attributes.jl:580
[3] set(model::SCIP.Optimizer, attr::MathOptInterface.LazyConstraintCallback, args::Function)
@ MathOptInterface ~/.julia/packages/MathOptInterface/aJZbq/src/attributes.jl:553
[4] set(b::MathOptInterface.Bridges.LazyBridgeOptimizer{SCIP.Optimizer}, attr::MathOptInterface.LazyConstraintCallback, value::Function)
@ MathOptInterface.Bridges ~/.julia/packages/MathOptInterface/aJZbq/src/Bridges/bridge_optimizer.jl:942
[5] _pass_attribute(dest::MathOptInterface.Bridges.LazyBridgeOptimizer{SCIP.Optimizer}, src::MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}, index_map::MathOptInterface.Utilities.IndexMap, attr::MathOptInterface.LazyConstraintCallback)
@ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/aJZbq/src/Utilities/copy.jl:51
[6] pass_attributes(dest::MathOptInterface.Bridges.LazyBridgeOptimizer{SCIP.Optimizer}, src::MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}, index_map::MathOptInterface.Utilities.IndexMap)
@ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/aJZbq/src/Utilities/copy.jl:38
[7] default_copy_to(dest::MathOptInterface.Bridges.LazyBridgeOptimizer{SCIP.Optimizer}, src::MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}})
@ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/aJZbq/src/Utilities/copy.jl:391
[8] copy_to
@ ~/.julia/packages/MathOptInterface/aJZbq/src/Bridges/bridge_optimizer.jl:442 [inlined]
[9] attach_optimizer(model::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.Bridges.LazyBridgeOptimizer{SCIP.Optimizer}, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}})
@ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/aJZbq/src/Utilities/cachingoptimizer.jl:225
[10] optimize!(m::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.Bridges.LazyBridgeOptimizer{SCIP.Optimizer}, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}})
@ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/aJZbq/src/Utilities/cachingoptimizer.jl:317
[11] optimize!(model::JuMP.Model; ignore_optimize_hook::Bool, _differentiation_backend::MathOptInterface.Nonlinear.SparseReverseMode, kwargs::@Kwargs{})
@ JuMP ~/.julia/packages/JuMP/7rBNn/src/optimizer_interface.jl:595
[12] optimize!
@ ~/.julia/packages/JuMP/7rBNn/src/optimizer_interface.jl:546 [inlined]
[13] benders_st_optimize_lazy!(m::JuMP.Model, x::JuMP.Containers.SparseAxisArray{JuMP.VariableRef, 2, Tuple{Int64, Int64}}, y::JuMP.Containers.DenseAxisArray{JuMP.VariableRef, 2, Tuple{UnitRange{Int64}, UnitRange{Int64}}, Tuple{JuMP.Containers._AxisLookup{Tuple{Int64, Int64}}, JuMP.Containers._AxisLookup{Tuple{Int64, Int64}}}}, f::RingStarProblems.var"#f#256"{Dict{Tuple{Int64, Int64}, Float64}, Vector{Float64}, UnitRange{Int64}, Int64}, F::Float64, B::JuMP.VariableRef, inst::RingStarProblems.RRSPInstance, pars::RingStarProblems.SolverParameters, start_time::Float64; optimizer::Type)
@ RingStarProblems ~/Documents/Travail/Julia/RingStarProblems.jl/src/benders_rrsp.jl:641
[14] rrspcreatebenders_modellazy(filename::String, inst::RingStarProblems.RRSPInstance, pars::RingStarProblems.SolverParameters; optimizer::Type)
@ RingStarProblems ~/Documents/Travail/Julia/RingStarProblems.jl/src/benders_rrsp.jl:178
[15] rrspcreatebenders_modellazy
@ ~/Documents/Travail/Julia/RingStarProblems.jl/src/benders_rrsp.jl:48 [inlined]
[16] main(pars::RingStarProblems.SolverParameters, filename::Vector{String}; solutionchecker::Bool, optimizer::Type)
@ RingStarProblems ~/Documents/Travail/Julia/RingStarProblems.jl/src/main.jl:181
[17] main
@ ~/Documents/Travail/Julia/RingStarProblems.jl/src/main.jl:91 [inlined]
[18] rspoptimize(pars::RingStarProblems.SolverParameters, id_instance::Int64; solutionchecker::Bool, optimizer::Type)
@ RingStarProblems ~/Documents/Travail/Julia/RingStarProblems.jl/src/main.jl:83
[19] macro expansion
@ ~/.julia/juliaup/julia-1.10.4+0.x64.linux.gnu/share/julia/stdlib/v1.10/Test/src/Test.jl:669 [inlined]
[20] macro expansion
@ ~/Documents/Travail/Julia/RingStarProblems.jl/test/runtests.jl:33 [inlined]
[21] macro expansion
@ ~/.julia/juliaup/julia-1.10.4+0.x64.linux.gnu/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
[22] top-level scope
@ ~/Documents/Travail/Julia/RingStarProblems.jl/test/runtests.jl:6
I am very much surprised by this error because JuMP manual says:
Available solvers
Solver-independent callback support is limited to a few solvers. This includes CPLEX, GLPK, Gurobi, Xpress, and SCIP.
Does anyone know what I am missing? Thank you so much