Reputation: 1365
How can I code a bi-level optimization problem using scipy.optimize.minimize
which consists of the following two levels, (1) being the upper-level problem, which is subject to (2) being the lower-level:
I know how to write a single objective function for quadratic programming as a typical scipy.optimize.minimize
routine (step 2 by itself), but how can I add an upper level minimization problem as well that has its own objective function? Can scipy
handle a minimization problem subject to a lower minimization problem? A rough outline of the code using minimize
and linprog
would help
Upvotes: 2
Views: 1398
Reputation: 16724
I don't think scipy solvers are very suited for this.
A standard approach for bilevel problems is to form the KKT conditions of the inner problem and add these as constraints to the outer problem. The complementarity conditions make the problem hard. You need a global NLP solver or a MIP solver to solve this thing to proven optimality. Here are some formulations for linear bilevel problems. If the inner problem is a (convex) QP problem, things become a little bit more difficult, but the same idea can be applied (form KKT conditions of the inner problem).
For more information see Bard, Practical Bilevel Optimization: Algorithms And Applications, Springer, 1998.
Upvotes: 4