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: 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, 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)
This is Ipopt version 3.14.4, running with linear solver MUMPS 5.4.1. Number of nonzeros in equality constraint Jacobian...: 4 Number of nonzeros in inequality constraint Jacobian.: 28 Number of nonzeros in Lagrangian Hessian.............: 8 Total number of variables............................: 6 variables with only lower bounds: 0 variables with lower and upper bounds: 0 variables with only upper bounds: 4 Total number of equality constraints.................: 1 Total number of inequality constraints...............: 8 inequality constraints with only lower bounds: 0 inequality constraints with lower and upper bounds: 0 inequality constraints with only upper bounds: 8 iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls 0 0.0000000e+00 9.40e-01 7.14e-01 -1.0 0.00e+00 - 0.00e+00 0.00e+00 0 1 0.0000000e+00 9.19e-01 6.70e-01 -1.0 5.48e+00 - 2.03e-02 2.19e-02h 1 2 0.0000000e+00 9.13e-01 1.38e+02 -1.0 9.57e+00 - 4.65e-01 6.61e-03h 1 3 0.0000000e+00 8.44e-01 6.68e+02 -1.0 1.13e+02 - 1.02e-01 7.62e-02h 1 4 0.0000000e+00 7.14e-01 6.82e+02 -1.0 7.87e+00 0.0 1.00e+00 1.54e-01h 1 5 0.0000000e+00 5.22e-01 5.00e+02 -1.0 8.95e-02 - 3.39e-01 2.69e-01h 1 6 0.0000000e+00 3.37e-01 1.92e+03 -1.0 6.55e-02 -0.5 1.00e+00 3.54e-01h 1 7 0.0000000e+00 1.56e-01 1.89e+03 -1.0 4.21e-02 - 1.00e+00 5.38e-01h 1 8 0.0000000e+00 8.20e-02 7.50e+03 -1.0 1.93e-02 - 1.00e+00 4.74e-01h 1 9 0.0000000e+00 3.30e-02 1.11e+04 -1.0 1.02e-02 - 1.00e+00 5.97e-01h 1 iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls 10 0.0000000e+00 1.45e-02 3.10e+04 -1.0 4.10e-03 - 1.00e+00 5.61e-01h 1 11 0.0000000e+00 5.83e-03 6.41e+04 -1.0 1.80e-03 - 1.00e+00 5.98e-01h 1 12 0.0000000e+00 2.37e-03 1.55e+05 -1.0 7.24e-04 - 1.00e+00 5.94e-01h 1 13 0.0000000e+00 8.97e-04 3.26e+05 -1.0 2.94e-04 - 1.00e+00 6.21e-01h 1 14 0.0000000e+00 2.96e-04 6.01e+05 -1.0 1.11e-04 - 1.00e+00 6.70e-01h 1 15 0.0000000e+00 5.74e-05 6.07e+05 -1.0 3.68e-05 - 1.00e+00 8.06e-01h 1 16 0.0000000e+00 3.04e-05 1.70e+06 -1.0 7.14e-06 - 1.00e+00 4.71e-01f 2 17 0.0000000e+00 5.56e-07 4.14e+04 -1.0 4.20e-06 - 1.00e+00 9.82e-01h 1 18 0.0000000e+00 4.89e-07 9.77e+06 -1.0 5.10e-07 - 1.00e+00 1.22e-01f 2 19 0.0000000e+00 0.00e+00 3.98e-01 -1.0 4.52e-07 - 1.00e+00 1.00e+00h 1 iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls 20 0.0000000e+00 0.00e+00 4.44e-01 -8.6 5.22e-09 - 1.00e+00 1.00e+00h 1 21 0.0000000e+00 0.00e+00 5.41e-09 -8.6 1.24e-08 - 1.00e+00 1.00e+00h 1 Number of Iterations....: 21 (scaled) (unscaled) Objective...............: 0.0000000000000000e+00 0.0000000000000000e+00 Dual infeasibility......: 5.4057801152085361e-09 5.4057801152085361e-09 Constraint violation....: 0.0000000000000000e+00 0.0000000000000000e+00 Variable bound violation: 3.8046578483155568e-09 3.8046578483155568e-09 Complementarity.........: 2.5167291078393610e-09 2.5167291078393610e-09 Overall NLP error.......: 5.4057801152085361e-09 5.4057801152085361e-09 Number of objective function evaluations = 24 Number of objective gradient evaluations = 22 Number of equality constraint evaluations = 24 Number of inequality constraint evaluations = 24 Number of equality constraint Jacobian evaluations = 22 Number of inequality constraint Jacobian evaluations = 22 Number of Lagrangian Hessian evaluations = 21 Total seconds in IPOPT = 0.011 EXIT: Optimal Solution Found.
primal_status(model)
FEASIBLE_POINT::ResultStatusCode = 1
termination_status(model)
LOCALLY_SOLVED::TerminationStatusCode = 4
value(x)
-2.5000000015000023
value(y)
-2.5725473642121035e-15
This page was generated using Literate.jl.