Full Text (Pdf)
Total Page:16
File Type:pdf, Size:1020Kb
A Toolchain for Solving Dynamic Optimization Problems Using Symbolic and Parallel Computing Evgeny Lazutkin Siegbert Hopfgarten Abebe Geletu Pu Li Group Simulation and Optimal Processes, Institute for Automation and Systems Engineering, Technische Universität Ilmenau, P.O. Box 10 05 65, 98684 Ilmenau, Germany. {evgeny.lazutkin,siegbert.hopfgarten,abebe.geletu,pu.li}@tu-ilmenau.de Abstract shown in Fig. 1. Based on the current process state x(k) obtained through the state observer or measurement, Significant progresses in developing approaches to dy- resp., the optimal control problem is solved in the opti- namic optimization have been made. However, its prac- mizer in each sample time. The resulting optimal control tical implementation poses a difficult task and its real- strategy in the first interval u(k) of the moving horizon time application such as in nonlinear model predictive is then realized through the local control system. There- control (NMPC) remains challenging. A toolchain is de- fore, an essential limitation of applying NMPC is due to veloped in this work to relieve the implementation bur- its long computation time taken to solve the NLP prob- den and, meanwhile, to speed up the computations for lem for each sample time, especially for the control of solving the dynamic optimization problem. To achieve fast systems (Wang and Boyd, 2010). In general, the these targets, symbolic computing is utilized for calcu- computation time should be much less than the sample lating the first and second order sensitivities on the one time of the NMPC scheme (Schäfer et al., 2007). Al- hand and parallel computing is used for separately ac- though powerful methods are available, e.g. multiple- complishing the computations for the individual time in- shooting (Houska et al., 2011; Kirches et al., 2012) tervals on the other hand. Two optimal control problems and collocation on finite elements (Biegler et al., 2002; are solved to demonstrate the efficiency of the developed Zavala et al., 2008; Word et al., 2014) with simultane- toolchain which solves one of the problems with approx- ous characteristics, control parametrization (Balsa-Canto imately 25,000 variables within a reasonable CPU time. et al., 2000; Barz et al., 2012) with sequential character- Keywords: nonlinear optimization, combined multiple istics, and quasi-sequential technique, (Hong et al., 2006; shooting and collocation, symbolic manipulation, paral- Bartl et al., 2011), the computation speed is not swift lel computing, satellite problem, combined cycle power enough for very fast systems such as mechanical, elec- plant trical and mechatronic systems. Therefore, it is highly desired to further enhance the computation efficiency for solving nonlinear dynamic optimization problems. 1 Introduction The combined multiple-shooting with collocation (CMSC) method (Tamimi and Li, 2010) and the modified Over the last decades nonlinear model predictive control multiple-shooting and collocation (MCMSC) method (NMPC) has been increasingly popular for the control of (Lazutkin et al., 2014) are proved to be highly efficient. complex systems (Mayne, 2014). To carry out NMPC, The efficiency of this method is considerably improved the first step is to formulate a nonlinear optimal control in this work with the following targets: problem. By using a discretization scheme over a pre- • to reduce the computation time by using symbolic diction horizon, it is then transformed into a constrained methods for calculating gradients, Jacobians, and nonlinear programming (NLP) problem. Finally, the re- Hessians, alization of NMPC is made by repeatedly solving this problem online with an NLP solver which requires ap- • to further accelerate the computation by using par- propriate function values and gradients. Although many allel computing facilities, especially for real-time theoretical progresses on NMPC have been achieved, its applications. implementation for real-life applications is certainly not To achieve these aims, this work develops a toolchain trivial. Therefore, a toolchain is developed in this work as described in subsequent sections. In section 2 based on open-source software tools to relieve the bur- the problem will be formulated. Section 3 illustrates dens in the implementation of NMPC. the interior-point solution method with symbolic com- A schematic description of implementing NMPC is putations of first- and second-order derivatives. The DOI Proceedings of the 11th International Modelica Conference 311 10.3384/ecp15118311 September 21-23, 2015, Versailles, France A Toolchain for Solving Dynamic Optimization Problems Using Symbolic and Parallel Computing toolchain, its components, functionality, and some code examples are presented in section 4. The efficiency of Optimizer the toolchain is demonstrated in section 5 by applying it Solving optimal to a satellite control and a large-scale dynamic optimiza- u(k) control problem x(k) tion of a combined cycle power plant. Conclusions of the paper are given in section 6. Local State control system observer 2 Problem description The nonlinear optimal control problem (NOCP) reads Process t f min J = M x(t f ),t f + L(x(t),u(t),t)dt u(t) Zt0 Figure 1. Nonlinear model predictive control (NMPC) scheme s. t. f (x˙(t),x(t),u(t),t)= 0 , t0 ≤ t ≤ t f , x(t0)= x0, x(t f ) fixed or free, g(x(t),u(t),t) ≤ 0, (1) Due to the combined character of the approach to be ap- plied the model equations are not directly integrated in xmin ≤ x(t) ≤ xmax, the NLP formulation (2) but solved to obtain the state umin ≤ u(t) ≤ umax, variables x p,i+1 by a collocation scheme. For detailed description of the NOCP and its transformation to an with t ∈ [t ,t ] - time, t ,t - initial, final time, x(t) ∈ 0 f 0 f NLP refer to (Tamimi and Li, 2010, 2009; Lazutkin et al., Rnx - state variable vector, u(t) ∈ Rnu - control vari- 2014). able vector, x0 - initial state vector, x f - final state vec- tor, f ∈ Rnx+nu → Rnx - implicit differential equation, J - performance index with Mayer and Lagrange term M : Rnx+1 → R and L : Rnx+nu → R, resp., belonging 3 Solution method to corresponding function spaces, g - additional equal- 3.1 Solution of the resulting NLP problem ity and/or inequality constraints, xmin,xmax,umin,umax,- componentwise lower and upper bounds for states x(t) For simplicity reasons the NLP problem (2) is rewritten and controls u(t), resp. in the compact form Envisaging the application of the modified combined multiple shooting and collocation (MCMSC) method, a min{J(ω)} transformation of the infinite-dimensional NOCP (1) to a ω finite-dimensional nonlinear programming (NLP) prob- s. t. E(ω)= 0 , (3) lem is needed. Due to the multiple-shooting technique a S(ω) ≤ 0 , division of the whole time horizon [t0,t f ] into N time in- tervals, so called shooting intervals has to be performed. where ω contains all optimization variables, E all equal- The controls are assumed to be constant in each shooting ity, and S all inequality constraints. interval and are parametrized, i.e. the control vector is The NLP (4) can be solved using an interior-point T composed as V =[v0 v1 ... vN−1] , nu = nv. The states optimization solver (e. g. Ipopt (Wächter and Biegler, are also discretized and parametrized at the shooting in- p 2006)). Hence, the barrier function formulation of the terval boundaries, i.e. the vector X =[x p,0 x p,1 ... x p,N] NLP reads is constructed and equality constraints for continuity rea- sons are taken into account. All other restrictions are nS correspondingly discretized. min J(ω) − µ ∑ ln(z j) ω,z This leads to the NLP notation ( j=1 ) s. t. E(ω)= 0, (4) N−1 ti+1 S(ω)+ z = 0, min M (x p,N)+ ∑ L(x(t),vi)dt X p,V ( i=0 Zti ) with a slack variable z and the corresponding Lagrange s. t. x = x (t ;x ,v ), i = 0,..., N − 1, p,i+1 i+1 p,i i function x p,0 = x0, g¯(X p,V ) ≤ 0, (2) nS L ω,z,λ J ω z λ E T E ω p (ω λ ) = (ω) − µ ∑ ln( j)+(λ ) (ω) x¯min ≤ X ≤ x¯max j=1 u¯ min ≤ V ≤ u¯ max . +(λ S)T (S(ω)+ z) (5) 312 Proceedings of the 11th International Modelica Conference DOI September 21-23, 2015, Versailles, France 10.3384/ecp15118311 Session 4A: Optimization Applications and Methods for a fixed value of the barrier parameter µ. The vector The derivative of the collocation polynomial reads T E S λ λ T , λ T RnE +nS λ = [(λ ) (λ ) ] ∈ contains multipliers asso- nc dx(t) dl j(t) c ciated with the nE + nS equality constraints. The iteration = ∑ x (10) dt dt j scheme of the interior-point algorithm is j=1 b nc t −tk ω l+1 = ω l + αl · ∆ω l, zl+1 = ω l + αl · ∆zl, with l j(t) = ∏ k=1,k6= j t j −tk λ l+1 = λ l + αl · ∆λ l, l = 0,1,... (6) The parametrized states can be put into a vector X p,q E S q The different search directions ∆ω l, ∆zl, ∆λ l , ∆λ l are and the controls into a vector V , where q = 1,2,...,N. obtained applying the Newton method to the KKT opti- The components of the vectors X p,q and V q are included mality conditions of problem (4). Let Z = diag(z) and in the decision variables X p and V , respectively, in the eT =(1,...,1) ∈ RnS . Thus, the following system needs NLP formulation. Furthermore, the vector X c,q repre- to be solved at each iteration step sents all collocation coefficients in the shooting interval q.