Foundations of Bilevel Programming: Example Chapter 5.1, Page 127

This example is from the book Foundations of Bilevel Programming by Stephan Dempe, Chapter 5.1, Page 127. url

Model of the problem

First level

\[\min x^2 + y,\\ \notag s.t.\\ -x-y\leq 0,\\\]

Second level

\[\min x,\\ \notag s.t.\\ x \geq 0,\\\]

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: Ipopt

First 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, x^2 + y)

\[ x^2 + y \]

Upper level constraints

@constraint(Upper(model), u1, -x - y <= 0)

u1 : $ -y - x \leq 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), l1, x >= 0)

l1 : $ x \geq 0 $

Now we can solve the problem and verify the solution again that reported by Dempe.

optimize!(model)

primal_status(model)

termination_status(model)
LOCALLY_SOLVED::TerminationStatusCode = 4

Results

objective_value(model)

value(x)

value(y)

atol = 1e-3 # src
0.001

This page was generated using Literate.jl.