Algorithm Search⌘K

Techniqueresearch

Stochastic MPC

Also called chance-constrained MPC.

MPC with random disturbances that minimizes an expected cost and asks that each constraint hold with a given probability.

Stochastic MPC is model predictive control for a plant with random disturbances whose distribution is known, at least in part. It minimizes the expected cost, and it replaces each hard constraint by a chance constraint: the constraint must hold with a probability of at least 1−ε1 - \varepsilon. Robust MPC, such as tube MPC or min-max MPC, protects against the worst disturbance, which is rare and often far from typical. Stochastic MPC accepts a small, chosen rate of violations and in return uses the constraint range much better. For a linear plant with Gaussian noise and a fixed feedback, the expected cost is the nominal cost plus a constant, and each chance constraint becomes a deterministic constraint on the nominal state, tightened by a multiple of the standard deviation of the error. For other distributions, the tightening comes from a distribution-free inequality or from sampled scenarios.

In plain words

When the disturbance is random, the worst case can be very unlikely but very large. Planning for it wastes most of the room you have. Stochastic predictive control plans for the usual case and allows a limit to be crossed only rarely, for example in one case out of twenty. It works out how far the real state can drift from the plan, as a spread of possible values, and keeps the plan away from each limit by a few times that spread. The spread is smaller than the worst case, so the plan can come closer to the limits. When little is known about the disturbance, a cruder rule or a set of sampled disturbances replaces the exact spread. The cost is an average over the random disturbances, not the cost of one bad case.

When it applies

  • A plant xk+1=Axk+Buk+wkx_{k+1} = A x_k + B u_k + w_k with independent disturbances wkw_k of zero mean and covariance WW, with a known distribution or at least a known covariance.
  • Constraints whose rare violation is acceptable, such as a quality limit, a comfort band or an energy limit. Safety limits that must never be crossed need robust methods.
  • A cost on the average behavior, E∑k(xkTQxk+ukTRuk)\mathbb{E} \sum_k (x_k^T Q x_k + u_k^T R u_k).
  • For the analytic tightening below, a feedback KK with AK=A+BKA_K = A + B K Schur, and either Gaussian noise or a distribution-free bound.

The template

  1. Split the state. Write uk=Kxk+vku_k = K x_k + v_k for planned inputs vkv_k and split xk=zk+ekx_k = z_k + e_k into a nominal part zk+1=AKzk+Bvkz_{k+1} = A_K z_k + B v_k with z0=xz_0 = x and an error ek+1=AKek+wke_{k+1} = A_K e_k + w_k with e0=0e_0 = 0.
  2. Propagate the covariance. Σ0=0\Sigma_0 = 0 and Σk+1=AKΣkAKT+W\Sigma_{k+1} = A_K \Sigma_k A_K^T + W. This is computed once, offline. As kk grows, Σk\Sigma_k increases to the solution Σ∞\Sigma_\infty of the Lyapunov equation Σ=AKΣAKT+W\Sigma = A_K \Sigma A_K^T + W.
  3. Tighten the constraints. Replace the chance constraint Pr⁡(aTxk≤b)≥1−ε\Pr(a^T x_k \le b) \ge 1 - \varepsilon by
aTzk≤b−γaTΣka,a^T z_k \le b - \gamma \sqrt{a^T \Sigma_k a},

with γ=Φ−1(1−ε)\gamma = \Phi^{-1}(1 - \varepsilon) for Gaussian noise, where Φ\Phi is the standard normal distribution function, or γ=(1−ε)/ε\gamma = \sqrt{(1 - \varepsilon)/\varepsilon} for any distribution with the given covariance. 4. Write the expected cost. It equals the nominal cost of (z,Kz+v)(z, K z + v) plus terms tr(QΣk)+tr(KTRKΣk)\mathrm{tr}(Q \Sigma_k) + \mathrm{tr}(K^T R K \Sigma_k) that do not depend on vv. 5. Solve and apply. Solve the resulting QP for vv, apply u=Kx+v0u = K x + v_0, and repeat at the next sample.

Why it works. The error eke_k does not depend on the planned inputs, it has zero mean, and its covariance is Σk\Sigma_k by induction: Cov(AKek+wk)=AKΣkAKT+W\mathrm{Cov}(A_K e_k + w_k) = A_K \Sigma_k A_K^T + W, since wkw_k is independent of eke_k.

Cost. E[(z+e)TQ(z+e)]=zTQz+2zTQ E[e]+E[eTQe]=zTQz+tr(QΣ)\mathbb{E}[(z + e)^T Q (z + e)] = z^T Q z + 2 z^T Q\, \mathbb{E}[e] + \mathbb{E}[e^T Q e] = z^T Q z + \mathrm{tr}(Q \Sigma). The input u=K(z+e)+vu = K (z + e) + v gives in the same way E[uTRu]=(Kz+v)TR(Kz+v)+tr(KTRKΣ)\mathbb{E}[u^T R u] = (K z + v)^T R (K z + v) + \mathrm{tr}(K^T R K \Sigma).

Gaussian constraints. If the wkw_k are Gaussian, so is aTeka^T e_k, with mean 0 and variance s2=aTΣkas^2 = a^T \Sigma_k a. Then Pr⁡(aTxk≤b)=Φ((b−aTzk)/s)\Pr(a^T x_k \le b) = \Phi((b - a^T z_k)/s), which is at least 1−ε1 - \varepsilon exactly when aTzk≤b−Φ−1(1−ε) sa^T z_k \le b - \Phi^{-1}(1 - \varepsilon)\, s.

Any distribution. The one-sided Chebyshev inequality, also called Cantelli's inequality, gives Pr⁡(aTek≥t)≤s2/(s2+t2)\Pr(a^T e_k \ge t) \le s^2/(s^2 + t^2) for every t>0t > 0. With t=s(1−ε)/εt = s \sqrt{(1 - \varepsilon)/\varepsilon} the bound is ε\varepsilon, so the tightened constraint again implies the chance constraint.

What is not proved here. The chance constraints hold for the prediction made at each sample, given the state measured then. The fraction of violations along the closed loop is a different quantity and needs a separate argument. With noise of unbounded support, such as Gaussian noise, no plan can stay feasible for every disturbance, so recursive feasibility does not follow from the shifted plan. Common remedies are to choose z0z_0 between the measured state and the last predicted nominal state, to impose the first step robustly for a bounded noise, or to soften the constraints. Stability holds in a mean-square or average sense, not for every path. Joint chance constraints over several rows or steps need either a split of ε\varepsilon by Boole's inequality or a harder, nonconvex formulation.

Classic examples

Scalar tightening. Take x+=x+u+wx^+ = x + u + w with ww Gaussian of standard deviation 0.10.1, the feedback K=−0.5K = -0.5 so that AK=0.5A_K = 0.5, and the chance constraint Pr⁡(xk≤1)≥0.95\Pr(x_k \le 1) \ge 0.95. Then Σk+1=0.25 Σk+0.01\Sigma_{k+1} = 0.25\, \Sigma_k + 0.01, Φ−1(0.95)=1.6449\Phi^{-1}(0.95) = 1.6449 and 19=4.3589\sqrt{19} = 4.3589:

step kk Σk\Sigma_k Gaussian tightening Cantelli tightening
1 0.01 0.1645 0.4359
2 0.0125 0.1839 0.4873
3 0.013125 0.1884 0.4994
∞\infty 0.013333 0.1899 0.5033

So in steady state the planned state may go up to 0.8100.810 with Gaussian noise, and up to 0.4970.497 when only the variance is known. For comparison, if the noise were bounded by ∣w∣≤0.3|w| \le 0.3, three standard deviations, the robust tube of tube MPC would need a margin of 0.3/(1−0.5)=0.60.3/(1 - 0.5) = 0.6.

The scenario approach. Instead of an analytic tightening, draw SS disturbance sequences and require the constraints for all of them. For a convex problem with dd decision variables, Campi and Garatti (2008) showed that the probability, over the draw of the samples, that the solution violates the constraint with a probability above ε\varepsilon is at most β\beta when

∑i=0d−1(Si)εi(1−ε)S−i≤β.\sum_{i=0}^{d-1} \binom{S}{i} \varepsilon^i (1 - \varepsilon)^{S - i} \le \beta.

For ε=0.05\varepsilon = 0.05 and β=10−6\beta = 10^{-6}, the smallest numbers of scenarios are:

dd 1 2 5 10 20
SS 270 326 459 643 962

For d=1d = 1 the condition is 0.95S≤10−60.95^S \le 10^{-6}. The count grows roughly linearly in dd and in 1/ε1/\varepsilon, and only with the logarithm of 1/β1/\beta. The method needs no knowledge of the distribution beyond the ability to sample it, but the online problem grows with SS.

Variations

  • Affine disturbance feedback. Optimize uk=vk+∑j<kMkjwju_k = v_k + \sum_{j<k} M_{kj} w_j instead of fixing KK. The problem stays convex and is less conservative.
  • Joint chance constraints. Ask that all constraints hold together with probability 1−ε1 - \varepsilon. Split ε\varepsilon among the rows by Boole's inequality, or use scenarios.
  • Bounded noise. With bounded support, combine robust constraints for the first step with chance constraints later, which gives recursive feasibility.
  • Nonlinear plants. Propagate means and covariances by linearization or by the unscented transform, or use polynomial chaos expansions.
  • Expected value of other costs. Use economic costs, or risk measures such as the conditional value at risk instead of the mean.
  • Output feedback. Use a Kalman filter estimate, and add the estimation error covariance to Σk\Sigma_k.

Pitfalls

  • Wrong distribution. The Gaussian tightening is exact only for Gaussian noise. With heavier tails, the violation rate can be higher than ε\varepsilon, more often for small ε\varepsilon. Use the Cantelli factor when unsure.
  • Unbounded noise and hard constraints. With Gaussian noise, any hard state constraint will be violated eventually, and a hard constraint in the QP can make it infeasible. Use soft constraints or a feasible fallback.
  • Confusing the two probabilities. The chance constraint is about the next prediction, not about the closed loop over time.
  • Many joint constraints. Splitting ε\varepsilon over many rows and steps makes each tightening large. Check how conservative the split is.
  • Too few scenarios. The scenario bound depends on the number of decision variables. For long horizons with many inputs, the number of samples and the online cost grow fast.

Exercises

  1. For e+=0.5e+we^+ = 0.5 e + w with Var(w)=0.01\mathrm{Var}(w) = 0.01, find the stationary variance. (Answer: Σ=0.25 Σ+0.01\Sigma = 0.25\, \Sigma + 0.01 gives Σ=0.01/0.75=0.013‾\Sigma = 0.01/0.75 = 0.01\overline{3}, with standard deviation 0.11550.1155.)
  2. Find the Gaussian tightening at step 1 in the scalar example. (Answer: Σ1=0.01\Sigma_1 = 0.01, so 1.6449×0.1=0.16451.6449 \times 0.1 = 0.1645.)
  3. Show that the expected cost of x=z+ex = z + e with E[e]=0\mathbb{E}[e] = 0 is zTQz+tr(QΣ)z^T Q z + \mathrm{tr}(Q \Sigma). (Answer: the cross term has expectation 2zTQ E[e]=02 z^T Q\, \mathbb{E}[e] = 0, and E[eTQe]=tr(Q E[eeT])\mathbb{E}[e^T Q e] = \mathrm{tr}(Q\, \mathbb{E}[e e^T]).)
  4. Find the number of scenarios for d=1d = 1, ε=0.05\varepsilon = 0.05 and β=10−6\beta = 10^{-6}. (Answer: 0.95S≤10−60.95^S \le 10^{-6} gives S≥ln⁡(10−6)/ln⁡(0.95)=269.3S \ge \ln(10^{-6})/\ln(0.95) = 269.3, so S=270S = 270.)
  5. Two rows must hold jointly with probability 0.950.95. Give a tightening factor for Gaussian noise. (Answer: by Boole's inequality, give each row ε=0.025\varepsilon = 0.025, so γ=Φ−1(0.975)=1.96\gamma = \Phi^{-1}(0.975) = 1.96 for each row.)

References

  1. Ali Mesbah, Stochastic model predictive control, an overview and perspectives for future research, IEEE Control Systems Magazine 36(6), 30-44, 2016, the overview of expected costs, chance constraints, analytic tightening, scenario methods and the open questions
  2. James B. Rawlings, David Q. Mayne and Moritz M. Diehl, Model Predictive Control, Theory, Computation, and Design, 2nd edition, Nob Hill Publishing, 2017, the chapter on robust and stochastic MPC

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • three classic examples