joaquimg / BilevelJuMP.jl

Bilevel optimization in JuMP
Other
103 stars 25 forks source link

MibS_example2.jl #216

Open shabnamvaziri opened 5 months ago

shabnamvaziri commented 5 months ago

Hi,

In MibS_example2.jl, when I change the variables to be continuous, I encounter the following error:

"Currently MibS works on only MIP-MIP problems and the input model is not MIP-MIP!!"

Stacktrace: [1] _build_single_model(upper::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}, lower::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}, lower_to_upper_link::Dict{MathOptInterface.VariableIndex, MathOptInterface.VariableIndex}, lower_only::Dict{MathOptInterface.VariableIndex, MathOptInterface.VariableIndex}, check_MIPMIP::Bool) @ BilevelJuMP C:\Users\umroot.julia\packages\BilevelJuMP\0Me8v\src\mibs.jl:65 [2] _build_single_model(model::BilevelModel, check_MIPMIP::Bool) @ BilevelJuMP C:\Users\umroot.julia\packages\BilevelJuMP\0Me8v\src\mibs.jl:11 [3] (::BilevelJuMP.var"#64#65"{Bool, Bool, String, Bool, BilevelModel, typeof(mibs), String})(path::String) @ BilevelJuMP C:\Users\umroot.julia\packages\BilevelJuMP\0Me8v\src\mibs.jl:280 [4] mktempdir(fn::BilevelJuMP.var"#64#65"{Bool, Bool, String, Bool, BilevelModel, typeof(mibs), String}, parent::String; prefix::String) @ Base.Filesystem .\file.jl:766 [5] mktempdir(fn::Function, parent::String) @ Base.Filesystem .\file.jl:762 [6] mktempdir @ Base.Filesystem .\file.jl:762 [inlined] [7] #solve_with_MibS#63 @ BilevelJuMP C:\Users\umroot.julia\packages\BilevelJuMP\0Me8v\src\mibs.jl:277 [inlined] [8] solve_with_MibS(model::BilevelModel, mibs_call::Function) @ BilevelJuMP C:\Users\umroot.julia\packages\BilevelJuMP\0Me8v\src\mibs.jl:268 [9] top-level scope @ In[11]:61"

I use Julia 1.10.0 and Mibs Version: 1.1.3. Can you help me how to solve this error? I need to use Mibs for solving bilevel mixed integer model for my thesis.

Thank you

odow commented 5 months ago

As the error says, MibS supports only problems with mixed-integer variables in the lower and upper. It does not support the case where one of the levels contains only continuous variables.

shabnamvaziri commented 5 months ago

@odow Thanks for your response. In "https://github.com/joaquimg/BilevelJuMP.jl/blob/master/docs/src/examples/MibS_example2.jl" there are 3 variables as follows: @variable(Upper(model), x, Int) @variable(Upper(model), z, Bin)

Lower level variables

@variable(Lower(model), y, Int) If I change x to be continuous and keep z binary and y integer, I cannot solve the problem. I am not sure if this is because of the installation of Mibs or you face the same error as well.