|
2 | 2 | "cells": [ |
3 | 3 | { |
4 | 4 | "cell_type": "markdown", |
5 | | - "metadata": {}, |
| 5 | + "metadata": { |
| 6 | + "id": "9_qd3IFVeXZB" |
| 7 | + }, |
6 | 8 | "source": [ |
7 | 9 | "# Bilevel Optimization Introduction\n", |
8 | 10 | "[](https://github.com/ampl/colab.ampl.com/blob/master/authors/eduardosalaz/bilevel/bilevel_introduction.ipynb) [](https://colab.research.google.com/github/ampl/colab.ampl.com/blob/master/authors/eduardosalaz/bilevel/bilevel_introduction.ipynb) [](https://deepnote.com/launch?url=https://github.com/ampl/colab.ampl.com/blob/master/authors/eduardosalaz/bilevel/bilevel_introduction.ipynb) [](https://kaggle.com/kernels/welcome?src=https://github.com/ampl/colab.ampl.com/blob/master/authors/eduardosalaz/bilevel/bilevel_introduction.ipynb) [](https://console.paperspace.com/github/ampl/colab.ampl.com/blob/master/authors/eduardosalaz/bilevel/bilevel_introduction.ipynb) [](https://studiolab.sagemaker.aws/import/github/ampl/colab.ampl.com/blob/master/authors/eduardosalaz/bilevel/bilevel_introduction.ipynb) [](https://ampl.com)\n", |
|
22 | 24 | { |
23 | 25 | "cell_type": "code", |
24 | 26 | "execution_count": 1, |
25 | | - "metadata": {}, |
| 27 | + "metadata": { |
| 28 | + "id": "r8Q6q4B_eXZE" |
| 29 | + }, |
26 | 30 | "outputs": [], |
27 | 31 | "source": [ |
28 | 32 | "# Install dependencies\n", |
|
32 | 36 | { |
33 | 37 | "cell_type": "code", |
34 | 38 | "execution_count": 2, |
35 | | - "metadata": {}, |
| 39 | + "metadata": { |
| 40 | + "id": "zEw9OOW7eXZE" |
| 41 | + }, |
36 | 42 | "outputs": [], |
37 | 43 | "source": [ |
38 | 44 | "# Google Colab & Kaggle integration\n", |
|
69 | 75 | "& y^* \\in \\arg\\min_{y} \\{f(x,y) : g(x,y) \\leq 0\\} && \\text{(Follower's problem)}\n", |
70 | 76 | "\\end{align}\n", |
71 | 77 | "$\n", |
72 | | - "**Key point**: The leader's objective depends on $y*$, which is the optimal solution to the follower's problem (which itself depends on $x$).\n", |
| 78 | + "\n", |
| 79 | + "**Key point**: The leader's objective depends on $y*$, which is the optimal solution to the follower's problem (which itself depends on $x$).\n", |
73 | 80 | "\n", |
74 | 81 | "## Why \"Bilevel\"?\n", |
75 | 82 | "\n", |
|
410 | 417 | "### Why Complementarity Represents \"Either/Or\" Logic\n", |
411 | 418 | "\n", |
412 | 419 | "The lower level problem is:\n", |
| 420 | + "\n", |
413 | 421 | "$$\n", |
414 | 422 | "\\min_{y} \\quad (y - x)^2 \\quad \\text{s.t.} \\quad y \\geq 0\n", |
415 | 423 | "$$\n", |
|
459 | 467 | "#### **Case 2: Boundary Solution ($y = 0$, so $\\lambda > 0$)**\n", |
460 | 468 | "\n", |
461 | 469 | "If $y = 0$, from stationarity:\n", |
| 470 | + "\n", |
462 | 471 | "$$2(0 - x) - \\lambda = 0 \\implies \\lambda = -2x$$\n", |
463 | 472 | "\n", |
464 | 473 | "For dual feasibility, we need $\\lambda \\geq 0$, which requires $x \\leq 0$.\n", |
465 | 474 | "\n", |
466 | 475 | "Substituting $y = 0$ into the upper level:\n", |
| 476 | + "\n", |
467 | 477 | "$$\\min_{x \\leq 0} \\quad x^2 + (0 - 10)^2 = x^2 + 100$$\n", |
468 | 478 | "\n", |
469 | 479 | "This is minimized at $x = 0$ (closest feasible point to unconstrained minimum).\n", |
|
0 commit comments