Real-Time Online Model Predictive Control!
Total Page:16
File Type:pdf, Size:1020Kb
Real-time online Model Predictive Control! Colin Jones, Melanie Zeilinger, Stefan Richter! Automatic Control Laboratory, EPFL! Real-time synthesis : Complexity as a specification! MPC problem! Computational" Embedded" Real" method! Processor! time!! N 1 − J (x0) = min VN (xN )+ l(xi,ui) ui i=0 s.t. xi+1 = f(xi,ui) (x ,u ) i i ∈ X × U x N ∈ XN • Hardware platform bounds computation time and storage! • Current real-time explicit methods are limited to small problem dimensions! ! Online MPC can be applied to all problem dimensions ! ! This talk: Real-time online MPC for high-speed large-scale systems! ! Fast online optimization! ! Satisfaction of real-time constraint! ! !"#$%!#&'('$)#*$+( +!,$*!#$*- Fast online optimization! Many methods available:! ! CVX! CVXMOD! CVXGEN! ! Matlab Software for Convex optimization Code Generation for Disciplined Convex software in Python! Convex Optimization ! Programming! http://cvxmod.net/! http://cvxgen.net/! qpOases! http://cvxr.com/cvx/! Online Active Set Strategy! ! ! ! http://www.kuleuven.be/ ! optec/software/qpOASES! ! OOQP! Object-oriented software ! for quadratic programming! QPSchur! http://pages.cs.wisc.edu/ A dual, active-set, Schur-complement ! ~swright/ooqp/! method for large-scale and structured convex quadratic programming! …many more! ! [Bartlett et al., ‘06]! ! ! Online optimization can be applied to control high-speed systems! No guarantees on system theoretic properties when applied to MPC in a real-time setting. ! !"#$%!#&'('$)#*$+( +!,$*!#$*- Example: " Effect of limited computation time! Unstable example! Closed loop trajectory: 1.21 1 x + = + Optimal control law ! 01 0.5 2 x 5, 5 x 1 | 1| ≤ − ≤ 2 ≤ u 1,N =5,Q= I,R =1 1.5 | | ≤ -4 1 x 10 2 x 0.5 3 0 2 -0.5 1 -4 -3 -2 -1 0 0 5 10 15 20 25 Computation time[s] x 1 Time Step Closed loop trajectory:! Optimization stopped after 4 iterations! = max computation time of 21ms ! Limited computation time ! No stability properties! !"#$%!#&'('$)#*$+( +!,$*!#$*- Real-time online MPC: Goals! Real-time online MPC:! Guarantee that! • within the real-time constraint ! • a feasible solution! NOTE: Optimality not required! • satisfying stability and performance criteria! • for any admissible initial state ! is found. ! ! We present two methods for linear systems:! Setting! ! Linear state and input ‘Simple’ input constraints! constraints! (e.g. box constraints)! Time scale! Milliseconds! Microseconds! Idea! Provide guarantees for any time Compute a priori bounds on the constraint ! required online computation time ! Approach! Robust MPC with stability Fast gradient method ! constraints! ! [M.N. Zeilinger et al., CDC 2009]! [S. Richter et al., CDC 2009]! !"#$%!#&'('$)#*$+( +!,$*!#$*- Real-time online MPC: Goals! Real-time online MPC:! Guarantee that! • within the real-time constraint ! • a feasible solution! NOTE: Optimality not required! • satisfying stability and performance criteria! • for any admissible initial state ! is found. ! ! We present two methods for linear systems:! Setting! ! Linear state and input ‘Simple’ input constraints! constraints! (e.g. box constraints)! Time scale! Milliseconds! Microseconds! Idea! Provide guarantees for any time Compute a priori bounds on the constraint ! required online computation time ! Approach! Robust MPC with stability Fast gradient method ! constraints! ! [M.N. Zeilinger et al., CDC 2009]! [S. Richter et al., CDC 2009]! !"#$%!#&'('$)#*$+( +!,$*!#$*- Example: " Stability under proposed real-time method! Unstable example! Closed loop trajectory: 1.21 1 x + = + Optimal control law ! 01 0.5 Proposed real-time 2 MPC method" x 5, 5 x 1 | 1| ≤ − ≤ 2 ≤ stopped after 4 1.5 u 1,N =5,Q= I,R =1 online iterations! | | ≤ -4 1 x 10 2 x 0.5 3 time[s] 0 2 -0.5 1 -4 -3 -2 -1 0 0 5 10 15 20 25 Computation x 1 Time Step Closed loop trajectory:! Optimization stopped after 4 iterations! = max computation time of 21ms ! Real-time robust MPC : Nearly optimal and satisfies time constraints! !"#$%!#&'('$)#*$+( +!,$*!#$*- Optimal MPC scheme! Optimal ! solution! Warm-start! Online optimization! Common warm-start: Shifted sequence! u (x)=[u0, ... , uN-1] ushift (x)=[u1, ... , uN-1, KxN] !"#$%!#&'('$)#*$+( +!,$*!#$*- Optimal MPC scheme! Optimal ! solution! Warm-start! Online optimization! Optimal MPC:! • Recursively feasible! • Stabilizing! • Unknown computation time…! !"#$%!#&'('$)#*$+( +!,$*!#$*- Real-time MPC scheme – General idea! Suboptimal ! solution! ! Properties?! Warm-start! Online optimization! + Early termination! General approach for real-time MPC:! • Use of warm-start method ! • Exploitation of structure inherent in MPC problems ! • Early termination of the online optimization ! ![Wang & Boyd 2008; Ferreau et al., 2008; Schofield, 2008; Cannon et al., 2007; .. Many more]! !"#$%!#&'('$)#*$+( +!,$*!#$*- Real-time MPC scheme - Current methods! Suboptimal ! solution! ! Properties?! Warm-start! Online optimization! + Early termination! Suboptimal solution during online optimization steps! - can be infeasible ! - can destabilize the system ! - can cause steady-state offset! !"#$%!#&'('$)#*$+( +!,$*!#$*- Problem definition! MPC problem:! N 1 − T T T J∗(x) = min VN (x,u) xi Qxi + ui Rui + xN PxN x,u i=0 Z[ xi+1 = Axi + Bui Cxi + Dui b ≤ Assumption: is a polytope, xN f Xf !! ∈ X but approach can be equivalently ! x0 = x applied to ellipsoidal constraints. ! ! ! Parametric Quadratic Program ! ! ! !! !"#$%!#&'('$)#*$+( +!,$*!#$*- Two QP formulations! T T T T T T T T Vectorized notation: x =[! x0 ,x1!!,...,xN ] ,! u =[u0 ,u1 ,...,uN 1] − Formulation 1:! • The predicted states can be expressed as ! x = x + u A B • The MPC problem can be written using only the optimization variable u :! T min u Hd u u Matrices are dense! Z[ G u f + E x d ≤ d d Formulation 2:! • Optimize over sequence of states and inputs z! =[xT , u! T ] T :! • Introduce equality constraints relating the states and inputs: ! min z T Hz z Z[ Gz f Matrices are sparse ! ≤ Fz = Ex !"#$%!#&'('$)#*$+( +!,$*!#$*- Problem definition! MPC problem:! N 1 − T T T J∗(x) = min VN (x,u) xi Qxi + ui Rui + xN PxN x,u i=0 Z[ xi+1 = Axi + Bui Cxi + Dui b ≤ Assumption: is a polytope, xN f Xf !! ∈ X but approach can be equivalently ! x0 = x applied to ellipsoidal constraints. ! ! ! Parametric Quadratic Program: ! ! ! ! ! T J∗(x) = min z Hz z Z[ Gz d ≤ Fz = Ex !"#$%!#&'('$)#*$+( +!,$*!#$*- Current real-time MPC methods " - Loss of feasibility! In practice: System will be subject to disturbances! ! Consider uncertain system: x+=Ax+Bu+w where! is a bounded disturbance. ! w !W ! Problem: Disturbances cause loss of ! ! ! feasibility of the warm-start ! ! ! solution! ! ! ! Recovery of feasibility not ! ! ! guaranteed in real-time !! ! !"#$%!#&'('$)#*$+( +!,$*!#$*- Current real-time MPC methods " - Loss of stability! Requirement for stability: Lyapunov function! ! Use of MPC cost as Lyapunov function! ! MPC cost has to decrease at every time step:!VN (x,u(x)) <VN (xWYL], u(xWYL])) ! In a real-time approach this condition can be violated even when initializing with the shifted sequence! ! Interior-point methods:! • Efficient optimization method for a wide range of optimization problems! ! ! ! ! ! ! ! ! !"#$%!#&'('$)#*$+( +!,$*!#$*- Background: Primal barrier interior-point method! Optimization problem: ! min z!!!T Hz ! z Note: here QP, but general Z[ Gz d nonlinear program possible! ≤ Fz = Ex !"#$%!#&'('$)#*$+( +!,$*!#$*- Background: Primal barrier interior-point method! Optimization problem:! min z T Hz z ! Z[ Gz d ! ≤ Fz = Ex ! m T Barrier method: !! min z Hz µ log( Gi z + di ) barrier term! z − − i=1 with barrier ! Z[ Fz = Ex parameter ! ! ">0 ! 10 – Equality constrained problem! – Approximation improves as ! 5 ↘! " # 0 " ! 0 ! Gi z = di − 5 − 3 − 2 − 1 0 1 G z d i − i [Boyd & Vandenberghe, 2004]! !"#$%!#&'('$)#*$+( +!,$*!#$*- Background: Primal barrier interior-point method! Optimization problem:! min z T Hz z ! Z[ Gz d ! ≤ Fz = Ex ! m T Barrier method: !! min z Hz µ log( Gi z + di ) barrier term! z − − i=1 with barrier ! Z[ Fz = Ex parameter ! ! ">0 ! – Solve augmented problem for decreasing values of ! " ! (central path)! z*(") – Convergence to the optimal solution of the! original optimization problem for ! " # 0 ! z*(10) ! z* [Boyd & Vandenberghe, 2004]! !"#$%!#&'('$)#*$+( +!,$*!#$*- Current real-time MPC methods " - Loss of stability! Requirement for stability: Lyapunov function! ! Use of MPC cost as Lyapunov function! ! MPC cost has to decrease at every time step:!VN (x,u) <VN (xWYL], uWYL]) ! In a real-time approach this condition can be violated even when initializing with the shifted sequence! ! Interior-point methods:! • Efficient optimization method for a wide range of optimization problems! • Minimize augmented cost ! m ! T min z Hz µ log( Gi z + di ) z ! − − * i=1 * z (10) z ! Z[ Fz = Ex ! ! Decrease in cost does not enforce a decrease in MPC cost zTHz ! Steady-state offset for ! " 0 ! !"#$%!#&'('$)#*$+( ! +!,$*!#$*- Proposed real-time MPC method! Real-time online MPC:! Guarantee that! • within the real-time constraint !! • a feasible solution! !!!! ! • satisfying stability criteria ! !!! • for any admissible initial state !! is found. ! ! !"#$%!#&'('$)#*$+( +!,$*!#$*- Proposed real-time MPC method! Real-time online MPC:! Guarantee that! • within the real-time constraint ! !! Early termination! • a feasible solution! !!!!! Robust MPC ! • satisfying stability criteria ! !!! • for any admissible initial state !! is found. ! ! • Robust MPC method provides feasibility of the warm-start solution by considering all possible disturbance sequences! ! • Use of primal