{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $f \\colon \\R^n \\times \\R^m \\to \\R^n$ define the discrete-time [[control system|ZPDTVZQN5K]] $x_{k+1} = f(x_k, u_k)$.\nLet $\\mathbb{X} \\subseteq \\R^n$, $\\mathbb{U} \\subseteq \\R^m$ and $\\mathbb{X}_f \\subseteq \\mathbb{X}$ be constraint sets.\nLet $\\ell \\colon \\R^n \\times \\R^m \\to \\R$ be a stage cost, let $V_f \\colon \\R^n \\to \\R$ be a terminal cost, and let $N \\ge 1$ be the horizon.\nFor $x \\in \\R^n$, let $P_N(x)$ be the problem: minimise\n$$\\sum_{i=0}^{N-1} \\ell(z_i, v_i) + V_f(z_N)$$\nover $v_0, \\dots, v_{N-1} \\in \\mathbb{U}$, subject to $z_0 = x$, $z_{i+1} = f(z_i, v_i)$, $z_i \\in \\mathbb{X}$ for $i \u003c N$, and $z_N \\in \\mathbb{X}_f$.\nAssume that $P_N(x)$ has a minimiser $(v_0^*(x), \\dots, v_{N-1}^*(x))$ for each $x$ in a set $\\mathcal{X}_N$, and fix a choice of it.\nThe *model predictive control law* is $\\kappa_N(x) = v_0^*(x)$ for $x \\in \\mathcal{X}_N$.\n*Model predictive control* operates the system in closed loop by $u_k = \\kappa_N(x_k)$: at each time $k$ it solves $P_N(x_k)$ and applies only the first control.\n\n## Remarks\n\nThe problem $P_N(x)$ is a finite-horizon [[optimal control|T3V6ZNAMDN]] problem, and the horizon moves forward with time, hence the name receding-horizon control.\nStability of the closed loop is not automatic.\nStandard sufficient conditions ask for a terminal set $\\mathbb{X}_f$ that is invariant under some local controller.\nThey also ask for a terminal cost $V_f$ that decreases along this controller by at least the stage cost.\nThen the optimal value of $P_N$ is a Lyapunov function of the closed loop.\n\nExample: $n = m = 1$, $f(x, u) = x + u$, no constraints, $\\ell(x, u) = x^2 + u^2$, $N = 1$ and $V_f(z) = z^2$.\nThen $P_1(x)$ minimises $x^2 + v^2 + (x + v)^2$, whose minimiser is $v = -x/2$.\nSo $\\kappa_1(x) = -x/2$, and the closed loop $x_{k+1} = x_k / 2$ converges to $0$.\n\nNon-example of a stabilising choice: in the same setting with $V_f = 0$, the problem minimises $x^2 + v^2$, so $\\kappa_1(x) = 0$.\nThe closed loop is $x_{k+1} = x_k$, which does not converge to $0$, although each step is optimal for the short horizon.\n\n## Explanations\n\n### L1 human\n\nAt each time the controller plans the best moves over the next $N$ steps, applies the first one, observes the new state, and plans again.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "15Z6BT9XYR",
    "kind": "definition",
    "msc": [
      "93B45",
      "49N35",
      "93C55"
    ],
    "name": "Model predictive control",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Model_predictive_control"
      }
    ],
    "tag": "SAH0W43RMW",
    "uses": [
      "T3V6ZNAMDN",
      "ZPDTVZQN5K"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/SAH0W43RMW/",
  "links": [
    {
      "field": "defines",
      "target": "15Z6BT9XYR"
    },
    {
      "field": "uses",
      "target": "T3V6ZNAMDN"
    },
    {
      "field": "uses",
      "target": "ZPDTVZQN5K"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/SAH0W43RMW.md",
  "msc": [
    "93B45",
    "49N35",
    "93C55"
  ],
  "name": "Model predictive control",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/SAH/SAH0W43RMW.md",
  "status": null,
  "tag": "SAH0W43RMW",
  "uri": "m2://SAH0W43RMW",
  "url": "https://tamnd.github.io/math2/wiki/model-predictive-control-definition/",
  "writing": {
    "tag": "SAH0W43RMW",
    "kind": "definition",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      },
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
