Foundations of Bilevel Programming: Example Chapter 8.1, Page 255
This example is from the book Foundations of Bilevel Programming by Stephan Dempe, Chapter 8.1, Page 255. url
Here, only the second level is described
Model of the problem First level
\[\min 0,\\\]
Second level
\[\min x,\\ \notag s.t.\\ x+y \leq 2,\\ x-y \leq 2,\\ -4x+5y \leq 10,\\ -4x-5y \leq 10,\\\]
using BilevelJuMP
using Ipopt
model = BilevelModel(Ipopt.Optimizer; mode = BilevelJuMP.ProductMode(1e-9))An Abstract JuMP Model
Feasibility problem with:
Variables: 0
Upper Constraints: 0
Lower Constraints: 0
Bilevel Model
Solution method: BilevelJuMP.ProductMode{Float64}(1.0e-9, false, 0, nothing)
Solver name: IpoptFirst we need to create all of the variables in the upper and lower problems:
Upper level variables
@variable(Upper(model), y, start = 0)
#Lower level variables
@variable(Lower(model), x, start = 0)\[ x \]
Then we can add the objective and constraints of the upper problem:
Upper level objecive function
@objective(Upper(model), Min, 0 * y + 0)\[ 0 \]
Followed by the objective and constraints of the lower problem:
Lower objective function
@objective(Lower(model), Min, x)\[ x \]
Lower constraints
@constraint(Lower(model), x + y <= 2)
@constraint(Lower(model), x - y <= 2)
@constraint(Lower(model), -4x + 5y <= 10)
@constraint(Lower(model), -4x - 5y <= 10)\[ -5 y - 4 x \leq 10 \]
Now we can solve the problem and verify the solution again that reported by Dempe.
optimize!(model)
primal_status(model)
termination_status(model)
value(x)
value(y)1.8374724884861174e-15
This page was generated using Literate.jl.