numerical optimal control with daes lecture 8 direct
play

Numerical Optimal Control with DAEs Lecture 8: Direct Collocation S - PowerPoint PPT Presentation

Numerical Optimal Control with DAEs Lecture 8: Direct Collocation S ebastien Gros AWESCO PhD course 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 1 / 24 Survival map of Direct Optimal Control Collocation


  1. E.g. Polynomial interpolation t k = 1 , t k +1 = 2 Consider a time grid : K = 4 { t k , 0 , ..., t k , K } ∈ [ t k , t k +1 ] { t k , 0 , ..., t k , K } = { 1 . 0 , 1 . 0694 , 1 . 33 , 1 . 67 , 1 . 931 } Lagrange Polynomials : 1.5 t k, 0 t k, 1 t k, 2 t k, 3 t k, 4 K � t − t k , j P k , i ( t ) = ∈ R 1 t k , i − t k , j j =0 , j � = i 0.5 of order K , with property: � 1 if l = i 0 P k , i ( t k , l ) = 0 if l � = i t k t k +1 -0.5 Interpolation with θ k , i ∈ R n 1 1.2 1.4 1.6 1.8 2 K � x ( θ k , t ) = · P k , i ( t ) θ k , i ���� � �� � i =0 parameters polynomials having the property: x ( θ , t k , j ) = θ k , j 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 5 / 24

  2. E.g. Polynomial interpolation t k = 1 , t k +1 = 2 Consider a time grid : K = 4 { t k , 0 , ..., t k , K } ∈ [ t k , t k +1 ] { t k , 0 , ..., t k , K } = { 1 . 0 , 1 . 0694 , 1 . 33 , 1 . 67 , 1 . 931 } Lagrange Polynomials : 1.5 t k, 0 t k, 1 t k, 2 t k, 3 t k, 4 K � t − t k , j P k , i ( t ) = ∈ R 1 t k , i − t k , j j =0 , j � = i 0.5 of order K , with property: � 1 if l = i 0 P k , i ( t k , l ) = 0 if l � = i t k t k +1 -0.5 Interpolation with θ k , i ∈ R n 1 1.2 1.4 1.6 1.8 2 K � x ( θ k , t ) = · P k , i ( t ) θ k , i ���� � �� � i =0 parameters polynomials having the property: x ( θ , t k , j ) = θ k , j 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 5 / 24

  3. E.g. Polynomial interpolation t k = 1 , t k +1 = 2 Consider a time grid : K = 4 { t k , 0 , ..., t k , K } ∈ [ t k , t k +1 ] { t k , 0 , ..., t k , K } = { 1 . 0 , 1 . 0694 , 1 . 33 , 1 . 67 , 1 . 931 } Lagrange Polynomials : 1.5 t k, 0 t k, 1 t k, 2 t k, 3 t k, 4 K � t − t k , j P k , i ( t ) = ∈ R 1 t k , i − t k , j j =0 , j � = i 0.5 of order K , with property: � 1 if l = i 0 P k , i ( t k , l ) = 0 if l � = i t k t k +1 -0.5 Interpolation with θ k , i ∈ R n 1 1.2 1.4 1.6 1.8 2 K � x ( θ k , t ) = · P k , i ( t ) θ k , i ���� � �� � i =0 parameters polynomials having the property: x ( θ , t k , j ) = θ k , j 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 5 / 24

  4. E.g. Polynomial interpolation t k = 1 , t k +1 = 2 Consider a time grid : K = 4 { t k , 0 , ..., t k , K } ∈ [ t k , t k +1 ] { t k , 0 , ..., t k , K } = { 1 . 0 , 1 . 0694 , 1 . 33 , 1 . 67 , 1 . 931 } Lagrange Polynomials : 1.5 t k, 0 t k, 1 t k, 2 t k, 3 t k, 4 K � t − t k , j P k , i ( t ) = ∈ R 1 t k , i − t k , j j =0 , j � = i 0.5 of order K , with property: � 1 if l = i 0 P k , i ( t k , l ) = 0 if l � = i t k t k +1 -0.5 Interpolation with θ k , i ∈ R n 1 1.2 1.4 1.6 1.8 2 K � x ( θ k , t ) = · P k , i ( t ) θ k , i ���� � �� � i =0 parameters polynomials having the property: x ( θ , t k , j ) = θ k , j 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 5 / 24

  5. E.g. Polynomial interpolation t k = 1 , t k +1 = 2 Consider a time grid : K = 4 { t k , 0 , ..., t k , K } ∈ [ t k , t k +1 ] { t k , 0 , ..., t k , K } = { 1 . 0 , 1 . 0694 , 1 . 33 , 1 . 67 , 1 . 931 } Lagrange Polynomials : 1.5 t k, 0 t k, 1 t k, 2 t k, 3 t k, 4 K � t − t k , j P k , i ( t ) = ∈ R 1 t k , i − t k , j j =0 , j � = i 0.5 of order K , with property: � 1 if l = i 0 P k , i ( t k , l ) = 0 if l � = i t k t k +1 -0.5 Interpolation with θ k , i ∈ R n 1 1.2 1.4 1.6 1.8 2 K � x ( θ k , t ) = · P k , i ( t ) θ k , i ���� � �� � i =0 parameters polynomials having the property: x ( θ , t k , j ) = θ k , j 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 5 / 24

  6. E.g. Polynomial interpolation t k = 1 , t k +1 = 2 Consider a time grid : K = 4 { t k , 0 , ..., t k , K } ∈ [ t k , t k +1 ] { t k , 0 , ..., t k , K } = { 1 . 0 , 1 . 0694 , 1 . 33 , 1 . 67 , 1 . 931 } Lagrange Polynomials : 1.5 t k, 0 t k, 1 t k, 2 t k, 3 t k, 4 K � t − t k , j P k , i ( t ) = ∈ R 1 t k , i − t k , j j =0 , j � = i 0.5 of order K , with property: � 1 if l = i 0 P k , i ( t k , l ) = 0 if l � = i t k t k +1 -0.5 Interpolation with θ k , i ∈ R n 1 1.2 1.4 1.6 1.8 2 K � x ( θ k , t ) = · P k , i ( t ) θ k , i ���� � �� � i =0 parameters polynomials having the property: x ( θ , t k , j ) = θ k , j 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 5 / 24

  7. E.g. Polynomial interpolation t k = 1 , t k +1 = 2 Consider a time grid : K = 4 { t k , 0 , ..., t k , K } ∈ [ t k , t k +1 ] { t k , 0 , ..., t k , K } = { 1 . 0 , 1 . 0694 , 1 . 33 , 1 . 67 , 1 . 931 } Lagrange Polynomials : 1.5 t k, 0 t k, 1 t k, 2 t k, 3 t k, 4 K � t − t k , j P k , i ( t ) = ∈ R 1 t k , i − t k , j j =0 , j � = i 0.5 of order K , with property: � 1 if l = i 0 P k , i ( t k , l ) = 0 if l � = i t k t k +1 -0.5 Interpolation with θ k , i ∈ R n 1 1.2 1.4 1.6 1.8 2 K � x ( θ k , t ) = · P k , i ( t ) θ k , i ���� � �� � i =0 parameters polynomials having the property: x ( θ , t k , j ) = θ k , j 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 5 / 24

  8. E.g. Polynomial interpolation t k = 1 , t k +1 = 2 Consider a time grid : K = 4 { t k , 0 , ..., t k , K } ∈ [ t k , t k +1 ] { t k , 0 , ..., t k , K } = { 1 . 0 , 1 . 0694 , 1 . 33 , 1 . 67 , 1 . 931 } Lagrange Polynomials : 1.5 t k, 0 t k, 1 t k, 2 t k, 3 t k, 4 K � t − t k , j P k , i ( t ) = ∈ R 1 t k , i − t k , j j =0 , j � = i 0.5 of order K , with property: � 1 if l = i 0 P k , i ( t k , l ) = 0 if l � = i t k t k +1 -0.5 Interpolation with θ k , i ∈ R n 1 1.2 1.4 1.6 1.8 2 K � x ( θ k , t ) = · P k , i ( t ) θ k , i ���� � �� � i =0 parameters polynomials having the property: x ( θ , t k , j ) = θ k , j 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 5 / 24

  9. E.g. Polynomial interpolation t k = 1 , t k +1 = 2 Consider a time grid : K = 4 { t k , 0 , ..., t k , K } ∈ [ t k , t k +1 ] { t k , 0 , ..., t k , K } = { 1 . 0 , 1 . 0694 , 1 . 33 , 1 . 67 , 1 . 931 } Lagrange Polynomials : 1.5 t k, 0 t k, 1 t k, 2 t k, 3 t k, 4 K � t − t k , j P k , i ( t ) = ∈ R 1 t k , i − t k , j j =0 , j � = i 0.5 of order K , with property: � 1 if l = i 0 P k , i ( t k , l ) = 0 if l � = i t k t k +1 -0.5 Interpolation with θ k , i ∈ R n 1 1.2 1.4 1.6 1.8 2 K � x ( θ k , t ) = · P k , i ( t ) θ k , i ���� � �� � i =0 parameters polynomials having the property: x ( θ , t k , j ) = θ k , j 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 5 / 24

  10. E.g. Polynomial interpolation t k = 1 , t k +1 = 2 Consider a time grid : K = 4 { t k , 0 , ..., t k , K } ∈ [ t k , t k +1 ] { t k , 0 , ..., t k , K } = { 1 . 0 , 1 . 0694 , 1 . 33 , 1 . 67 , 1 . 931 } Lagrange Polynomials : 1.5 t k, 0 t k, 1 t k, 2 t k, 3 t k, 4 K � t − t k , j P k , i ( t ) = ∈ R 1 t k , i − t k , j j =0 , j � = i 0.5 of order K , with property: � 1 if l = i 0 P k , i ( t k , l ) = 0 if l � = i t k t k +1 -0.5 Interpolation with θ k , i ∈ R n 1 1.2 1.4 1.6 1.8 2 K � x ( θ k , t ) = · P k , i ( t ) θ k , i ���� � �� � i =0 parameters polynomials having the property: x ( θ , t k , j ) = θ k , j 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 5 / 24

  11. E.g. Polynomial interpolation t k = 1 , t k +1 = 2 Consider a time grid : K = 4 { t k , 0 , ..., t k , K } ∈ [ t k , t k +1 ] { t k , 0 , ..., t k , K } = { 1 . 0 , 1 . 0694 , 1 . 33 , 1 . 67 , 1 . 931 } Lagrange Polynomials : 1.5 t k, 0 t k, 1 t k, 2 t k, 3 t k, 4 K � t − t k , j P k , i ( t ) = ∈ R 1 t k , i − t k , j j =0 , j � = i 0.5 of order K , with property: � 1 if l = i 0 P k , i ( t k , l ) = 0 if l � = i t k t k +1 -0.5 Interpolation with θ k , i ∈ R n 1 1.2 1.4 1.6 1.8 2 K � x ( θ k , t ) = · P k , i ( t ) θ k , i ���� � �� � i =0 parameters polynomials having the property: x ( θ , t k , j ) = θ k , j 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 5 / 24

  12. E.g. Polynomial interpolation t k = 1 , t k +1 = 2 Consider a time grid : K = 4 { t k , 0 , ..., t k , K } ∈ [ t k , t k +1 ] { t k , 0 , ..., t k , K } = { 1 . 0 , 1 . 0694 , 1 . 33 , 1 . 67 , 1 . 931 } Lagrange Polynomials : 1.5 t k, 0 t k, 1 t k, 2 t k, 3 t k, 4 K � t − t k , j P k , i ( t ) = ∈ R 1 t k , i − t k , j j =0 , j � = i 0.5 of order K , with property: � 1 if l = i 0 P k , i ( t k , l ) = 0 if l � = i t k t k +1 -0.5 Interpolation with θ k , i ∈ R n 1 1.2 1.4 1.6 1.8 2 K � x ( θ k , t ) = · P k , i ( t ) θ k , i Note: the Lagrange polynomials are orthogonal, i.e. ���� � �� � � t k +1 i =0 parameters polynomials P k , i ( t ) P k , j ( t ) d t = 0 , ∀ i � = j t k having the property: x ( θ , t k , j ) = θ k , j 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 5 / 24

  13. Outline Polynomial interpolation 1 Collocation-based integration 2 Collocation in multiple-shooting 3 Direct Collocation 4 NLP from direct collocation 5 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 6 / 24

  14. Collocation methods - key idea Approximate state trajectory x ( t ) via polynomials (order K ) t 0 t 1 t 2 t 3 t 4 t 5 0.35 f ( x 4 , u 4 ) x 4 0.3 x 3 0.25 f ( x 3 , u 3 ) 0.2 State f ( x 2 , u 2 ) x 2 0.15 0.1 x 1 f ( x 1 , u 1 ) 0.05 x 0 0 f ( x 0 , u 0 ) -0.05 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 7 / 24

  15. Collocation methods - key idea Approximate state trajectory x ( t ) via polynomials (order K ) t k t k +1 3 f ( x k , u k ) 2 x k +1 1 0 -1 x k -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 7 / 24

  16. Collocation methods - key idea Approximate state trajectory x ( t ) via polynomials (order K ) Time grid : { t k , 0 , ..., t k , K } ∈ [ t k , t k +1 ] t k t k +1 3 f ( x k , u k ) 2 x k +1 1 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 7 / 24

  17. Collocation methods - key idea Approximate state trajectory x ( t ) via polynomials (order K ) Time grid : { t k , 0 , ..., t k , K } ∈ [ t k , t k +1 ] Interpolate on each interval [ t k , t k +1 ] using: K � x ( θ k , t ) = θ k , i · P k , i ( t ) ���� � �� � i =0 parameters polynomials t k t k +1 θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 7 / 24

  18. Collocation methods - key idea Approximate state trajectory x ( t ) via polynomials (order K ) Time grid : { t k , 0 , ..., t k , K } ∈ [ t k , t k +1 ] Interpolate on each interval [ t k , t k +1 ] using: K � x ( θ k , t ) = θ k , i · P k , i ( t ) ���� � �� � i =0 parameters polynomials Integration: adjust θ k , i to approximate the dynamics ˙ x = F ( x , u ) t k t k +1 θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 7 / 24

  19. Collocation methods - how to adjust the θ k , i ? On each interval [ t k , t k +1 ], approximate ˙ x = F ( x , u k ) using K � x ( θ k , t ) = · P k , i ( t ) with x ( θ k , t k , j ) = θ k , j θ k , i ���� � �� � i =0 parameters polynomials Note: we have K + 1 degrees of freedom per state . t k t k +1 θ k, 3 f ( x k , u k ) 3 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 8 / 24

  20. Collocation methods - how to adjust the θ k , i ? On each interval [ t k , t k +1 ], approximate ˙ x = F ( x , u k ) using K � x ( θ k , t ) = · P k , i ( t ) with x ( θ k , t k , j ) = θ k , j θ k , i ���� � �� � i =0 parameters polynomials Note: we have K + 1 degrees of freedom per state . Collocation uses the constraints: x ( θ k , t k ) = θ k , 0 = x k t k t k +1 θ k, 3 f ( x k , u k ) 3 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 8 / 24

  21. Collocation methods - how to adjust the θ k , i ? On each interval [ t k , t k +1 ], approximate ˙ x = F ( x , u k ) using K � x ( θ k , t ) = · P k , i ( t ) with x ( θ k , t k , j ) = θ k , j θ k , i ���� � �� � i =0 parameters polynomials Note: we have K + 1 degrees of freedom per state . Collocation uses the constraints: x ( θ k , t k ) = θ k , 0 = x k ∂ ∂ t x ( θ k , t k , j ) = F ( x ( θ k , t k , j ) , u k ) , j = 1 , ..., K t k t k +1 θ k, 3 f ( x k , u k ) 3 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 8 / 24

  22. Collocation methods - how to adjust the θ k , i ? On each interval [ t k , t k +1 ], approximate ˙ x = F ( x , u k ) using K � x ( θ k , t ) = · P k , i ( t ) with x ( θ k , t k , j ) = θ k , j θ k , i ���� � �� � i =0 parameters polynomials Note: we have K + 1 degrees of freedom per state . Collocation uses the constraints: x ( θ k , t k ) = θ k , 0 = x k (note that x k , u k are coming from the NLP !!) ∂ ∂ t x ( θ k , t k , j ) = F ( x ( θ k , t k , j ) , u k ) , j = 1 , ..., K t k t k +1 θ k, 3 f ( x k , u k ) 3 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 8 / 24

  23. Collocation methods - how to adjust the θ k , i ? On each interval [ t k , t k +1 ], approximate ˙ x = F ( x , u k ) using K � x ( θ k , t ) = · P k , i ( t ) with x ( θ k , t k , j ) = θ k , j θ k , i ���� � �� � i =0 parameters polynomials Note: we have K + 1 degrees of freedom per state . Collocation uses the constraints: x ( θ k , t k ) = θ k , 0 = x k (note that x k , u k are coming from the NLP !!) ∂ ∂ t x ( θ k , t k , j ) = F ( θ k , j , u k ) , j = 1 , ..., K t k t k +1 θ k, 3 f ( x k , u k ) 3 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 8 / 24

  24. Collocation methods - how to adjust the θ k , i ? On each interval [ t k , t k +1 ], approximate ˙ x = F ( x , u k ) using K � x ( θ k , t ) = · P k , i ( t ) with x ( θ k , t k , j ) = θ k , j θ k , i ���� � �� � i =0 parameters polynomials Note: we have K + 1 degrees of freedom per state . Collocation uses the constraints: x ( θ k , t k ) = θ k , 0 = x k (note that x k , u k are coming from the NLP !!) K � θ k , i · ˙ P k , i ( t k , j ) = F ( θ k , j , u k ) , j = 1 , ..., K i =0 t k t k +1 θ k, 3 f ( x k , u k ) 3 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 8 / 24

  25. Collocation methods - Implementation Collocation uses the constraints: θ k , 0 = x k K � θ k , i · ˙ P k , i ( t k , j ) = F ( θ k , j , u k ) i =0 for j = 1 , ..., K . t k t k +1 θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 9 / 24

  26. Collocation methods - Implementation Solve for θ k , i using Newton Collocation uses the constraints:   θ k , 0 = x k θ k , 0 − x k � K i =0 θ k , i ˙ P k , i ( t k , 1 ) − F ( θ k , 1 , u k ) K   �    = 0 θ k , i · ˙ . P k , i ( t k , j ) = F ( θ k , j , u k )   . .  i =0 � K i =0 θ k , i ˙ P k , i ( t k , K ) − F ( θ k , K , u k ) for j = 1 , ..., K . t k t k +1 θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 9 / 24

  27. Collocation methods - Implementation Solve for θ k , i using Newton Collocation uses the constraints:   θ k , 0 = x k θ k , 0 − x k � K i =0 θ k , i ˙ P k , i ( t k , 1 ) − F ( θ k , 1 , u k ) K   �    = 0 θ k , i · ˙ . P k , i ( t k , j ) = F ( θ k , j , u k )   . .  i =0 � K i =0 θ k , i ˙ P k , i ( t k , K ) − F ( θ k , K , u k ) for j = 1 , ..., K . t k t k +1 θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 9 / 24

  28. Collocation methods - Implementation Solve for θ k , i using Newton Collocation uses the constraints:   θ k , 0 = x k θ k , 0 − x k � K i =0 θ k , i ˙ P k , i ( t k , 1 ) − F ( θ k , 1 , u k ) K   �    = 0 θ k , i · ˙ . P k , i ( t k , j ) = F ( θ k , j , u k )   . .  i =0 � K i =0 θ k , i ˙ P k , i ( t k , K ) − F ( θ k , K , u k ) for j = 1 , ..., K . t k t k +1 θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 9 / 24

  29. Collocation methods - Implementation Solve for θ k , i using Newton Collocation uses the constraints:   θ k , 0 = x k θ k , 0 − x k � K i =0 θ k , i ˙ P k , i ( t k , 1 ) − F ( θ k , 1 , u k ) K   �    = 0 θ k , i · ˙ . P k , i ( t k , j ) = F ( θ k , j , u k )   . .  i =0 � K i =0 θ k , i ˙ P k , i ( t k , K ) − F ( θ k , K , u k ) for j = 1 , ..., K . t k t k +1 θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 9 / 24

  30. Collocation methods - Implementation Solve for θ k , i using Newton Collocation uses the constraints:   θ k , 0 = x k θ k , 0 − x k � K i =0 θ k , i ˙ P k , i ( t k , 1 ) − F ( θ k , 1 , u k ) K   �    = 0 θ k , i · ˙ . P k , i ( t k , j ) = F ( θ k , j , u k )   . .  i =0 � K i =0 θ k , i ˙ P k , i ( t k , K ) − F ( θ k , K , u k ) for j = 1 , ..., K . t k t k +1 θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 9 / 24

  31. Collocation methods - Implementation Solve for θ k , i using Newton Collocation uses the constraints:   θ k , 0 = x k θ k , 0 − x k � K i =0 θ k , i ˙ P k , i ( t k , 1 ) − F ( θ k , 1 , u k ) K   �    = 0 θ k , i · ˙ . P k , i ( t k , j ) = F ( θ k , j , u k )   . .  i =0 � K i =0 θ k , i ˙ P k , i ( t k , K ) − F ( θ k , K , u k ) for j = 1 , ..., K . t k t k +1 θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 9 / 24

  32. Collocation methods - Implementation Solve for θ k , i using Newton Collocation uses the constraints:   θ k , 0 = x k θ k , 0 − x k � K i =0 θ k , i ˙ P k , i ( t k , 1 ) − F ( θ k , 1 , u k ) K   �    = 0 θ k , i · ˙ . P k , i ( t k , j ) = F ( θ k , j , u k )   . .  i =0 � K i =0 θ k , i ˙ P k , i ( t k , K ) − F ( θ k , K , u k ) for j = 1 , ..., K . t k t k +1 θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 9 / 24

  33. Collocation methods - Implementation Solve for θ k , i using Newton Collocation uses the constraints:   θ k , 0 = x k θ k , 0 − x k � K i =0 θ k , i ˙ P k , i ( t k , 1 ) − F ( θ k , 1 , u k ) K   �    = 0 θ k , i · ˙ . P k , i ( t k , j ) = F ( θ k , j , u k )   . .  i =0 � K i =0 θ k , i ˙ P k , i ( t k , K ) − F ( θ k , K , u k ) for j = 1 , ..., K . t k t k +1 θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 9 / 24

  34. Collocation methods - Implementation Solve for θ k , i using Newton Collocation uses the constraints:   θ k , 0 = x k θ k , 0 − x k � K i =0 θ k , i ˙ P k , i ( t k , 1 ) − F ( θ k , 1 , u k ) K   �    = 0 θ k , i · ˙ . P k , i ( t k , j ) = F ( θ k , j , u k )   . .  i =0 � K i =0 θ k , i ˙ P k , i ( t k , K ) − F ( θ k , K , u k ) for j = 1 , ..., K . End-state: K � x ( θ k , t k +1 ) = θ k , i · P k , i ( t k +1 ) i =0 t k t k +1 θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 9 / 24

  35. Collocation methods - Implementation Shooting constraints Collocation uses the constraints: θ k , 0 = x k f ( x k , u k ) − x k +1 = 0 � �� � K � = x ( θ k , t k +1 ) θ k , i · ˙ P k , i ( t k , j ) = F ( θ k , j , u k ) becomes: i =0 K for j = 1 , ..., K . End-state: � θ k , i P k , i ( t k +1 ) − x k +1 = 0 K i =0 � x ( θ k , t k +1 ) = θ k , i · P k , i ( t k +1 ) i =0 t k t k +1 θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 9 / 24

  36. Selection of the time grid t k , i t k t k +1 θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 10 / 24

  37. Selection of the time grid t k , i t k t k +1 θ k, 3 3 f ( x k , u k ) Collocation points on [0 , 1] : 2 θ k, 2 x k +1 1 x ( θ k , t ) K Legendre Radau 0 θ k, 1 1 0 . 5 1 . 0 θ k, 0 -1 x k 0.211325 0.333333 t k, 0 t k, 1 t k, 2 t k, 3 2 -2 0.788675 1.000000 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.112702 0.155051 3 0.500000 0.644949 0.887298 1.000000 0.069432 0.088588 0.330009 0.409467 4 0.669991 0.787659 0.930568 1.000000 0.046910 0.057104 0.230765 0.276843 5 0.500000 0.583590 0.769235 0.860240 0.953090 1.000000 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 10 / 24

  38. Selection of the time grid t k , i t k t k +1 θ k, 3 3 f ( x k , u k ) Collocation points on [0 , 1] : 2 θ k, 2 x k +1 1 x ( θ k , t ) K Legendre Radau 0 θ k, 1 1 0 . 5 1 . 0 θ k, 0 -1 x k 0.211325 0.333333 t k, 0 t k, 1 t k, 2 t k, 3 2 -2 0.788675 1.000000 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.112702 0.155051 3 0.500000 0.644949 0.887298 1.000000 0.069432 0.088588 0.330009 0.409467 4 0.669991 0.787659 0.930568 1.000000 0.046910 0.057104 0.230765 0.276843 5 0.500000 0.583590 0.769235 0.860240 0.953090 1.000000 +one point at t k to enforce continuity ! 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 10 / 24

  39. Selection of the time grid t k , i t k t k +1 θ k, 3 3 f ( x k , u k ) Collocation points on [0 , 1] : 2 θ k, 2 x k +1 1 x ( θ k , t ) K Legendre Radau 0 θ k, 1 1 0 . 5 1 . 0 θ k, 0 -1 x k 0.211325 0.333333 t k, 0 t k, 1 t k, 2 t k, 3 2 -2 0.788675 1.000000 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.112702 0.155051 Why these points ?!? They deliver an 3 0.500000 0.644949 exact integration for any polynomial P of 0.887298 1.000000 order < 2 K (Legendre) and < 2 K − 1 0.069432 0.088588 (Radau). I.e. for 0.330009 0.409467 4 0.669991 0.787659 x = F ( x , u ) = P ( t ) ˙ 0.930568 1.000000 0.046910 0.057104 the collocation equations deliver an exact 0.230765 0.276843 solution, namely: 5 0.500000 0.583590 � t k +1 0.769235 0.860240 x ( t k +1 , θ k ) = x k + P ( τ ) d τ 0.953090 1.000000 t k +one point at t k to enforce continuity ! 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 10 / 24

  40. Selection of the time grid t k , i t k t k +1 θ k, 3 3 f ( x k , u k ) Collocation points on [0 , 1] : 2 θ k, 2 x k +1 1 x ( θ k , t ) K Legendre Radau 0 θ k, 1 1 0 . 5 1 . 0 θ k, 0 -1 x k 0.211325 0.333333 t k, 0 t k, 1 t k, 2 t k, 3 2 -2 0.788675 1.000000 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.112702 0.155051 Interval [ t k , t k +1 ] ?? 3 0.500000 0.644949 0.887298 1.000000 Rescale & translate the collocation 0.069432 0.088588 points to [ t k , t k +1 ] 0.330009 0.409467 4 0.669991 0.787659 0.930568 1.000000 0.046910 0.057104 0.230765 0.276843 5 0.500000 0.583590 0.769235 0.860240 0.953090 1.000000 +one point at t k to enforce continuity ! 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 10 / 24

  41. Selection of the time grid t k , i t k t k +1 θ k, 3 3 f ( x k , u k ) Collocation points on [0 , 1] : 2 θ k, 2 x k +1 1 x ( θ k , t ) K Legendre Radau 0 θ k, 1 1 0 . 5 1 . 0 θ k, 0 -1 x k 0.211325 0.333333 t k, 0 t k, 1 t k, 2 t k, 3 2 -2 0.788675 1.000000 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.112702 0.155051 Interval [ t k , t k +1 ] ?? 3 0.500000 0.644949 0.887298 1.000000 Rescale & translate the collocation 0.069432 0.088588 points to [ t k , t k +1 ], or... 0.330009 0.409467 4 Modification of the collocation 0.669991 0.787659 equations with h k = t k +1 − t k : 0.930568 1.000000 K � 0.046910 0.057104 θ k , j ˙ P k , j ( t k , i ) = h k F ( θ k , i , u k ) 0.230765 0.276843 j =0 5 0.500000 0.583590 0.769235 0.860240 0.953090 1.000000 +one point at t k to enforce continuity ! 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 10 / 24

  42. Selection of the time grid t k , i t k t k +1 θ k, 3 3 f ( x k , u k ) Collocation points on [0 , 1] : 2 θ k, 2 x k +1 1 x ( θ k , t ) K Legendre Radau 0 θ k, 1 1 0 . 5 1 . 0 θ k, 0 -1 x k 0.211325 0.333333 t k, 0 t k, 1 t k, 2 t k, 3 2 -2 0.788675 1.000000 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.112702 0.155051 Interval [ t k , t k +1 ] ?? 3 0.500000 0.644949 0.887298 1.000000 Rescale & translate the collocation 0.069432 0.088588 points to [ t k , t k +1 ], or... 0.330009 0.409467 4 Modification of the collocation 0.669991 0.787659 equations with h k = t k +1 − t k : 0.930568 1.000000 K � 0.046910 0.057104 θ k , j ˙ P k , j ( t k , i ) = h k F ( θ k , i , u k ) 0.230765 0.276843 j =0 5 0.500000 0.583590 Careful if F is time-dependent ! 0.769235 0.860240 0.953090 1.000000 +one point at t k to enforce continuity ! 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 10 / 24

  43. Selection of the time grid t k , i t k t k +1 θ k, 3 3 f ( x k , u k ) Collocation points on [0 , 1] : 2 θ k, 2 x k +1 1 x ( θ k , t ) K Legendre Radau 0 θ k, 1 1 0 . 5 1 . 0 θ k, 0 -1 x k 0.211325 0.333333 t k, 0 t k, 1 t k, 2 t k, 3 2 -2 0.788675 1.000000 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.112702 0.155051 Interval [ t k , t k +1 ] ?? 3 0.500000 0.644949 0.887298 1.000000 Rescale & translate the collocation 0.069432 0.088588 points to [ t k , t k +1 ], or... 0.330009 0.409467 4 Modification of the collocation 0.669991 0.787659 equations with h k = t k +1 − t k : 0.930568 1.000000 K � 0.046910 0.057104 θ k , j ˙ P k , j ( t k , i ) = h k F ( θ k , i , u k ) 0.230765 0.276843 j =0 5 0.500000 0.583590 Careful if F is time-dependent ! 0.769235 0.860240 0.953090 1.000000 Note that Radau has a collocation point at the end of the interval, i.e. θ k , K provides +one point at t k to enforce continuity ! the end-state of the integration ! 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 10 / 24

  44. Stability & Order Collocation methods are A-stable (i.e. can handle stiff equations). They have no stability limitation on the time intervals h = t k +1 − t k for stiff problems. I.e. even large time steps h = t k +1 − t k allow for capturing steady state and slow dynamics. Radau collocation is additionally L-stable . I.e. it can handle eigenvalues at −∞ . On an interval h k = t k +1 − t k , the integration error is O ( h 2 K k ) for Legendre and O ( h 2 K − 1 ) for Radau. Losing one order is the ”price” for having a collocation point k at t k +1 . The integration error applies to the end-state of the integrator, but not to the intermediate points ! Collocation-based integration is an Implicit Runge-Kutta scheme. Implicit Euler is an order-1 scheme ! 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 11 / 24

  45. Collocation - Sensitivity Collocation constraints... θ k , 0 = x k K � , i = 1 , ..., K � P k , j ( t k , i ) = F � θ k , i , u k θ k , j ˙ j =0 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 12 / 24

  46. Collocation - Sensitivity Collocation constraints... ... can be seen as θ k , 0 = x k c ( x k , u k , θ k ) = 0 K � , i = 1 , ..., K � P k , j ( t k , i ) = F � θ k , i , u k θ k , j ˙ j =0 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 12 / 24

  47. Collocation - Sensitivity Collocation constraints... ... can be seen as θ k , 0 = x k c ( x k , u k , θ k ) = 0 K � , i = 1 , ..., K � Solved by iterating: P k , j ( t k , i ) = F � θ k , i , u k θ k , j ˙ j =0 − 1 ∆ θ k = − ∂ c ( x k , u k , θ k ) c ( x k , u k , θ k ) ∂ θ k 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 12 / 24

  48. Collocation - Sensitivity Collocation constraints... ... can be seen as θ k , 0 = x k c ( x k , u k , θ k ) = 0 K � , i = 1 , ..., K � Solved by iterating: P k , j ( t k , i ) = F � θ k , i , u k θ k , j ˙ j =0 − 1 ∆ θ k = − ∂ c ( x k , u k , θ k ) c ( x k , u k , θ k ) ∂ θ k Integrator function given by: f ( x k , u k ) = x ( θ k , t k +1 ) 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 12 / 24

  49. Collocation - Sensitivity Collocation constraints... ... can be seen as θ k , 0 = x k c ( x k , u k , θ k ) = 0 K � , i = 1 , ..., K � Solved by iterating: P k , j ( t k , i ) = F � θ k , i , u k θ k , j ˙ j =0 − 1 ∆ θ k = − ∂ c ( x k , u k , θ k ) c ( x k , u k , θ k ) ∂ θ k Integrator function given by: f ( x k , u k ) = x ( θ k , t k +1 ) Get sensitivities using: ∂ f ( x k , u k ) = ∂ x ( θ k , t k +1 ) ∂ f ( x k , u k ) = ∂ x ( θ k , t k +1 ) ∂ θ k ∂ θ k , ∂ x k ∂ θ k ∂ x k ∂ u k ∂ θ k ∂ u k 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 12 / 24

  50. Collocation - Sensitivity Collocation constraints... ... can be seen as θ k , 0 = x k c ( x k , u k , θ k ) = 0 K � , i = 1 , ..., K � Solved by iterating: P k , j ( t k , i ) = F � θ k , i , u k θ k , j ˙ j =0 − 1 ∆ θ k = − ∂ c ( x k , u k , θ k ) c ( x k , u k , θ k ) ∂ θ k Integrator function given by: f ( x k , u k ) = x ( θ k , t k +1 ) Get sensitivities using: ∂ f ( x k , u k ) = ∂ x ( θ k , t k +1 ) ∂ f ( x k , u k ) = ∂ x ( θ k , t k +1 ) ∂ θ k ∂ θ k , ∂ x k ∂ θ k ∂ x k ∂ u k ∂ θ k ∂ u k Implicit function theorem states that ∂ c ∂ θ k + ∂ c ∂ c ∂ θ k + ∂ c = 0 , = 0 ∂ θ k ∂ x k ∂ x k ∂ θ k ∂ u k ∂ u k 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 12 / 24

  51. Collocation - Sensitivity Collocation constraints... ... can be seen as θ k , 0 = x k c ( x k , u k , θ k ) = 0 K � , i = 1 , ..., K � Solved by iterating: P k , j ( t k , i ) = F � θ k , i , u k θ k , j ˙ j =0 − 1 ∆ θ k = − ∂ c ( x k , u k , θ k ) c ( x k , u k , θ k ) ∂ θ k Integrator function given by: f ( x k , u k ) = x ( θ k , t k +1 ) Get sensitivities using: ∂ f ( x k , u k ) = ∂ x ( θ k , t k +1 ) ∂ f ( x k , u k ) = ∂ x ( θ k , t k +1 ) ∂ θ k ∂ θ k , ∂ x k ∂ θ k ∂ x k ∂ u k ∂ θ k ∂ u k Implicit function theorem states that ∂ c ∂ θ k + ∂ c ∂ c ∂ θ k + ∂ c = 0 , = 0 ∂ θ k ∂ x k ∂ x k ∂ θ k ∂ u k ∂ u k Hence: − 1 ∂ c − 1 ∂ c ∂ θ k = − ∂ c ∂ θ k = − ∂ c , ∂ x k ∂ θ k ∂ x k ∂ u k ∂ θ k ∂ u k 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 12 / 24

  52. Collocation - Sensitivity Collocation constraints... ... can be seen as θ k , 0 = x k c ( x k , u k , θ k ) = 0 K � , i = 1 , ..., K � Solved by iterating: P k , j ( t k , i ) = F � θ k , i , u k θ k , j ˙ j =0 − 1 ∆ θ k = − ∂ c ( x k , u k , θ k ) c ( x k , u k , θ k ) ∂ θ k Integrator function given by: f ( x k , u k ) = x ( θ k , t k +1 ) Get sensitivities using: ∂ f ( x k , u k ) = ∂ x ( θ k , t k +1 ) ∂ f ( x k , u k ) = ∂ x ( θ k , t k +1 ) ∂ θ k ∂ θ k , ∂ x k ∂ θ k ∂ x k ∂ u k ∂ θ k ∂ u k Implicit function theorem states that ∂ c ∂ θ k + ∂ c ∂ c ∂ θ k + ∂ c = 0 , = 0 − 1 is ∂ θ k ∂ x k ∂ x k ∂ θ k ∂ u k ∂ u k ∂ c Note that ∂ θ k computed in the Newton Hence: − 1 ∂ c − 1 ∂ c iteration, i.e. it comes for ∂ θ k = − ∂ c ∂ θ k = − ∂ c , free !! ∂ x k ∂ θ k ∂ x k ∂ u k ∂ θ k ∂ u k 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 12 / 24

  53. Outline Polynomial interpolation 1 Collocation-based integration 2 Collocation in multiple-shooting 3 Direct Collocation 4 NLP from direct collocation 5 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 13 / 24

  54. Collocation-based integrators in Multiple-shooting Collocation-based integrator solves: c ( x k , u k , θ k ) = 0 on each time interval [ t k , t k +1 ], provides: f ( x k , u k ) = x ( θ k , t k +1 ) with sensitivities. t k t k +1 θ k, 3 f ( x k , u k ) 3 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 14 / 24

  55. Collocation-based integrators in Multiple-shooting NLP with multiple-shooting Collocation-based integrator solves: min Φ ( w ) c ( x k , u k , θ k ) = 0 w   x 0 − ¯ x 0 on each time interval [ t k , t k +1 ], f ( x 0 , u 0 ) − x 1   s.t. g ( w ) = provides:   ...   f ( x N − 1 , u N − 1 ) − x N f ( x k , u k ) = x ( θ k , t k +1 ) where w = { x 0 , u 0 , ..., x N − 1 , u N − 1 , x N } with sensitivities. t k t k +1 θ k, 3 f ( x k , u k ) 3 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 14 / 24

  56. Collocation-based integrators in Multiple-shooting NLP with multiple-shooting Collocation-based integrator solves: min Φ ( w ) c ( x k , u k , θ k ) = 0 w   x 0 − ¯ x 0 on each time interval [ t k , t k +1 ], f ( x 0 , u 0 ) − x 1   s.t. g ( w ) = provides:   ...   f ( x N − 1 , u N − 1 ) − x N f ( x k , u k ) = x ( θ k , t k +1 ) where w = { x 0 , u 0 , ..., x N − 1 , u N − 1 , x N } with sensitivities. t k t k +1 θ k, 3 f ( x k , u k ) 3 NLP solves: 2 θ k, 2 x k +1 ∇ w L ( w , λ ) = 0 1 x ( θ k , t ) g ( w ) = 0 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 14 / 24

  57. Collocation-based integrators in Multiple-shooting NLP with multiple-shooting Collocation-based integrator solves: min Φ ( w ) c ( x k , u k , θ k ) = 0 w   x 0 − ¯ x 0 on each time interval [ t k , t k +1 ], f ( x 0 , u 0 ) − x 1   s.t. g ( w ) = provides:   ...   f ( x N − 1 , u N − 1 ) − x N f ( x k , u k ) = x ( θ k , t k +1 ) where w = { x 0 , u 0 , ..., x N − 1 , u N − 1 , x N } with sensitivities. t k t k +1 θ k, 3 f ( x k , u k ) 3 NLP solves: 2 θ k, 2 x k +1 ∇ w L ( w , λ ) = 0 1 x ( θ k , t ) g ( w ) = 0 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 Collocation-based integrator inside the NLP becomes a two-level Newton scheme !! 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 14 / 24

  58. Collocation-based integrators in Multiple-shooting (cont’) NLP solver ∇ w L ( w , λ ) = 0 g ( w ) = 0 w = { x 0 , u 0 , ..., x N − 1 , u N − 1 , x N } . . . . . . 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 15 / 24

  59. Collocation-based integrators in Multiple-shooting (cont’) NLP level NLP solver Constraints g = 0 ∇ w L ( w , λ ) = 0 Newton iterations g ( w ) = 0 (SQP/IP) w = { x 0 , u 0 , ..., x N − 1 , u N − 1 , x N } . . . . . . 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 15 / 24

  60. Collocation-based integrators in Multiple-shooting (cont’) NLP level NLP solver Constraints g = 0 ∇ w L ( w , λ ) = 0 Newton iterations g ( w ) = 0 (SQP/IP) w = { x 0 , u 0 , ..., x N − 1 , u N − 1 , x N } x 0 , u 0 x k , u k Integrator [ t 0 , t 1 ] Integrator [ t k , t k +1 ] c ( x 0 , u 0 , θ 0 ) = 0 . . . c ( x k , u k , θ k ) = 0 . . . f ( x 0 , u 0 ) = x ( θ 0 , t 1 ) f ( x k , u k ) = x ( θ k , t k +1 ) with sensitivities with sensitivities 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 15 / 24

  61. Collocation-based integrators in Multiple-shooting (cont’) NLP level NLP solver Constraints g = 0 ∇ w L ( w , λ ) = 0 Newton iterations g ( w ) = 0 (SQP/IP) w = { x 0 , u 0 , ..., x N − 1 , u N − 1 , x N } x 0 , u 0 x k , u k Integrator level Integrator [ t 0 , t 1 ] Integrator [ t k , t k +1 ] Constraints c = 0 c ( x 0 , u 0 , θ 0 ) = 0 . . . c ( x k , u k , θ k ) = 0 . . . Newton iterations f ( x 0 , u 0 ) = x ( θ 0 , t 1 ) f ( x k , u k ) = x ( θ k , t k +1 ) with sensitivities with sensitivities 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 15 / 24

  62. Collocation-based integrators in Multiple-shooting (cont’) NLP level NLP solver Constraints g = 0 ∇ w L ( w , λ ) = 0 Newton iterations g ( w ) = 0 (SQP/IP) w = { x 0 , u 0 , ..., x N − 1 , u N − 1 , x N } x 0 , u 0 x k , u k Integrator level Integrator [ t 0 , t 1 ] Integrator [ t k , t k +1 ] Constraints c = 0 c ( x 0 , u 0 , θ 0 ) = 0 . . . c ( x k , u k , θ k ) = 0 . . . Newton iterations f ( x 0 , u 0 ) = x ( θ 0 , t 1 ) f ( x k , u k ) = x ( θ k , t k +1 ) with sensitivities with sensitivities 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 15 / 24

  63. Collocation-based integrators in Multiple-shooting (cont’) NLP level NLP solver Constraints g = 0 ∇ w L ( w , λ ) = 0 Newton iterations g ( w ) = 0 (SQP/IP) w = { x 0 , u 0 , ..., x N − 1 , u N − 1 , x N } x 0 , u 0 x k , u k Integrator level Integrator [ t 0 , t 1 ] Integrator [ t k , t k +1 ] Constraints c = 0 c ( x 0 , u 0 , θ 0 ) = 0 . . . c ( x k , u k , θ k ) = 0 . . . Newton iterations f ( x 0 , u 0 ) = x ( θ 0 , t 1 ) f ( x k , u k ) = x ( θ k , t k +1 ) with sensitivities with sensitivities Constraints are solved at the NLP and at the integrator level separately !! 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 15 / 24

  64. Collocation-based integrators in Multiple-shooting (cont’) NLP level NLP solver Constraints g = 0 ∇ w L ( w , λ ) = 0 Newton iterations g ( w ) = 0 (SQP/IP) w = { x 0 , u 0 , ..., x N − 1 , u N − 1 , x N } x 0 , u 0 x k , u k Integrator level Integrator [ t 0 , t 1 ] Integrator [ t k , t k +1 ] Constraints c = 0 c ( x 0 , u 0 , θ 0 ) = 0 . . . c ( x k , u k , θ k ) = 0 . . . Newton iterations f ( x 0 , u 0 ) = x ( θ 0 , t 1 ) f ( x k , u k ) = x ( θ k , t k +1 ) with sensitivities with sensitivities Constraints are solved at the NLP and at the integrator level separately !! ... what about handling them altogether in the NLP ?!? 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 15 / 24

  65. Outline Polynomial interpolation 1 Collocation-based integration 2 Collocation in multiple-shooting 3 Direct Collocation 4 NLP from direct collocation 5 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 16 / 24

  66. Direct collocation - Give all constraints to the NLP solver On each interval [ t k , t k +1 ] x = F ( x , u k ) ˙ is approximated using: K � x ( θ k , t ) = θ k , i · P k , i ( t ) ���� � �� � i =0 parameters polynomials Note: � � x θ k , i , t k , i = θ k , i K + 1 degrees of freedom per state. t k t k +1 θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) 0 θ k, 1 θ k, 0 -1 x k t k, 0 t k, 1 t k, 2 t k, 3 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 17 / 24

  67. Direct collocation - Give all constraints to the NLP solver On each interval [ t k , t k +1 ] x = F ( x , u k ) ˙ is approximated using: K � x ( θ k , t ) = θ k , i · P k , i ( t ) ���� � �� � i =0 parameters polynomials Note: � � x θ k , i , t k , i = θ k , i K + 1 degrees of freedom per state. Integration constraints ( i = 1 , ..., K ) t k t k +1 � = F � x � θ k , t k , i � , u k ∂ ∂ t x � θ k , t k , i � θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) i.e. 0 K θ k, 1 � θ k, 0 P k , j ( t k , i ) = F � θ k , i , u k � θ k , j ˙ -1 x k t k, 0 t k, 1 t k, 2 t k, 3 j =0 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 17 / 24

  68. Direct collocation - Give all constraints to the NLP solver NLP with direct collocation On each interval [ t k , t k +1 ] min Φ ( w ) w x = F ( x , u k ) ˙     is approximated using:       K s.t. g ( w ) =   �   x ( θ k , t ) = θ k , i · P k , i ( t )     ���� � �� � i =0   parameters polynomials Note: � � x θ k , i , t k , i = θ k , i K + 1 degrees of freedom per state. Integration constraints ( i = 1 , ..., K ) t k t k +1 � = F � x � θ k , t k , i � , u k ∂ ∂ t x � θ k , t k , i � θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) i.e. 0 K θ k, 1 � θ k, 0 P k , j ( t k , i ) = F � θ k , i , u k � θ k , j ˙ -1 x k t k, 0 t k, 1 t k, 2 t k, 3 j =0 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 17 / 24

  69. Direct collocation - Give all constraints to the NLP solver NLP with direct collocation On each interval [ t k , t k +1 ] min Φ ( w ) w x = F ( x , u k ) ˙   θ 0 , 0 − ¯ x 0   is approximated using:       K s.t. g ( w ) =   �   x ( θ k , t ) = θ k , i · P k , i ( t )     ���� � �� � i =0   parameters polynomials Note: � � x θ k , i , t k , i = θ k , i Initial conditions ¯ x 0 K + 1 degrees of freedom per state. Integration constraints ( i = 1 , ..., K ) t k t k +1 � = F � x � θ k , t k , i � , u k ∂ ∂ t x � θ k , t k , i � θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) i.e. 0 K θ k, 1 � θ k, 0 P k , j ( t k , i ) = F � θ k , i , u k � θ k , j ˙ -1 x k t k, 0 t k, 1 t k, 2 t k, 3 j =0 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 17 / 24

  70. Direct collocation - Give all constraints to the NLP solver NLP with direct collocation On each interval [ t k , t k +1 ] min Φ ( w ) w x = F ( x , u k ) ˙   θ 0 , 0 − ¯ x 0 x ( θ 0 , t 1 ) − θ 1 , 0   is approximated using:       K s.t. g ( w ) =   �   x ( θ k , t ) = θ k , i · P k , i ( t )     ���� � �� � i =0   parameters polynomials Note: � � x θ k , i , t k , i = θ k , i Continuity constraints ( ≡ shooting gaps) K + 1 degrees of freedom per state. Integration constraints ( i = 1 , ..., K ) t k t k +1 � = F � x � θ k , t k , i � , u k ∂ ∂ t x � θ k , t k , i � θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) i.e. 0 K θ k, 1 � θ k, 0 P k , j ( t k , i ) = F � θ k , i , u k � θ k , j ˙ -1 x k t k, 0 t k, 1 t k, 2 t k, 3 j =0 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 17 / 24

  71. Direct collocation - Give all constraints to the NLP solver NLP with direct collocation On each interval [ t k , t k +1 ] min Φ ( w ) w x = F ( x , u k ) ˙   θ 0 , 0 − ¯ x 0 x ( θ 0 , t 1 ) − θ 1 , 0   is approximated using: � �  − � K  j =0 θ 0 , j ˙ F θ 0 , i , u 0 P 0 , j ( t 0 , i )     K s.t. g ( w ) =   �   x ( θ k , t ) = θ k , i · P k , i ( t )     ���� � �� � i =0   parameters polynomials Note: � � x θ k , i , t k , i = θ k , i Integration constraints for k = 0 K + 1 degrees of freedom per state. Integration constraints ( i = 1 , ..., K ) t k t k +1 � = F � x � θ k , t k , i � , u k ∂ ∂ t x � θ k , t k , i � θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) i.e. 0 K θ k, 1 � θ k, 0 P k , j ( t k , i ) = F � θ k , i , u k � θ k , j ˙ -1 x k t k, 0 t k, 1 t k, 2 t k, 3 j =0 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 17 / 24

  72. Direct collocation - Give all constraints to the NLP solver NLP with direct collocation On each interval [ t k , t k +1 ] min Φ ( w ) w x = F ( x , u k ) ˙   θ 0 , 0 − ¯ x 0 x ( θ 0 , t 1 ) − θ 1 , 0   is approximated using: � �  − � K  j =0 θ 0 , j ˙ F θ 0 , i , u 0 P 0 , j ( t 0 , i )     K s.t. g ( w ) = ...   �   x ( θ k , t ) = θ k , i · P k , i ( t ) x ( θ k , t k +1 ) − θ k +1 , 0   � − � K   ���� � �� � F � θ k , i , u k j =0 θ k , j ˙ i =0 P k , j ( t k , i )   parameters polynomials ... Note: � � x θ k , i , t k , i = θ k , i Remaining integration constraints k = 1 , ..., N − 1 K + 1 degrees of freedom per state. Integration constraints ( i = 1 , ..., K ) t k t k +1 � = F � x � θ k , t k , i � , u k ∂ ∂ t x � θ k , t k , i � θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) i.e. 0 K θ k, 1 � θ k, 0 P k , j ( t k , i ) = F � θ k , i , u k � θ k , j ˙ -1 x k t k, 0 t k, 1 t k, 2 t k, 3 j =0 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 17 / 24

  73. Direct collocation - Give all constraints to the NLP solver NLP with direct collocation On each interval [ t k , t k +1 ] min Φ ( w ) w x = F ( x , u k ) ˙   θ 0 , 0 − ¯ x 0 x ( θ 0 , t 1 ) − θ 1 , 0   is approximated using: � �  − � K  j =0 θ 0 , j ˙ F θ 0 , i , u 0 P 0 , j ( t 0 , i )     K s.t. g ( w ) = ...   �   x ( θ k , t ) = θ k , i · P k , i ( t ) x ( θ k , t k +1 ) − θ k +1 , 0   � − � K   ���� � �� � F � θ k , i , u k j =0 θ k , j ˙ i =0 P k , j ( t k , i )   parameters polynomials ... Note: Decision variables: � � � � x θ k , i , t k , i = θ k , i w = θ 0 , 0 , ..., θ 0 , K , u 0 , ..., θ N − 1 , 0 , ..., θ N − 1 , K , u N − 1 K + 1 degrees of freedom per state. Integration constraints ( i = 1 , ..., K ) t k t k +1 � = F � x � θ k , t k , i � , u k ∂ ∂ t x � θ k , t k , i � θ k, 3 3 f ( x k , u k ) 2 θ k, 2 x k +1 1 x ( θ k , t ) i.e. 0 K θ k, 1 � θ k, 0 P k , j ( t k , i ) = F � θ k , i , u k � θ k , j ˙ -1 x k t k, 0 t k, 1 t k, 2 t k, 3 j =0 -2 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 17 / 24

  74. Direct Collocation - Example: swing-up of a pendulum M OCP N − 1 θ � u 2 L min k u 0 ,..., u N − 1 k =0 m s.t. x = F ( x , u k ) , ˙ ∀ t ∈ [ t k , t k +1 ] u � � x x (0) = 0 π 0 0 , x ( t f ) = 0 � � ⊤ ˙ x = x θ x ˙ θ 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 18 / 24

  75. Direct Collocation - Example: swing-up of a pendulum M OCP N − 1 θ � u 2 L min k u 0 ,..., u N − 1 k =0 m s.t. x = F ( x , u k ) , ˙ ∀ t ∈ [ t k , t k +1 ] u � � x x (0) = 0 π 0 0 , x ( t f ) = 0 � � ⊤ ˙ x = x θ x ˙ θ N = 20 NLP with direct collocation K = 4 with Legendre, order 8 !! N − 1 420 variables � u 2 min 404 constraints k w k =0   θ 0 , 0 − ¯ x 0 Reminder: x ( θ 0 , t 1 ) − θ 1 , 0   � � K  − � K  j =0 θ 0 , j ˙ � F θ 0 , i , u 0 P 0 , j ( t 0 , i )   x ( θ k , t ) = θ k , i · P k , i ( t )   ...   s.t. g ( w ) = = 0   i =0 x ( θ k , t k +1 ) − θ k +1 , 0     � � − � K x ( θ k , t k , i ) = θ k , i j =0 θ k , j ˙  F θ k , i , u k P k , j ( t k , i )     ...  x ( θ N − 1 , t N ) 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 18 / 24

  76. Direct Collocation - Example: swing-up of a pendulum M OCP N − 1 θ � u 2 L min k u 0 ,..., u N − 1 k =0 m s.t. x = F ( x , u k ) , ˙ ∀ t ∈ [ t k , t k +1 ] u � � x x (0) = 0 π 0 0 , x ( t f ) = 0 � � ⊤ ˙ x = x θ x ˙ θ Newton step 0 15 4.0 3 3.5 2 10 3.0 1 5 2.5 dx 0 θ 0 dt 2.0 −1 u −5 1.5 −2 1.0 −3 −10 0.5 −4 −15 0.0 −5 0.0 0.5 1.0 1.5 2.0 0.0 0.5 1.0 1.5 2.0 −20 1.5 −25 0.0 0.5 1.0 1.5 2.0 2 1.0 0 dθ x K + 1 = 5 dt −2 0.5 all nodes are initialised −4 0.0 −6 −0.5 0.0 0.5 1.0 1.5 2.0 0.0 0.5 1.0 1.5 2.0 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 18 / 24

  77. Direct Collocation - Example: swing-up of a pendulum M OCP N − 1 θ � u 2 L min k u 0 ,..., u N − 1 k =0 m s.t. x = F ( x , u k ) , ˙ ∀ t ∈ [ t k , t k +1 ] u � � x x (0) = 0 π 0 0 , x ( t f ) = 0 � � ⊤ ˙ x = x θ x ˙ θ Newton step 1 15 4.0 3 3.5 2 10 3.0 1 5 2.5 dx 0 θ 0 dt 2.0 −1 u −5 1.5 −2 1.0 −3 −10 0.5 −4 −15 0.0 −5 0.0 0.5 1.0 1.5 2.0 0.0 0.5 1.0 1.5 2.0 −20 1.5 −25 0.0 0.5 1.0 1.5 2.0 2 1.0 0 dθ x K + 1 = 5 dt −2 0.5 all nodes are initialised −4 0.0 −6 −0.5 0.0 0.5 1.0 1.5 2.0 0.0 0.5 1.0 1.5 2.0 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 18 / 24

  78. Direct Collocation - Example: swing-up of a pendulum M OCP N − 1 θ � u 2 L min k u 0 ,..., u N − 1 k =0 m s.t. x = F ( x , u k ) , ˙ ∀ t ∈ [ t k , t k +1 ] u � � x x (0) = 0 π 0 0 , x ( t f ) = 0 � � ⊤ ˙ x = x θ x ˙ θ Newton step 2 15 4.0 3 3.5 2 10 3.0 1 5 2.5 dx 0 θ 0 dt 2.0 −1 u −5 1.5 −2 1.0 −3 −10 0.5 −4 −15 0.0 −5 0.0 0.5 1.0 1.5 2.0 0.0 0.5 1.0 1.5 2.0 −20 1.5 −25 0.0 0.5 1.0 1.5 2.0 2 1.0 0 dθ x K + 1 = 5 dt −2 0.5 all nodes are initialised −4 0.0 −6 −0.5 0.0 0.5 1.0 1.5 2.0 0.0 0.5 1.0 1.5 2.0 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 18 / 24

  79. Direct Collocation - Example: swing-up of a pendulum M OCP N − 1 θ � u 2 L min k u 0 ,..., u N − 1 k =0 m s.t. x = F ( x , u k ) , ˙ ∀ t ∈ [ t k , t k +1 ] u � � x x (0) = 0 π 0 0 , x ( t f ) = 0 � � ⊤ ˙ x = x θ x ˙ θ Newton step 3 15 4.0 3 3.5 2 10 3.0 1 5 2.5 dx 0 θ 0 dt 2.0 −1 u −5 1.5 −2 1.0 −3 −10 0.5 −4 −15 0.0 −5 0.0 0.5 1.0 1.5 2.0 0.0 0.5 1.0 1.5 2.0 −20 1.5 −25 0.0 0.5 1.0 1.5 2.0 2 1.0 0 dθ x K + 1 = 5 dt −2 0.5 all nodes are initialised −4 0.0 −6 −0.5 0.0 0.5 1.0 1.5 2.0 0.0 0.5 1.0 1.5 2.0 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 18 / 24

  80. Direct Collocation - Example: swing-up of a pendulum M OCP N − 1 θ � u 2 L min k u 0 ,..., u N − 1 k =0 m s.t. x = F ( x , u k ) , ˙ ∀ t ∈ [ t k , t k +1 ] u � � x x (0) = 0 π 0 0 , x ( t f ) = 0 � � ⊤ ˙ x = x θ x ˙ θ Newton step 4 15 4.0 3 3.5 2 10 3.0 1 5 2.5 dx 0 θ 0 dt 2.0 −1 u −5 1.5 −2 1.0 −3 −10 0.5 −4 −15 0.0 −5 0.0 0.5 1.0 1.5 2.0 0.0 0.5 1.0 1.5 2.0 −20 1.5 −25 0.0 0.5 1.0 1.5 2.0 2 1.0 0 dθ x K + 1 = 5 dt −2 0.5 all nodes are initialised −4 0.0 −6 −0.5 0.0 0.5 1.0 1.5 2.0 0.0 0.5 1.0 1.5 2.0 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 18 / 24

  81. Direct Collocation - Example: swing-up of a pendulum M OCP N − 1 θ � u 2 L min k u 0 ,..., u N − 1 k =0 m s.t. x = F ( x , u k ) , ˙ ∀ t ∈ [ t k , t k +1 ] u � � x x (0) = 0 π 0 0 , x ( t f ) = 0 � � ⊤ ˙ x = x θ x ˙ θ Newton step 5 15 4.0 3 3.5 2 10 3.0 1 5 2.5 dx 0 θ 0 dt 2.0 −1 u −5 1.5 −2 1.0 −3 −10 0.5 −4 −15 0.0 −5 0.0 0.5 1.0 1.5 2.0 0.0 0.5 1.0 1.5 2.0 −20 1.5 −25 0.0 0.5 1.0 1.5 2.0 2 1.0 0 dθ x K + 1 = 5 dt −2 0.5 all nodes are initialised −4 0.0 −6 −0.5 0.0 0.5 1.0 1.5 2.0 0.0 0.5 1.0 1.5 2.0 18 th of February, 2016 S. Gros Optimal Control with DAEs, lecture 8 18 / 24

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend