Fast Model Predictive Control for Magnetic Plasma Control MPC using fast online 1st-order QP methods

Size: px
Start display at page:

Download "Fast Model Predictive Control for Magnetic Plasma Control MPC using fast online 1st-order QP methods"

Transcription

1 AWP15-ENR01/JSI-02 Fast Model Predictive Control for Magnetic Plasma Control MPC using fast online 1st-order QP methods Matija Perne Jožef Stefan Institute

2 Linear dynamic system, optimum Discrete-time model: Matija Perne FMPCFMPC PM Ljubljana Page 2

3 Linear dynamic system, optimum Discrete-time model: Matija Perne FMPCFMPC PM Ljubljana Page 3

4 Linear dynamic system, optimum Discrete-time model: Cost minimization: Matija Perne FMPCFMPC PM Ljubljana Page 4

5 Linear dynamic system, optimum Discrete-time model: Cost minimization: Constraints: Matija Perne FMPCFMPC PM Ljubljana Page 5

6 Linear dynamic system, optimum Discrete-time model: Cost minimization: Constraints: Matija Perne FMPCFMPC PM Ljubljana Page 6

7 Planning the future Matija Perne FMPCFMPC PM Ljubljana Page 7

8 Planning the future Matija Perne FMPCFMPC PM Ljubljana Page 8

9 Planning the future Matija Perne FMPCFMPC PM Ljubljana Page 9

10 Quadratic program Matija Perne FMPCFMPC PM Ljubljana Page 10

11 Quadratic program Hessian Matija Perne FMPCFMPC PM Ljubljana Page 11

12 Quadratic program Hessian Gradient Matija Perne FMPCFMPC PM Ljubljana Page 12

13 Quadratic program Hessian Affine set Gradient Matija Perne FMPCFMPC PM Ljubljana Page 13

14 Quadratic program Hessian Affine set Gradient Polyhedron Matija Perne FMPCFMPC PM Ljubljana Page 14

15 Quadratic program Hessian Affine set Gradient Polyhedron Dual method Matija Perne FMPCFMPC PM Ljubljana Page 15

16 Solving the QP Matija Perne FMPCFMPC PM Ljubljana Page 16

17 Solving the QP Explicit MPC: solving the problem in advance Matija Perne FMPCFMPC PM Ljubljana Page 17

18 Solving the QP Explicit MPC: solving the problem in advance Solution piecewise linear Matija Perne FMPCFMPC PM Ljubljana Page 18

19 Solving the QP Explicit MPC: solving the problem in advance Solution piecewise linear ( Matija Perne FMPCFMPC PM Ljubljana Page 19

20 Solving the QP Explicit MPC: solving the problem in advance Solution piecewise linear Active and inactive constraints: ( Matija Perne FMPCFMPC PM Ljubljana Page 20

21 Solving the QP Explicit MPC: solving the problem in advance Solution piecewise linear Active and inactive constraints: ( Matija Perne FMPCFMPC PM Ljubljana Page 21

22 Solving the QP Explicit MPC: solving the problem in advance Solution piecewise linear Active and inactive constraints: ( Matija Perne FMPCFMPC PM Ljubljana Page 22

23 Solving the QP Explicit MPC: solving the problem in advance Solution piecewise linear Active and inactive constraints: Active set methods Matija Perne FMPCFMPC PM Ljubljana Page 23

24 Solving the QP Explicit MPC: solving the problem in advance Solution piecewise linear Active and inactive constraints: Active set methods Online search for active constraints Matija Perne FMPCFMPC PM Ljubljana Page 24

25 Solving the QP Explicit MPC: solving the problem in advance Solution piecewise linear Active and inactive constraints: Active set methods Online search for active constraints Iterative Matija Perne FMPCFMPC PM Ljubljana Page 25

26 Solving the QP Interior point methods Matija Perne FMPCFMPC PM Ljubljana Page 26

27 Solving the QP Interior point methods Cost is modified with a steep smooth function close to polyhedral constraints Matija Perne FMPCFMPC PM Ljubljana Page 27

28 Solving the QP Interior point methods Cost is modified with a steep smooth function close to polyhedral constraints Modified problem solved with unconstrained optimization method Matija Perne FMPCFMPC PM Ljubljana Page 28

29 Solving the QP 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 Matija Perne FMPCFMPC PM Ljubljana Page 29

30 Solving the QP 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 Matija Perne FMPCFMPC PM Ljubljana Page 30

31 Solving the QP 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 Matija Perne FMPCFMPC PM Ljubljana Page 31

32 Solving the QP 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 Matija Perne FMPCFMPC PM Ljubljana Page 32

33 Existence of a solution Matija Perne FMPCFMPC PM Ljubljana Page 33

34 Existence of a solution Matija Perne FMPCFMPC PM Ljubljana Page 34

35 Existence of a solution Matija Perne FMPCFMPC PM Ljubljana Page 35

36 Existence of a solution Soft constraints Matija Perne FMPCFMPC PM Ljubljana Page 36

37 Making the QP convenient Matija Perne FMPCFMPC PM Ljubljana Page 37

38 Simplifying the QP Move blocking, constraint reduction Matija Perne FMPCFMPC PM Ljubljana Page 38

39 Simplifying the QP Move blocking, constraint reduction Matija Perne FMPCFMPC PM Ljubljana Page 39

40 Simplifying the QP Move blocking, constraint reduction Matija Perne FMPCFMPC PM Ljubljana Page 40

41 Simplifying the QP Move blocking, constraint reduction Matija Perne FMPCFMPC PM Ljubljana Page 41

42 Simplifying the QP Move blocking, constraint reduction Matija Perne FMPCFMPC PM Ljubljana Page 42

43 Simplifying the QP Move blocking, constraint reduction Matija Perne FMPCFMPC PM Ljubljana Page 43

44 Cat (

45 Gradient method (ordinary) (F. Borrelli, A. Bemporad, M. Morari, Predictive Control for linear and hybrid systems, 2015.) unconstrained constrained Matija Perne FMPCFMPC PM Ljubljana Page 45

46 Lipschitz constant Matija Perne FMPCFMPC PM Ljubljana Page 46

47 Gradient method (ordinary) (F. Borrelli, A. Bemporad, M. Morari, Predictive Control for linear and hybrid systems, 2015.) unconstrained constrained Matija Perne FMPCFMPC PM Ljubljana Page 47

48 Gradient method (fast) (F. Borrelli, A. Bemporad, M. Morari, Predictive Control for linear and hybrid systems, 2015.) unconstrained constrained Matija Perne FMPCFMPC PM Ljubljana Page 48

49 Lagrange multipliers ("Lagrange multiplier." Wikipedia, The Free Encyclopedia, 2015.) Matija Perne FMPCFMPC PM Ljubljana Page 49

50 Lagrange multipliers ("Lagrange multiplier." Wikipedia, The Free Encyclopedia, 2015.) Matija Perne FMPCFMPC PM Ljubljana Page 50

51 Lagrange multipliers ("Lagrange multiplier." Wikipedia, The Free Encyclopedia, 2015.) Matija Perne FMPCFMPC PM Ljubljana Page 51

52 Lagrange and dual functions (Stephen Boyd & Lieven Vandenberghe, Convex Optimization, Cambridge University Press 2004) Matija Perne FMPCFMPC PM Ljubljana Page 52

53 Lagrange and dual functions Matija Perne FMPCFMPC PM Ljubljana Page 53

54 Lagrange and dual functions Matija Perne FMPCFMPC PM Ljubljana Page 54

55 Lagrange and dual functions Matija Perne FMPCFMPC PM Ljubljana Page 55

56 Lagrange and dual functions Matija Perne FMPCFMPC PM Ljubljana Page 56

57 Lagrange and dual functions Matija Perne FMPCFMPC PM Ljubljana Page 57

58 FGMdual (generalized fast dual gradient method) Matija Perne FMPCFMPC PM Ljubljana Page 58

59 FGMdual (generalized fast dual gradient method) Matija Perne FMPCFMPC PM Ljubljana Page 59

60 FGMdual (generalized fast dual gradient method) Matija Perne FMPCFMPC PM Ljubljana Page 60

61 QPgen Matija Perne FMPCFMPC PM Ljubljana Page 61

62 QPgen Code generator: Matija Perne FMPCFMPC PM Ljubljana Page 62

63 QPgen Code generator: Problem described in MATLAB Matija Perne FMPCFMPC PM Ljubljana Page 63

64 QPgen Code generator: Problem described in MATLAB MATLAB does the offline calculations Matija Perne FMPCFMPC PM Ljubljana Page 64

65 QPgen Code generator: Problem described in MATLAB MATLAB does the offline calculations MATLAB outputs the algorithm code in C Matija Perne FMPCFMPC PM Ljubljana Page 65

66 QPgen 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 Matija Perne FMPCFMPC PM Ljubljana Page 66

67 QPgen 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 Matija Perne FMPCFMPC PM Ljubljana Page 67

68 QPgen 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: Matija Perne FMPCFMPC PM Ljubljana Page 68

69 QPgen 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 Matija Perne FMPCFMPC PM Ljubljana Page 69

70 QPgen 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 Matija Perne FMPCFMPC PM Ljubljana Page 70

71

72

73

74

75

76 Restart (B. O Donoghue, E. Candès, Adaptive Restart for Accelerated Gradient Schemes, Found Comput Math 2013.) Matija Perne FMPCFMPC PM Ljubljana Page 76

77 Complexity certification (S. Richter, Computational Complexity Certification of Gradient Methods for Real-Time Model Predictive Control, ETH Zurich 2012) Upper bound on the required number of floating point operations that in turn stems from an upper bound on the iteration count Matija Perne FMPCFMPC PM Ljubljana Page 77

78 Complexity certification 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 Matija Perne FMPCFMPC PM Ljubljana Page 78

79 Complexity certification Explicit: fixed complexity Matija Perne FMPCFMPC PM Ljubljana Page 79

80 Complexity certification Explicit: fixed complexity Active set: Matija Perne FMPCFMPC PM Ljubljana Page 80

81 Complexity certification Explicit: fixed complexity Active set: Finite termination Matija Perne FMPCFMPC PM Ljubljana Page 81

82 Complexity certification Explicit: fixed complexity Active set: Finite termination Worst case number of iterations huge Matija Perne FMPCFMPC PM Ljubljana Page 82

83 Complexity certification Explicit: fixed complexity Active set: Finite termination Worst case number of iterations huge Early termination unexplored Matija Perne FMPCFMPC PM Ljubljana Page 83

84 Complexity certification Explicit: fixed complexity Active set: Finite termination Worst case number of iterations huge Early termination unexplored Interior point: Matija Perne FMPCFMPC PM Ljubljana Page 84

85 Complexity certification Explicit: fixed complexity Active set: Finite termination Worst case number of iterations huge Early termination unexplored Interior point: Certificates very conservative Matija Perne FMPCFMPC PM Ljubljana Page 85

86 Complexity certification Explicit: fixed complexity Active set: Finite termination Worst case number of iterations huge Early termination unexplored Interior point: Certificates very conservative First order: Matija Perne FMPCFMPC PM Ljubljana Page 86

87 Complexity certification 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 Matija Perne FMPCFMPC PM Ljubljana Page 87

88 Complexity certification State of the art for first order methods: Matija Perne FMPCFMPC PM Ljubljana Page 88

89 Complexity certification State of the art for first order methods: Derived for certain (simpler) algorithms Matija Perne FMPCFMPC PM Ljubljana Page 89

90 Complexity certification State of the art for first order methods: Derived for certain (simpler) algorithms (not generalized, no restarting) Matija Perne FMPCFMPC PM Ljubljana Page 90

91 Complexity certification State of the art for first order methods: Derived for certain (simpler) algorithms (not generalized, no restarting) Derived for certain (simpler) constraints Matija Perne FMPCFMPC PM Ljubljana Page 91

92 Complexity certification State of the art for first order methods: Derived for certain (simpler) algorithms (not generalized, no restarting) Derived for certain (simpler) constraints Matija Perne FMPCFMPC PM Ljubljana Page 92

93 Nesterov (Y. Nesterov, Introductory lectures on convex optimization : a basic course, Springer 2004) Convex optimization Matija Perne FMPCFMPC PM Ljubljana Page 93

94 Nesterov (Y. Nesterov, Introductory lectures on convex optimization : a basic course, Springer 2004) Convex optimization Does not mention duality Matija Perne FMPCFMPC PM Ljubljana Page 94

95 Richter (S. Richter, Computational Complexity Certification of Gradient Methods for Real-Time Model Predictive Control, ETH Zurich 2012) MPC with some QP Matija Perne FMPCFMPC PM Ljubljana Page 95

96 Richter (S. Richter, Computational Complexity Certification of Gradient Methods for Real-Time Model Predictive Control, ETH Zurich 2012) MPC with some QP Duality: partial Lagrange relaxation (simple state constraints), shows that complete is worse, but complete is what we need Matija Perne FMPCFMPC PM Ljubljana Page 96

97 Richter (S. Richter, Computational Complexity Certification of Gradient Methods for Real-Time Model Predictive Control, ETH Zurich 2012) 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 Matija Perne FMPCFMPC PM Ljubljana Page 97

98 Temporary conclusion What to do? Transform the MPC-obtained QP into dual space Matija Perne FMPCFMPC PM Ljubljana Page 98

99 Temporary conclusion What to do? Transform the MPC-obtained QP into dual space Follow either Richter or Nesterov with dual QP Matija Perne FMPCFMPC PM Ljubljana Page 99

100 Temporary conclusion What to do? Transform the MPC-obtained QP into dual space Follow either Richter or Nesterov with dual QP Preconditioning? Restarting? Matija Perne FMPCFMPC PM Ljubljana Page 100