ICLOCS2: Solve Your Optimal Control Problems with Less Pain
Total Page:16
File Type:pdf, Size:1020Kb
ICLOCS2: Solve your optimal control problems with less pain Yuanbo Nie ∗ Omar Faqir ∗∗ Eric C. Kerrigan ∗;∗∗ ∗ Department of Aeronautics, Imperial College London, UK (e-mail: [email protected]). ∗∗ Department of Electrical and Electronic Engineering, Imperial College London, UK (e-mails: [email protected], [email protected]) Abstract: ICLOCS2 is the new version of ICLOCS (pronounced `eye-clocks') and is a comprehensive software suite for solving nonlinear optimal control problems (OCPs) in Matlab and Simulink. The toolbox builds on a wide selection of numerical methods and automated tools to assist the design and implementation of OCPs. The aim is to reduce the requirements on the experience of the user, by providing a first port of call to solve a variety of OCPs. ICLOCS2 may not be the fastest solver for some problems, but it might work where other solvers fail. Keywords: Optimal control, trajectory optimization, direct transcription, orthogonal collocation, nonlinear model predictive control EXTENDED ABSTRACT Overview To enable the level of flexibility required, ICLOCS2 is Development Background equipped with state-of-the-art transcription methods and discretization methods (h/p/hp-adaptive) to transform the OCPs into large NLP problems with sparsity patterns Many existing OCP software packages are designed for off- that can be exploited. The users can then choose their line trajectory optimization, thus they pursue the most favourite NLP solver for robustly solving ill=conditioned accurate result at a high computational cost. Instead, problems as well as benefiting from faster warm starts. ICLOCS2 is designed to enable flexible trade-offs be- ICLOCS2 also allows various ways of supplying derivative tween accuracy and computational effort, aiming at bridg- information via analytical and numerical means. Addition- ing the gap between solving OCPs off-line and real-time ally, there are various built-in tools that can be used to optimization-based control methods, such as nonlinear improve the efficiency of the algorithms. See Table 1 for model predictive control (NMPC). an overview of the methods available in ICLOCS2. For practical optimal control problems, it is often difficult Results to anticipate beforehand which discretization scheme and which family of nonlinear programming (NLP) solvers are The capabilities and efficiency of ICLOCS2 have been better suited. The choice hinges on the required level tested and verified on various classical and modern ap- of accuracy, computational time and resources available, plications in the aerospace, automotive, robotics and com- and inherent characteristics of the solution (continuity, munication domains. As for efficiently solving OCPs, for differentiability, etc.). Inappropriate selection of the un- example, ICLOCS2 is able to solve the classical supersonic derlying solution method may result in poor accuracy and aircraft minimum-time-to-climb problem (Betts, 2010) to computational efficiency. a pre-defined accuracy level at least 20 times faster than The future trend is to implement optimal control problems the previous version of ICLOCS. in real-time in closed-loop. This further exacerbates the In many problems, time-optimal solutions exhibit a dis- challenges associated with the selection of methods. With continuity, often in the form of a \bang-bang" input. Con- the states and controls evolving under the influence of ventionally, accurately capturing this switching behaviour uncertainties, it becomes very difficult to test all possible requires mesh refinement iterations, by adding mesh points problem formulations beforehand. Therefore, the capabil- and/or changing the polynomial orders. With the new flex- ity to quickly identify and implement a good strategy ible mesh method in ICLOCS2, the placement of intervals becomes essential in efficiently solving the OCP. Existing can be automatically adjusted during the optimization OCP solvers, e.g. GPOPS-II (Patterson and Rao, 2014) process to accommodate this discontinuity. and ACADO (Houska et al., 2011), often require commit- ments to certain discretization schemes and NLP solvers As a simple example, Figure 1 shows the solution to at an early stage, making subsequent changes expensive the double-integrator minimum-time repositioning prob- and time-consuming. lem. This has the same problem formulation as in Betts Table 1. Methods available in ICLOCS2 Transcription Direct multiple shooting Direct collocation Method Discretization Euler Trapezoidal Hermite-Simpson Legendre-Gauss-Radau∗ Method NLP Solver IPOPT fmincon WORHP∗ Supported (W¨achter and Biegler, 2006) (MathWorks, 2017) (B¨uskens and Wassel, 2013) Jacobian Algorithmic differentiation (forward) User defined Finite difference Calculation with Adigator*(Weinstein and Rao, 2017) Algorithmic differentiation (forward) User defined Finite difference Hessian with Adigator*(Weinstein and Rao, 2017) Approximation Limited memory BFGS Limited-Memory Damped-BFGS with IPOPT with built-in SQP* Automatic scaling* Solution reconstruction* Mesh refinement* Flexible hp mesh* Tools Efficient implementation of rate Automatic meshing Available constraints*(Nie and Kerrigan, 2018b) (h/p/hp-adaptive)* Closed-loop simulations (Matlab & Simulink)* * New functionalities compared to the previous version. 300 1 Edition. Advances in Design and Control. Society for Position [m] Industrial and Applied Mathematics. Velocity [m/s] 200 0 B¨uskens, C. and Wassel, D. (2013). The esa nlp solver worhp. In G. Fasano and J. Pint´er(eds.), Modeling and Optimization in Space Engineering, volume 73, 85{110. 100 -1 hp mesh Springer New York. flexible hp mesh Houska, B., Ferreau, H., and Diehl, M. (2011). Acado 0 -2 0 10 20 30 0 10 20 30 toolkitan open-source framework for automatic control and dynamic optimization. Optimal Control Applica- (a) States (b) Input tions and Methods, 32(3), 298{312. MathWorks (2017). Find minimum of constrained nonlin- Fig. 1. Time-optimal solution for double integrator reposi- ear multivariable function - MATLAB fmincon. tioning problem obtained with a flexible mesh, using Nie, Y. and Kerrigan, E. (2018). How should rate con- an hp-adaptive method straints be implemented in nonlinear optimal control (2010, Ex. 4.11), but with different initial and terminal solvers? Submitted to 6th IFAC Conference on Non- conditions, and variable bounds. We start with five equally linear Model Predictive Control. spaced mesh points, each with a polynomial degree of six. Palma, V.G., Suardi, A., and Kerrigan, E.C. (2015). As the NLP converges, the mesh intervals and collocation Sensitivity-based multistep mpc for embedded systems. points start to gather around the control switching time IFAC-PapersOnLine, 48(23), 360{365. instance, accurately capturing this discontinuity in the Patterson, M. and Rao, A. (2014). GPOPS-II: A MAT- optimal solution at 20 s. LAB software for solving multiple-phase optimal con- trol problems using hp-adaptive gaussian quadrature For closed-loop design with Simulink, ICLOCS2 supports collocation methods and sparse nonlinear programming. classical NMPC implementations, as well as variants such ACM Transactions on Mathematical Software (TOMS), as multi-step MPC (Palma et al., 2015) and advanced- 41(1), 1. multi-step MPC (Yang and Biegler, 2013), where the op- W¨achter, A. and Biegler, L. (2006). On the implemen- timal control solution is updated at a lower rate compared tation of an interior-point filter line-search algorithm to control input updates. for large-scale nonlinear programming. Mathematical ACKNOWLEDGEMENTS Programming, 106(1), 25{57. doi:10.1007/s10107-004- 0559-y. Support of the EPSRC Centre for Doctoral Training in Weinstein, M. and Rao, A. (2017). Algorithm 984: Adi- High Performance Embedded and Distributed Systems gator, a toolbox for the algorithmic differentiation of (HiPEDS, Grant Reference EP/L016796/1) is gratefully mathematical functions in matlab using source trans- acknowledged. formation via operator overloading. ACM Transactions on Mathematical Software (TOMS), 44(2), 21. REFERENCES Yang, X. and Biegler, L.T. (2013). Advanced-multi-step Betts, J. (2010). Practical Methods for Optimal Control nonlinear model predictive control. Journal of process and Estimation Using Nonlinear Programming: Second control, 23(8), 1116{1128..