Optimization Problems in Model Predictive Control

Similar documents
NONLINEAR MODEL PREDICTIVE CONTROL VIA FEASIBILITY-PERTURBED SEQUENTIAL QUADRATIC PROGRAMMING

Interior-Point and Augmented Lagrangian Algorithms for Optimization and Control

Algorithms for Constrained Optimization

5 Handling Constraints

1. Introduction. We consider the general smooth constrained optimization problem:

MS&E 318 (CME 338) Large-Scale Numerical Optimization

Infeasibility Detection and an Inexact Active-Set Method for Large-Scale Nonlinear Optimization

1 Computing with constraints

Efficient Convex Optimization for Linear MPC

An Inexact Sequential Quadratic Optimization Method for Nonlinear Optimization

Outline. 1 Linear Quadratic Problem. 2 Constraints. 3 Dynamic Programming Solution. 4 The Infinite Horizon LQ Problem.

AM 205: lecture 19. Last time: Conditions for optimality Today: Newton s method for optimization, survey of optimization methods

Higher-Order Methods

Scientific Computing: An Introductory Survey

Scientific Computing: An Introductory Survey

Inexact Newton Methods and Nonlinear Constrained Optimization

MPC Infeasibility Handling

SF2822 Applied Nonlinear Optimization. Preparatory question. Lecture 9: Sequential quadratic programming. Anders Forsgren

EE C128 / ME C134 Feedback Control Systems


Theory in Model Predictive Control :" Constraint Satisfaction and Stability!

An Inexact Newton Method for Optimization

Nonlinear Model Predictive Control Tools (NMPC Tools)

PDE-Constrained and Nonsmooth Optimization

Outline. Scientific Computing: An Introductory Survey. Optimization. Optimization Problems. Examples: Optimization Problems

An Introduction to Algebraic Multigrid (AMG) Algorithms Derrick Cerwinsky and Craig C. Douglas 1/84

An Inexact Newton Method for Nonlinear Constrained Optimization

minimize x subject to (x 2)(x 4) u,

Newton s Method. Javier Peña Convex Optimization /36-725

What s New in Active-Set Methods for Nonlinear Optimization?

Constrained Nonlinear Optimization Algorithms

Lecture 11 and 12: Penalty methods and augmented Lagrangian methods for nonlinear programming

Numerical Methods for PDE-Constrained Optimization

MODIFYING SQP FOR DEGENERATE PROBLEMS

AM 205: lecture 19. Last time: Conditions for optimality, Newton s method for optimization Today: survey of optimization methods

Distributed and Real-time Predictive Control

Algorithms for constrained local optimization

A New Penalty-SQP Method

4TE3/6TE3. Algorithms for. Continuous Optimization

Newton s Method. Ryan Tibshirani Convex Optimization /36-725

Lecture 3. Optimization Problems and Iterative Algorithms

2.3 Linear Programming

Course on Model Predictive Control Part II Linear MPC design

Part 4: Active-set methods for linearly constrained optimization. Nick Gould (RAL)

Efficient Numerical Methods for Nonlinear MPC and Moving Horizon Estimation

Hot-Starting NLP Solvers

Numerisches Rechnen. (für Informatiker) M. Grepl P. Esser & G. Welper & L. Zhang. Institut für Geometrie und Praktische Mathematik RWTH Aachen

Written Examination

AN AUGMENTED LAGRANGIAN AFFINE SCALING METHOD FOR NONLINEAR PROGRAMMING

ALADIN An Algorithm for Distributed Non-Convex Optimization and Control

Application of Interior-Point Methods to Model Predictive Control1

Model Predictive Control Short Course Regulation

Constrained Optimization Theory

Penalty and Barrier Methods. So we again build on our unconstrained algorithms, but in a different way.

State Regulator. Advanced Control. design of controllers using pole placement and LQ design rules

Part 5: Penalty and augmented Lagrangian methods for equality constrained optimization. Nick Gould (RAL)

A Constraint-Reduced MPC Algorithm for Convex Quadratic Programming, with a Modified Active-Set Identification Scheme

CS 542G: Robustifying Newton, Constraints, Nonlinear Least Squares

Optimizing Economic Performance using Model Predictive Control

A GLOBALLY CONVERGENT STABILIZED SQP METHOD

A GLOBALLY CONVERGENT STABILIZED SQP METHOD: SUPERLINEAR CONVERGENCE

A Trust Funnel Algorithm for Nonconvex Equality Constrained Optimization with O(ɛ 3/2 ) Complexity

E5295/5B5749 Convex optimization with engineering applications. Lecture 8. Smooth convex unconstrained and equality-constrained minimization

A STABILIZED SQP METHOD: SUPERLINEAR CONVERGENCE

Nonlinear Optimization: What s important?

A Trust-region-based Sequential Quadratic Programming Algorithm

HPMPC - A new software package with efficient solvers for Model Predictive Control

Survey of NLP Algorithms. L. T. Biegler Chemical Engineering Department Carnegie Mellon University Pittsburgh, PA

Lecture 13: Constrained optimization

MATH4406 (Control Theory) Unit 6: The Linear Quadratic Regulator (LQR) and Model Predictive Control (MPC) Prepared by Yoni Nazarathy, Artem

Efficient robust optimization for robust control with constraints Paul Goulart, Eric Kerrigan and Danny Ralph

Prashant Mhaskar, Nael H. El-Farra & Panagiotis D. Christofides. Department of Chemical Engineering University of California, Los Angeles

Interior-Point Methods

Sequential Quadratic Programming Method for Nonlinear Second-Order Cone Programming Problems. Hirokazu KATO

On sequential optimality conditions for constrained optimization. José Mario Martínez martinez

INTERIOR-POINT METHODS FOR NONCONVEX NONLINEAR PROGRAMMING: CONVERGENCE ANALYSIS AND COMPUTATIONAL PERFORMANCE

Robotics. Control Theory. Marc Toussaint U Stuttgart

Constrained Optimization

Optimisation in Higher Dimensions

Subject: Optimal Control Assignment-1 (Related to Lecture notes 1-10)

Stability of Feedback Solutions for Infinite Horizon Noncooperative Differential Games

Introduction to Nonlinear Stochastic Programming

Real-time Constrained Nonlinear Optimization for Maximum Power Take-off of a Wave Energy Converter

Lecture 3: Lagrangian duality and algorithms for the Lagrangian dual problem

CE 191: Civil and Environmental Engineering Systems Analysis. LEC 05 : Optimality Conditions

Convex Optimization M2

Optimality Conditions for Constrained Optimization

Direct Methods. Moritz Diehl. Optimization in Engineering Center (OPTEC) and Electrical Engineering Department (ESAT) K.U.

OPER 627: Nonlinear Optimization Lecture 9: Trust-region methods

Lecture 18: Optimization Programming

Optimization. Escuela de Ingeniería Informática de Oviedo. (Dpto. de Matemáticas-UniOvi) Numerical Computation Optimization 1 / 30

Nonlinear Programming

Semidefinite Programming Duality and Linear Time-invariant Systems

IMPROVED MPC DESIGN BASED ON SATURATING CONTROL LAWS

Optimization Methods

More on Lagrange multipliers

A PRIMAL-DUAL TRUST REGION ALGORITHM FOR NONLINEAR OPTIMIZATION

Arc Search Algorithms

Outline. Linear regulation and state estimation (LQR and LQE) Linear differential equations. Discrete time linear difference equations

Constrained optimization: direct methods (cont.)

Transcription:

Optimization Problems in Model Predictive Control Stephen Wright Jim Rawlings, Matt Tenny, Gabriele Pannocchia University of Wisconsin-Madison FoCM 02 Minneapolis August 6, 2002 1

reminder! Send your new tech reports to http://www.optimization-online.org Tech report repository, sponsored by Math Programming Society. 2

themes Industrial control is a rich source of optimization problems (also uses tools from control theory, PDE, linear algebra). Foundations in Computational Mathematics! Real-time imperative makes efficient algorithms important. Describe a feasible trust-region SQP method that is simple, yet with good convergence properties particularly well suited to the nonlinear MPC problem. 3

outline introduction to optimal control, model predictive control (MPC) linear MPC: algorithms near-optimal solutions for infinite-horizon problems a feasible SQP method nonlinear MPC customizing the feasible SQP algorithm computational results 4

control: introduction Control problems consist of a dynamic process ( state equation, model ); and ways to influence evolution of that process ( controls or inputs ). An engineer may want to steer the process toward some desired state, or operating range, or avoid some undesirable states; transition between two states in an optimal way; optimize some function of the process state and controls, or minimize time needed to reach some specified goal. 5

industrial control examples oil refining and petrochemicals chemicals food processing mining furnaces pulp and paper 6

state equation x(t) = state at time t; u(t) = inputs at time t. May not be able to measure the state x, only some observation y = g(x). State equation describes process evolution: ẋ = F (x, u, t). May be naturally an ODE, or possibly derived from a parabolic PDE. (Also may be generalized to DAE.) Discretization in time leads to x k+1 = F k (x k, u k ), k = 0, 1, 2,.... The case of F (or F k ) linear is important: gives adequate performance in many cases, good algorithms and software available. 7

objective and constraints Objectives are often simple, e.g. convex quadratic: L(x, u) = 1 2 N 1 k=0 x T k Qx k + u T k Ru k + 1 2 xt N Qx N. (Q symmetric positive semidefinite; R, Π symmetric positive definite.) May have auxiliary constraints on states and controls. Examples: desired operating range: L x k U, k; actuator limits: h(u k ) 0, k; rate limits: r u k+1 u k r, k. Can make soft constraints by including quadratic penalty in the objective; or impose explicitly as hard constraints. 8

setpoints In industrial applications often have a setpoint x s describing the optimal steady state, with corresponding inputs u s. (x s, u s ) chosen to hit some target observation. Role of the controller is to steer the process to (x s, u s ) and keep it there, despite disturbances. Usually choose (x, u) to measure deviation from (x s, u s ). Often suffices to linearize the process dynamics around the setpoint, to obtain a linear, homogeneous model F : x k+1 = F (x k, u k ) = Ax k + Bu k. 9

open-loop (optimal) control Given current state x 0, choose a time horizon N (long), and solve the optimization problem for x = {x k } N k=0, u = {u k} N 1 k=0 : min L(x, u), subject to x 0 given, x k+1 = F k (x k, u k ), k = 0, 1,..., N 1, other constraints on x, u. Then apply controls u 0, u 1, u 2,.... flexible with respect to nonlinearity and constraints; if model F k is inaccurate, solution may be bad; doesn t account for system disturbances during time horizon; never used in industrial practice! 10

closed-loop (feedback) control Determine a control law K( ) such that u = K(x) is the optimal control setting to be applied when the current state is x. To control the process, simply measure the state x at each timepoint, calculate and apply u = K(x). for special cases (quadratic objective, linear state equation) K is a linear function, calculated by solving a Riccati equation; more robust with respect to model error; feedback: responds to disturbances; very difficult to find K when model nonlinear or has constraints; ad-hoc methods for handling constraints (e.g. clipping) not reliable. 11

model predictive control (MPC) Given current state x 0, time horizon N, solve the optimization problem: min L(x, u), subject to x 0 given, x k+1 = F k (x k, u k ), k = 0, 1,..., N 1, other constraints on x, u. Then apply control u 0. At next timepoint k = 1, estimate the state, and define a new N-stage problem starting at the current time (moving horizon). Repeat indefinitely. performs closed-loop control using open-loop techniques; retains advantages of each approach; use state/control profile at one timepoint as basis for a starting point at the next timepoint; requires problem to be solved quickly (between timepoints). 12

other issues in MPC State estimation: Given observations y k and inputs u k, estimate the states x k. Nominal stability: Assuming that the state equation is exact, can we steer the system to the desired state (usually x = 0) while respecting the constraints? Disturbance modeling: detecting and estimating disturbances and mismatches between model and actual process. 13

linear-quadratic regulator Simplest control problem is, for given x 0 : min x,u def Φ(x, u) = 2 1 k=0 x T k Qx k + u T k Ru k s.t. x k+1 = Ax k + Bu k. From KKT conditions, dependence of optimal values of x 1, x 2,... and u 0, u 1,... on initial x 0 is linear, so have for some s.p.d. matrix Π. Φ(x, u) = 1 2 xt 0 Πx 0 By using this dynamic programming principle, isolating the first stage, can write the problem as: min 1 x 1,u 0 2 (x T 0 Qx 0 + u T 0 Ru 0) + 1 2 xt 1 Πx 1 s.t. x 1 = Ax 0 + Bu 0. 14

By substituting for x 1, get unconstrained quadratic problem in u 0. Minimizer is so that u 0 = Kx 0, where K = (R + B T ΠB) 1 B T ΠA. By substituting for u 0 and x 1 in x 1 = Ax 0 + Bu 0 = (A + BK)x 0. 1 2 xt 0 Πx 0 = 1 2 (xt 0 Qx 0 + u T 0 Ru 0) + 1 2 xt 1 Πx 1, obtain the Riccati equation: Π = Q + A T ΠA A T Π T B(R + B T ΠB) 1 B T ΠA. There are well-known techniques to solve this equation for Π, hence K. Hence, we have a feedback control law u = Kx that is optimal for the LQR problem. 15

linear MPC More general linear-quadratic problem includes constraints: min 1 k=0 x,u 2 x T k Qx k + u T k Ru k, subject to x k+1 = Ax k + Bu k, k = 0, 1, 2,..., x k X, u k U, possibly also mixed constraints, and constraints on u k+1 u k. Assuming that 0 int(x), 0 int(u) and that the system is stabilizable, we expect that u k 0 and x k 0 as k. Therefore, for large enough k, the non-model constraints become inactive. 16

Hence, for N large enough, the problem is equivalent to the following (finite) problem: min x,u 1 2 N 1 k=0 xt k Qx k + u T k Ru k + 1 2 xt N Πx N, subject to x k+1 = Ax k + Bu k, k = 0, 1, 2,..., N 1 x k X, u k U, k = 0, 1, 2,..., N 1, where Π is the solution of the Riccati equation. In the tail of the sequence (k > N) simply apply the unconstrained control law. (Rawlings, Muske, Scokaert,...) When constraints are linear, it remains to solve a (finite) convex, structured quadratic program. 17

details: interior-point method (Rao, Wright, Rawlings). Solve min u,x,ɛ N 1 k=0 subject to 1 2 (xt k Qx k + u T k Ru k + 2x T k Mu k + ɛ T k Zɛ k) + z T ɛ k + x T N Πx N, x 0 = ˆx j, (fixed) x k+1 = Ax k + Bu k, k = 0, 1,..., N 1, Du k Gx k d, k = 0, 1,..., N 1, Hx k ɛ k h, k = 1, 2,..., N, ɛ k 0, k = 1, 2,..., N, F x N = 0. 18

Introduce dual variables, use stagewise ordering. Primal-dual interior-point method yields a block-banded system at each iteration:... Q M G T A T M T R D T B T G D Σ D k A B I Σ ɛ k+1 I Σ H k+1 I H I I Z I H T Q... where Σ D k, Σɛ k+1, etc are diagonal.. x k u k λ k p k+1 ξ k+1 η k+1 ɛ k+1 x k+1. =. r x k r u k r λ k r p k+1 r ξ k+1 r η k+1 r ɛ k+1 r x k+1. 19

By performing block elimination, get reduced system R 0 B B T I I Q 1 M 1 A T M1 T R 1 B T A B I I Q 2 M 2 A T M2 T R 2 B T A B......... Q N F T F u 0 p 0 x 1 u 1 p 1 x 2 u 2. x N β which has the same structure as the KKT system of a problem without side constraints (soft or hard). = r u 0 r p 0 r x 1 r u 1 r p 1 r x 2 r u 2. r x N r β, 20

Can solve by applying a banded linear solver: O(N) operations. Alternatively, seek matrices Π k and vectors π k such that the following relationship is satisfied between p k 1 and x k : p k 1 + Π k x k = π k, k = N, N 1,..., 1. By substituting in the linear system, find a recurrence relation: Π N = Q N, π N = r x N, Π k 1 = Q k 1 + A T Π k A (A T Π k B + M k 1 )(R k 1 + B T Π k B) 1 (B T Π k A + Mk 1 T ), π k 1 = r x k 1 + AT Π k r p k 1 + AT π k (A T Π k B + M k 1 )(R k 1 + B T Π k B) 1 ( r u k 1 + BT Π k r p k 1 + BT π k ). The recurrence for Π k is the discrete time-varying Riccati equation! 21

choosing the horizon N If (x, u) = (0, 0) is in the relative interior of the constraint set, can find N large enough to make the finite-horizon problem equivalent to infinitehorizon problem: e.g. successive doubling of N. However if (0, 0) is feasible but not in the relative interior, there may be no N with this property. This case arises often e.g. it may be reasonable to have an input valve fully open at some timepoints. How can we choose N so that the finite-horizon problem (and its solution) approximates the corresponding infinite-horizon problem to a specified level of accuracy? 22

problem formulation O : min {xk,u k } 1 k=0 k=0 2 x T k Qx k + u T k Ru k, subject to x 0 = given, x k+1 = Ax k + Bu k, k = 0, 1, 2,..., Du k d, k = 0, 1, 2,..., Ex k e, k = 0, 1, 2,.... Since (x, u) = (0, 0) is feasible, we must have d 0, e 0. We assume in fact that e > 0, since otherwise arbitrarily small disturbances render the problem infeasible. Seek upper and lower bounding problems with finitely many variables. 23

upper bounding problem Denote by D the row submatrix of D corresponding to right-hand side components of zero. For the problem U(N) : min {xk,u k } 1 k=0 k=0 2 x T k Qx k + u T k Ru k, subject to x 0 = given, x k+1 = Ax k + Bu k, k = 0, 1, 2,..., Du k d, k = 0, 1, 2,..., Ex k e, k = 0, 1, 2,..., Du k = 0, k = N, N + 1,..., we have under the usual assumptions that the constraints other than D are strictly satisfied for all N sufficiently large. 24

By a change of variables in u k (to the null space of D, can solve Riccati equation to find a cost-to-go matrix Π such that x T N Πx N = k=n x T k Qx k + u T k Ru k, subject to x k+1 = Ax k + Bu k, Du k = 0, k = N, N + 1,..., for any x N. Hence, can rewrite U(N) as U(N) : min {xk,u k } 1 N 1 k=0 2 k=0 (xt k Qx k + u T k Ru k) + 1 2 xt N Πx N, s. t. x 0 = given, x k+1 = Ax k + Bu k, k = 0, 1, 2,..., N 1 For N sufficiently large, we have Du k d, k = 0, 1,..., N 1 Ex k e, k = 0, 1,..., N. Φ U (N) Φ. 25

lower bounding problem Enforce side constraints only over a finite horizon: L(N) : min {xk,u k } 1 k=0 k=0 2 x T k Qx k + u T k Ru k, subject to x 0 = given, x k+1 = Ax k + Bu k, k = 0, 1, 2,..., Du k d, k = 0, 1, 2,..., N 1 Ex k e, k = 0, 1, 2,..., N. Hence, can compute the usual cost-to-go matrix Π, and obtain the following finite formulation: L(N) : min {xk,u k } 1 k=0 k=0 2 (x T k Qx k + u T k Ru k) + 1 2 xt N Πx N, s.t. x 0 = given, x k+1 = Ax k + Bu k, k = 0, 1,..., N 1 Du k d, k = 0, 1,..., N 1 Ex k e, k = 0, 1,..., N. 26

analysis For all N sufficiently large, we have Φ L (N) Φ Φ U (N). By working in the right space (l 2 ), we have that Φ L (N) Φ, Φ U (N) Φ, and that the solutions of the lower-bounding and upper-bounding problems also converge to the solution of the true problem, in the l 2 norm. By choosing N large enough, can obtain a setting u 0 (from the upperbounding problem) that produces an objective within a guaranteed level of optimality (measured by Φ U (N) Φ L (N)). 27

nonlinear MPC: introduction min N 1 x,u k=0 {C(x k, u k ) + Ξ(η k )} + x T N P x N + Ξ(η N ), subject to x 0 given, x k+1 = F k (x k, u k ), Du k d, η k = max(gx k g, 0), where Ξ is a convex quadratic (soft constraints). Why use a nonlinear model? most applications have nonlinear dynamics: nonlinear rate laws, temperature dependence of rate constants, vapor/liquid therodynamic equilibrium; measured properties (hence objective terms) may be nonlinear functions of the state; a linear approximation may give seriously suboptimal control. 28

nonlinear MPC is a structured nonlinear program, possibly with local optima; not used much in practice, partly due to lack of reliable algorithms and software, but use is growing (in chemicals, air and gas, polymers) structured SQP methods, dynamic programming (Newton-like) approaches, gradient projection, and recently interior-point methods have all been tried, often in the context of open-loop optimal control. because of the MPC context, a good starting point often is available, though not after an upset. Our experience shows that there is considerable advantage to retaining feasibility. This leads us to consider a method of the feasible SQP type. 29

feasible trust-region SQP method min f(z) subject to c(z) = 0, d(z) 0, where z R n, f : R n R, c : R n R m, and d : R n R r are smooth (twice cts diff) functions. Denote feasible set by F. From a feasible point z, obtain step z by solving trust-region SQP subproblem: min z m( z) def = f(z) T z + 1 2 zt H z subject to c(z) + c(z) T z = 0, d(z) + d(z) T z 0, D z p for some Hessian approximation H, scaling matrix D, trust-region radius, and p = 1, 2, or. Subproblem is always feasible! 30

feasibility perturbation In general z + z / F, except for important special case: linear constraints. Find a perturbed step z such that feasibility: z + z F; asymptotic exactness: z z φ( z ) z, where φ : R + R + continuous, monotonically increasing with φ(0) = 0. If z with these properties cannot be found, decrease and recalculate. 31

FP-SQP outline Decide whether or not to take step using actual/predicted decrease ratio ρ k defined by i.e. use f itself as the merit function. ρ k = f(zk ) f(z k + z k ) m k ( z k, ) Other aspects of the algorithm are identical to standard trust-region approach. 32

Given starting point z 0, trust-region upper bound 1, initial radius 0 (0, ], η [0, 1/4), and p [1, ]; for k = 0, 1, 2, end (for). Obtain z k, seek z k with desired properties; k if no such z is found; k+1 (1/2) D k z k p ; z k+1 z k ; else Calculate ρ k ; if ρ k < 1/4 k+1 (1/2) D k z k p ; else if ρ k > 3/4 and D k z k p = k k+1 min(2 k, ); else k+1 k ; if ρ k > η else z k+1 z k + z k ; z k+1 z k ; 33

assumptions for global convergence 1. For z satisfying the linearized constraints, have for some δ (0, 1) and all scaling matrices D that δ 1 z 2 D z p δ z 2. 2. Bounded feasible level set, and f, c, d, smooth on an open ndb of this set. 3. Given any ẑ in the level set, then for all z in some nbd of ẑ, we have min v F v z ζ ( c(z) + [d(z)] + ), for some constant ζ (Hoffmann property). Can show (following Robinson) that (3) holds when MFCQ is satisfied at ẑ. 34

well definedness Given assumptions 1, 2, 3, there is def such that for any z in the level set, a perturbed step z with the desired properties can be found whenever def. 35

global convergence: technical results MFCQ assumption at feasible z: c(z) has full column rank, and there is v such that c(z) T v = 0 and v T d i (z) < 0 for all active i. Key role is played by the following linear subproblem: CLP(z, τ): min w f(z) T w subject to c(z) + c(z) T w = 0, d(z) + d(z) T w 0, w T w τ 2. Analogous to Cauchy point in analysis of TR algorithms for unconstrained optimization. Can relate m( z) to the optimal value of CLP(z, δ 1 ). Can show that optimal value of CLP(z, τ) is zero iff z is stationary, and for z in the neighborhood of a nonstationary point, optimal value of CLP(z, τ) is bounded away from 0. 36

global convergence Result I: If Assumptions 1, 2, 3 hold, and all limit points satisfy MFCQ, and approximate Hessians satisfy H k σ 0 + σ 1 k. (Quasi-Newton Hessians often have this property.) Then at least one of the limit points is stationary. Result II: If Assumptions 1, 2, 3 hold, and the approximate Hessians satisfy H k σ, then there cannot be a limit point at which MFCQ holds but the KKT conditions do not. In other words, all limit points either are stationary or fail to satisfy MFCQ. 37

local convergence: assumptions Suppose that z k z, where z satisfies linear independence constraint qualification, strict complementarity, second-order sufficient conditions. Also make additional assumptions on the algorithm: Have an estimate W k of the active set, such that W k = A for all k sufficiently large, where A = {i = 1, 2,..., r d i (z ) = 0}. Have Lagrange multiplier estimates µ k (for equality constraints) and λ k (for inequality constraints) such that (µ k, λ k ) (µ, λ ) Perturbed step satisfies: z z = O( z 2 ), d i (z k + z k ) = d i (z k ) + d i (z k ) T z k, i W k. 38

discussion Given good estimates (µ k, λ k ), can find a good W k. Given good W k, can use least-squares estimation to find (µ k, λ k ). Finding both (µ k, λ k ) and W k simultaneously is trickier, but a practical scheme that alternates estimates of these two quantities would probably not be difficult to devise. The condition on d i, i W k represents an explicit second-order correction. Can show that a projection technique produces z satisfying (3), provided the other assumptions hold. 39

local convergence result Assume that H k is Hessian of the Lagrangian: H k = 2 zzl(z k, µ k, λ k ) that 2-norm trust region is used, and that the assumptions above hold. Then we have ρ k 1, and {z k } converges Q-quadratically to z. 40

Applying FP-SQP to nonlinear MPC (Tenny, Wright, Rawlings) min x,u N 1 k=0 {C(x k, u k ) + Ξ(η k )} + x T N Πx N + Ξ(η N ), subject to x 0 given, x k+1 = F k (x k, u k ), Du k d, η k = max(gx k g, 0). Issues in applying FP-SQP to this problem: feasibility perturbation (stabilized) trust-region scaling approximate Hessians in the SQP subproblem 41

SQP subproblem for nonlinear MPC subject to N 1 k=1 { 1 2 min x, u, η 1 2 ut R 0 0 u 0 + r0 T u 0 + (1) [ ] [ ] [ ] [ ] T [ xk Q k M ]} k xk qk xk u k M k T + R k u k r k u k + 1 2 xt N Q N x N + q T N x N + N k=1 Ξ(η k + η k ) x 0 = 0, (2a) x k+1 = A k x k + B k u k, k = 0, 1,..., N 1, (2b) D(u k + u k ) d, k = 0, 1,..., N 1, (2c) G(x k + x k ) (η k + η k ) g, k = 1, 2,..., N, (2d) η k + η k 0, k = 1, 2,..., N, (2e) Σ k u k, k = 0, 1,..., N 1. (2f) Trust region is applied only to the u components (since x and η are defined in terms of u). 42

feasibility perturbation Naive approach: Set u = u, then recover x and η from x k+1 + x k+1 = F (x k + x k, u k + u k ), k = 0, 1,..., N 1, η k + η k = max ( G(x k + x k ) g, 0 ), k = 1, 2,..., N. Often works fine. However on problems that are open-loop unstable (i.e. increasing modes in the model equation at the setpoint), it results in divergence of x k x k as k increases. Introduce a stabilizing change of variables based on a feedback gain matrix K k, k = 1, 2,..., N 1. Set u 0 = u 0, then set remaining u k and x k to satisfy: x k+1 = F (x k + x k, u k + u k ) x k, k = 0, 1,..., N 1, u k = u k + K k ( x k x k ), k = 1, 2,..., N 1. 43

Choose K k such that eig(a k + B k K k ) 1. pole placement; solve the LQR problem based on (A k, B k ) separately for each k; solve the time-varying LQR problem to get a set of K k s. Results in a discrete Riccati equation, like the one encountered earlier in discussion of linear MPC: for k = N 1, N 2,..., 1: K k = ( R k + B T k Π k+1 B k ) 1 ( M T k + B T k Π k+1 A k ) Π k = Q k + K T k R k K k + M k K k + K T k M T k + (A k + B k K k ) T Π k+1 (A k + B k K k ). 44

clipping; asymptotic exactness If state constraints present, solve for u k : min ( u k u k ) T R k ( u k u k ) subject to D(u k + u k ) d, u k and replace u k u k. Using implicit function theorem, can show that asymptotic exactness holds. The matrices K k have the effect of improving the condition number in the Jacobian of the parametrized linear system to be solved for ( u, x). 45

trust-region scaling In unconstrained trust-region algorithms, have subproblem min z f(z)t z + 1 2 zt H z, subject to D z 2, whose solution is (H + ξd T D) z = f(z), for some ξ 0. Often choose D diagonal, with D ii = H ii, i = 1, 2,..., n. Look for a corresponding strategy here. 46

By eliminating x and η components from the subproblem (using linear constraints), get subproblem objective of the form where 1 2 ut ˆQ u + ˆr T u, u = ( u 0, u 1,..., u N 1 ) Thus, it makes sense to define the scaling matrices Σ k in the trust-region constraint Σ k u k in terms of the diagonal blocks of ˆQ. Can show that ˆQ kk can be obtained as follows: Define G N = Q N, then Then have G k 1 = Q k 1 + A T k 1 G ka k 1, k = N, N 1,..., 2. ˆQ kk = R k 1 + B T k 1 G kb k 1, k = 1, 2,..., N. 47

Hessian approximation in the QP subproblem Recall that the Hessian is block diagonal: N 1 k=1 { 1 2 [ xk 1 2 ut R 0 0 u 0 + r0 T u 0 + ] [ ] xk + u k ] [ Q k M k u k M k T R k [ qk r k ] T [ xk u k ]} + 1 2 xt N Q N x N + q T N x N + N k=1 Ξ(η k + η k ) Hence, consider block-diagonal approximations: finite-difference approx to exact Lagrangian Hessian; partitioned quasi-newton approximations; Hessian of the objective (i.e. ignore curvature of the constraints). 48

partitioned quasi-newton (Griewank-Toint 1982, Bock-Plitt 1984). Lagrangian can be separated as N 1 L(x, u, λ, µ) = L 0 (u 0, λ 0, µ 0 )+ L k (x k, u k, λ k 1, λ k, µ k )+L N (x N, λ N 1 ), k=1 where L k (x k, u k, λ k 1, λ k, µ k ) = C(x k, u k )+λ T k F (x k, u k ) λ T k 1 x k+µ T k (Du k d), (ignoring state constraints). Exact kth block is [ Q k M k R k M T k ] = 2 L k x 2 k 2 L k u k x k ( 2 ) T L k u k x k 2 L k u 2 k. 49

Quasi-Newton update for this block is based on step vector s k and gradient change vector y k defined as follows: y k = = [ [ s k = [ x + k u + k x k u k x k L k (x + k, u+ k, λ k 1, λ k, µ k ) x k L k (x k, u k, λ k 1, λ k, µ k ) u k L k (x + k, u+ k, λ k 1, λ k, µ k ) u k L k (x k, u k, λ k 1, λ k, µ k ) x k C(x + k, u+ k ) x k C(x k, u k ) + (A k (x + k, u+ k ) A k(x k, u k )) T λ k u k C(x + k, u+ k ) u k C(x k, u k ) + (B k (x + k, u+ k ) B k(x k, u k )) T λ k Use both BFGS (modified using Powell s method to retain positive definiteness) and SR1. If the latter, convexify the resulting matrix to allow the convex QP solver to be called. ], ] ], 50

test problems 1. continuously stirred-tank reactor, involving an exothermic reaction, cooled via heat-exchange coil. 2 states, 1 control, N = 60. Open-loop unstable. 2. Mass spring damper. 2 states, 1 control, N = 100. 3. CSTR with 4 states, 2 controls, N = 30. 4. Pendulum on a cart. 2 states, 1 input (velocity of cart), N = 30. 5. copolymerization reaction / separation. 15 states, 3 inputs, N = 20. 51

codes FP-SQP: implemented in Octave; LSODE integrates between timepoints; DDASAC to calculate sensitivities (gradients). NPSOL quasi-newton; dense Hessian approx and linear algebra; variants NPSOLu (eliminate x and η); NPSOLz ( simultaneous ). Run on 1.2 GHz PC running Debian Linux. 52

400 380 360 Coolant Temperature, K 340 320 300 280 20334.62 573828.8 260 242413.6 240 220 0 0.5 1 1.5 2 2.5 3 Time, min Local solutions for Example 1. Note saturation in the two local minima. 53

352 351 Naïve perturbation Reactor Temperature, K 350 349 348 347 Stabilized perturbation Initial guess 346 QP solution 345 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1 Concentration of A, M effect of stabilization in feasibility perturbation: Example 1. 54

Method Ex. 1 Ex. 2 Ex. 3 Ex. 4 Ex. 5 Finite-Difference 4 13 4 5 3 Hessian 18.3 247. 39.2 78.6 197. Objective Hessian 9 10 7 8 5 11.7 50.8 7.04 26.5 20.3 Partitioned BFGS 6 FAIL 8 8 4 8.37 9.92 26.7 16.5 Sparsified BFGS 7 10 7 8 4 10.1 52.6 7.45 27.2 17.2 Paritioned SR1 6 12 7 11 4 8.07 60.8 8.86 36.6 16.1 NPSOLu FAIL 50 3 12 FAIL 2280. 16.3 128. NPSOLz 23 >100 4 16 FAIL 6780. 163000. 4870. 7840. 55

comments on results runtimes not reliable: FP-SQP in Octave (interpreted); NPSOL doesn t use structure; sensitivity estimates expensive (affects finite-difference version) NPSOLu fails on Ex. 1, because of unstable elimination. Stabilized perturbation works well. Hessian-of-Objective and quasi-newton strategies work well in general; hybrid method looks suitable. large number of NPSOL iterations suggests that we gain something from retaining feasibility. 56