fast model predictive control for magnetic plasma control mpc … · 2016. 2. 29. · for magnetic...
TRANSCRIPT
Fast Model Predictive Control for Magnetic Plasma Control MPC using fast online 1st-order QP methods
Matija Perne Jožef Stefan Institute
AWP15-ENR-01/JSI-02
Linear dynamic system, optimum
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 2
● Discrete-time model:
Linear dynamic system, optimum
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 3
● Discrete-time model:
Linear dynamic system, optimum
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 4
● Discrete-time model:
● Cost minimization:
Linear dynamic system, optimum
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 5
● Discrete-time model:
● Cost minimization:
● Constraints:
Linear dynamic system, optimum
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 6
● Discrete-time model:
● Cost minimization:
● Constraints:
Planning the future
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 7
Planning the future
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 8
Planning the future
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 9
Quadratic program
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 10
Quadratic program
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 11
Hessian
Quadratic program
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 12
HessianGradient
Quadratic program
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 13
Hessian
Affine setGradient
Quadratic program
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 14
Hessian
Affine set
Polyhedron
Gradient
Quadratic program
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 15
Hessian
Affine set
Polyhedron
Gradient
Dual method
Solving the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 16
Solving the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 17
● Explicit MPC: solving the problem in advance
Solving the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 18
● Explicit MPC: solving the problem in advance
– Solution piecewise linear
Solving the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 19
● Explicit MPC: solving the problem in advance
– Solution piecewise linear
(http://www.seas.upenn.edu/~ese680/papers/explicit_linear_mpc.pdf)
Solving the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 20
● Explicit MPC: solving the problem in advance
– Solution piecewise linear
– Active and inactive constraints:
(http://www.seas.upenn.edu/~ese680/papers/explicit_linear_mpc.pdf)
Solving the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 21
● Explicit MPC: solving the problem in advance
– Solution piecewise linear
– Active and inactive constraints:
(http://www.seas.upenn.edu/~ese680/papers/explicit_linear_mpc.pdf)
Solving the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 22
● Explicit MPC: solving the problem in advance
– Solution piecewise linear
– Active and inactive constraints:
(http://www.seas.upenn.edu/~ese680/papers/explicit_linear_mpc.pdf)
Solving the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 23
● Explicit MPC: solving the problem in advance
– Solution piecewise linear
– Active and inactive constraints:
● Active set methods
Solving the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 24
● Explicit MPC: solving the problem in advance
– Solution piecewise linear
– Active and inactive constraints:
● Active set methods
– Online search for active constraints
Solving the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 25
● Explicit MPC: solving the problem in advance
– Solution piecewise linear
– Active and inactive constraints:
● Active set methods
– Online search for active constraints
– Iterative
Solving the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 26
• Interior point methods
Solving the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 27
• Interior point methods– Cost is modified with a steep smooth function
close to polyhedral constraints
Solving the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 28
• Interior point methods– Cost is modified with a steep smooth function
close to polyhedral constraints
– Modified problem solved with unconstrained optimization method
Solving the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 29
• Interior point methods– Cost is modified with a steep smooth function
close to polyhedral constraints
– Modified problem solved with unconstrained optimization method
– Modification decreased iteratively
Solving the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 30
• Interior point methods– Cost is modified with a steep smooth function
close to polyhedral constraints
– Modified problem solved with unconstrained optimization method
– Modification decreased iteratively
• First order methods
Solving the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 31
• Interior point methods– Cost is modified with a steep smooth function
close to polyhedral constraints
– Modified problem solved with unconstrained optimization method
– Modification decreased iteratively
• First order methods
– Inspired by gradient method
Solving the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 32
• Interior point methods– Cost is modified with a steep smooth function
close to polyhedral constraints
– Modified problem solved with unconstrained optimization method
– Modification decreased iteratively
• First order methods
– Inspired by gradient method
– Simple, low order of convergence
Existence of a solution
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 33
Existence of a solution
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 34
Existence of a solution
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 35
Existence of a solution
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 36
Soft constraints
Making the QP convenient
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 37
Simplifying the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 38
Move blocking, constraint reduction
Simplifying the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 39
Move blocking, constraint reduction
Simplifying the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 40
Move blocking, constraint reduction
Simplifying the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 41
Move blocking, constraint reduction
Simplifying the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 42
Move blocking, constraint reduction
Simplifying the QP
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 43
Move blocking, constraint reduction
(http://animalswalls.blogspot.si/2011/08/cat-wallpapers.html)
Cat
Gradient method (ordinary)
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 45
(F. Borrelli, A. Bemporad, M. Morari, Predictive Control for linear and hybrid systems, 2015.)
unconstrained
constrained
Lipschitz constant
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 46
Gradient method (ordinary)
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 47
(F. Borrelli, A. Bemporad, M. Morari, Predictive Control for linear and hybrid systems, 2015.)
unconstrained
constrained
Gradient method (fast)
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 48
(F. Borrelli, A. Bemporad, M. Morari, Predictive Control for linear and hybrid systems, 2015.)
unconstrained
constrained
Lagrange multipliers
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 49
("Lagrange multiplier." Wikipedia, The Free Encyclopedia, 2015.)
Lagrange multipliers
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 50
("Lagrange multiplier." Wikipedia, The Free Encyclopedia, 2015.)
Lagrange multipliers
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 51
("Lagrange multiplier." Wikipedia, The Free Encyclopedia, 2015.)
Lagrange and dual functions
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 52
(Stephen Boyd & Lieven Vandenberghe, Convex Optimization, Cambridge University Press 2004)
Lagrange and dual functions
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 53
Lagrange and dual functions
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 54
Lagrange and dual functions
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 55
Lagrange and dual functions
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 56
Lagrange and dual functions
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 57
FGMdual
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 58
(generalized fast dual gradient method)
FGMdual
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 59
(generalized fast dual gradient method)
FGMdual
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 60
(generalized fast dual gradient method)
QPgen
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 61
QPgen
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 62
● Code generator:
QPgen
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 63
● Code generator:– Problem described in MATLAB
QPgen
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 64
● Code generator:– Problem described in MATLAB
– MATLAB does the offline calculations
QPgen
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 65
● Code generator:– Problem described in MATLAB
– MATLAB does the offline calculations
– MATLAB outputs the algorithm code in C
QPgen
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 66
● Code generator:– Problem described in MATLAB
– MATLAB does the offline calculations
– MATLAB outputs the algorithm code in C
– Code compiled, ran, result returned to MATLAB
QPgen
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 67
● Code generator:– Problem described in MATLAB
– MATLAB does the offline calculations
– MATLAB outputs the algorithm code in C
– Code compiled, ran, result returned to MATLAB
– FGMdual one of the supported algorithms
QPgen
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 68
● Code generator:– Problem described in MATLAB
– MATLAB does the offline calculations
– MATLAB outputs the algorithm code in C
– Code compiled, ran, result returned to MATLAB
– FGMdual one of the supported algorithms
● Knowing the code:
QPgen
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 69
● Code generator:– Problem described in MATLAB
– MATLAB does the offline calculations
– MATLAB outputs the algorithm code in C
– Code compiled, ran, result returned to MATLAB
– FGMdual one of the supported algorithms
● Knowing the code:– MATLAB code is long
QPgen
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 70
● Code generator:– Problem described in MATLAB
– MATLAB does the offline calculations
– MATLAB outputs the algorithm code in C
– Code compiled, ran, result returned to MATLAB
– FGMdual one of the supported algorithms
● Knowing the code:– MATLAB code is long
– Generated code is confusing
Restart
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 76
(B. O’Donoghue, E. Candès, Adaptive Restart for Accelerated Gradient Schemes, Found Comput Math 2013.)
Complexity certification
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 77
• Upper bound on the required number of floating point operations that in turn stems from an upper bound on the iteration count
(S. Richter, Computational Complexity Certification of Gradient Methods for Real-Time Model Predictive Control, ETH Zurich 2012)
Complexity certification
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 78
• Upper bound on the required number of floating point operations that in turn stems from an upper bound on the iteration count
• accuracy => no. of iterations => no. of operations => computing time
Complexity certification
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 79
• Explicit: fixed complexity
Complexity certification
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 80
• Explicit: fixed complexity• Active set:
Complexity certification
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 81
• Explicit: fixed complexity• Active set:
– Finite termination
Complexity certification
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 82
• Explicit: fixed complexity• Active set:
– Finite termination
– Worst case number of iterations huge
Complexity certification
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 83
• Explicit: fixed complexity• Active set:
– Finite termination
– Worst case number of iterations huge
– Early termination unexplored
Complexity certification
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 84
• Explicit: fixed complexity• Active set:
– Finite termination
– Worst case number of iterations huge
– Early termination unexplored
• Interior point:
Complexity certification
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 85
• Explicit: fixed complexity• Active set:
– Finite termination
– Worst case number of iterations huge
– Early termination unexplored
• Interior point:– Certificates very conservative
Complexity certification
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 86
• Explicit: fixed complexity• Active set:
– Finite termination
– Worst case number of iterations huge
– Early termination unexplored
• Interior point:– Certificates very conservative
• First order:
Complexity certification
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 87
• Explicit: fixed complexity• Active set:
– Finite termination
– Worst case number of iterations huge
– Early termination unexplored
• Interior point:– Certificates very conservative
• First order:– Certificates within few orders of magnitude
Complexity certification
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 88
• State of the art for first order methods:
Complexity certification
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 89
• State of the art for first order methods:– Derived for certain (simpler) algorithms
Complexity certification
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 90
• State of the art for first order methods:– Derived for certain (simpler) algorithms
(not generalized, no restarting)
Complexity certification
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 91
• State of the art for first order methods:– Derived for certain (simpler) algorithms
(not generalized, no restarting)– Derived for certain (simpler) constraints
Complexity certification
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 92
• State of the art for first order methods:– Derived for certain (simpler) algorithms
(not generalized, no restarting)– Derived for certain (simpler) constraints
Nesterov
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 93
• Convex optimization
(Y. Nesterov, Introductory lectures on convex optimization : a basic course, Springer 2004)
Nesterov
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 94
• Convex optimization• Does not mention duality
(Y. Nesterov, Introductory lectures on convex optimization : a basic course, Springer 2004)
Richter
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 95
• MPC with some QP
(S. Richter, Computational Complexity Certification of Gradient Methods for Real-Time Model Predictive Control, ETH Zurich 2012)
Richter
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 96
• MPC with some QP• Duality: partial Lagrange relaxation
(simple state constraints), shows that complete is worse, but complete is what we need
(S. Richter, Computational Complexity Certification of Gradient Methods for Real-Time Model Predictive Control, ETH Zurich 2012)
Richter
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 97
• MPC with some QP• Duality: partial Lagrange relaxation
(simple state constraints), shows that complete is worse, but complete is what we need
• Duality: dual problem not strongly concave
(S. Richter, Computational Complexity Certification of Gradient Methods for Real-Time Model Predictive Control, ETH Zurich 2012)
Temporary conclusion
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 98
• What to do? Transform the MPC-obtained QP into dual space
Temporary conclusion
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 99
• What to do? Transform the MPC-obtained QP into dual space
• Follow either Richter or Nesterov with dual QP
Temporary conclusion
Matija Perne | FMPCFMPC PM | Ljubljana | 25.02.2016 | Page 100
• What to do? Transform the MPC-obtained QP into dual space
• Follow either Richter or Nesterov with dual QP
• Preconditioning?• Restarting?