Here is an example:
using JuMP, BilevelJuMP, Gurobi
model=BilevelModel(Gurobi.Optimizer)
set_optimizer_attribute(model,"NonConvex",2)
@variable(Lower(model), x)
@variable(Upper(model), y)
@objective(Upper(model), Min, 3x + y)
@constraints(Upper(model), begin
x <= 5
y <= 8
y >= 0
end)
@objective(Lower(model), Min, -x)
@constraint(Lower(model), x + y <= 8)
@constraint(Lower(model), [1; [x;y]] in SecondOrderCone())
optimize!(model)
I want to add the SOCP constraint in BilevelJuMP.
But after running the code, the error shows Set MathOptInterface.SecondOrderCone is not accepted when solution method is BilevelJuMP.SOS1Mode{Float64}
Stacktrace:
[1] error(::String) at .\error.jl:33
[2] accept_vector_set at C:\Users\zlq.julia\packages\BilevelJuMP\wSyR2\src\moi.jl:214 [inlined]
[3] build_bilevel(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.GenericModel{Float64,MathOptInterface.Utilities.ModelFunctionConstraints{Float64}}}}, ::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.GenericModel{Float64,MathOptInterface.Utilities.ModelFunctionConstraints{Float64}}}}, ::Dict{MathOptInterface.VariableIndex,MathOptInterface.VariableIndex}, ::Array{MathOptInterface.VariableIndex,1}, ::BilevelJuMP.SOS1Mode{Float64}, ::Dict{MathOptInterface.VariableIndex,MathOptInterface.ConstraintIndex}; copy_names::Bool, pass_start::Bool) at C:\Users\zlq.julia\packages\BilevelJuMP\wSyR2\src\moi.jl:381
[4] optimize!(::BilevelModel; lower_prob::String, upper_prob::String, bilevel_prob::String, solver_prob::String, file_format::MathOptInterface.FileFormats.FileFormat) at C:\Users\zlq.julia\packages\BilevelJuMP\wSyR2\src\jump.jl:394
[5] optimize!(::BilevelModel) at C:\Users\zlq.julia\packages\BilevelJuMP\wSyR2\src\jump.jl:354
[6] top-level scope at untitled-7bc4389150e9b12048a3abbe3ef0022f:18
[7] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1088
in expression starting at untitled-7bc4389150e9b12048a3abbe3ef0022f:18
Can’t model the SecondOrderCone problem in BilevelJuMP?