A Toolkit for AMPL Control Optimization
Total Page:16
File Type:pdf, Size:1020Kb
ARGONNE NATIONAL LABORATORY 9700 South Cass Avenue Argonne, Illinois 60439 TACO — A Toolkit for AMPL Control Optimization Christian Kirches and Sven Leyffer Mathematics and Computer Science Division Preprint ANL/MCS-P1948-0911 November 4, 2011 The research leading to these results has received funding from the European Union Seventh Framework Programme FP7/2007-2013 under grant agreement no FP7-ICT-2009-4 248940. The first author acknowledges a travel grant by Heidelberg Graduate Academy, funded by the German Excellence Initiative. We thank Hans Georg Bock, Johannes P. Schlöder, and Sebastian Sager for permission to use the optimal control software package MUSCOD-II and the mixed-integer optimal control algorithm MS-MINTOC. This work was also supported by the Office of Advanced Scientific Computing Research, Office of Science, U.S. Department of Energy, under Contract DE-AC02-06CH11357, and by the Directorate for Computer and Information Science and Engineering of the National Science Foundation under award NSF-CCF-0830035. Contents 1 Introduction...................................................................1 1.1 The AMPL Modeling Language.....................................................3 1.2 Benefits of AMPL Extensions......................................................3 1.3 Related Efforts..............................................................3 1.4 Contributions and Structure........................................................3 2 AMPL Extensions for Optimal Control.....................................................4 2.1 Modeling Optimal Control Problem Variables..............................................5 2.2 Modeling Optimal Control Problem Constraints.............................................6 2.3 Modeling Optimal Control Problem Objectives.............................................7 2.4 Universal Header File for Optimal Control Problems..........................................7 3 Examples of Optimal Control Models in AMPL................................................8 3.1 Example from the COPS Library of Optimal Control Problems.....................................8 3.2 Mixed-Integer ODE-Constrained Example................................................9 3.3 AMPL Models of Optimal Control Problems in the mintoc.de Collection............................... 10 4 TACO Toolkit for AMPL Control Optimization................................................ 11 4.1 Implementations of the New User Functions............................................... 12 4.2 Consistency Checks............................................................ 13 4.3 User Diagnosis of the Detected Optimal Control Problem Structure................................... 14 4.4 Output of Time–Dependent Solution Variables.............................................. 15 5 Using TACO to Interface AMPL to MUSCOD-II and MS-MINTOC..................................... 16 5.1 Direct Multiple Shooting Method for Optimal Control.......................................... 16 5.2 Sensitivity Computation and Automatic Derivatives........................................... 17 5.3 Additional Information on Derivatives.................................................. 18 5.4 MUSCOD-II Solver Options and AMPL Suffixes............................................ 19 6 Limitations and Possible Further Extensions.................................................. 20 7 Conclusions and Outlook............................................................ 21 A TACO Data Structures Exposed to Optimal Control Problem Solvers..................................... 22 A.1 Data Structures Mapping from AMPL to Optimal Control........................................ 22 A.2 Data Structures Mapping from Optimal Control to AMPL........................................ 23 B TACO Functions Exposed to Optimal Control Problem Solvers........................................ 26 C TACO Toolkit Error Messages......................................................... 28 ii Mathematical Programming Computation manuscript No. (will be inserted by the editor) TACO — A Toolkit for AMPL Control Optimization Christian Kirches · Sven Leyffer November 4, 2011 Abstract We describe a set of extensions to the AMPL modeling language to conveniently model mixed-integer opti- mal control problems for ODE or DAE dynamic processes. These extensions are realized as AMPL user functions and suffixes and do not require intrusive changes to the AMPL language standard or implementation itself. We describe and provide TACO, a Toolkit for AMPL Control Optimization that reads AMPL stub.nl files and detects the structure of the optimal control problem. This toolkit is designed to facilitate the coupling of existing optimal control software packages to AMPL. We discuss requirements, capabilities, and the current implementation. Using the example of the multiple shooting code for optimal control MUSCOD-II, a direct and simultaneous method for DAE-constrained opti- mal control, we demonstrate how the problem information provided by the TACO toolkit is interfaced to the solver. In addition, we show how the MS-MINTOC algorithm for mixed-integer optimal control can be used to efficiently solve mixed-integer optimal control problems modeled in AMPL. We use the AMPL extensions to model three exemplary control problems and we discuss how those extensions affect the representation of optimal control problems. Solutions to these problems are obtained by using MUSCOD-II and MS-MINTOC inside the AMPL environment. A collection of further AMPL control models is provided on the web site mintoc.de. MUSCOD-II and MS-MINTOC are made available on the NEOS Server for Optimization, using the TACO toolkit to enable input of AMPL models. Keywords Mixed-Integer Optimal Control, Differential-Algebraic Equations, Domain Specific Languages, Mathematical Modeling 1 Introduction This paper describes a set of extensions to the AMPL modeling language that extends AMPL’s applicability to mathe- matical optimization problems including dynamic processes. We describe and implement AMPL syntax elements for convenient modeling of ordinary differential equation (ODE) and differential algebraic equation (DAE) constrained optimal control problems. C. Kirches Interdisciplinary Center for Scientific Computing (IWR), Heidelberg University, Im Neuenheimer Feld 368, 69120 Heidelberg, GERMANY. Ph.: +49 (6221) 54-8895; Fax: +49 (6221) 54-5444; E-mail: [email protected] S. Leyffer Mathematics and Computer Science Division, Argonne National Laboratory, 9700 South Cass Avenue, Argonne, IL 60439, U.S.A. We consider the class (1) of mixed-integer optimal control problems on the time horizon [0;T]. Our goal is to minimize an objective function that includes an integral Lagrange term L on [0;T], a Mayer term E at the end point T of the time horizon, and a point least-squares term with Nlsq possibly nonlinear residuals li on a grid ftig1≤i≤Nlsq of time n n points. All objective terms depend on the trajectory (x(·);z(·)) : [0;T] ! R x × R z of a dynamic process described in n terms of a system of ODEs (1b) or DAEs (1b, 1c). This system is affected by continuous controls u(·) : [0;T] ! R u 1 nWw nw and integer-valued controls w(·) : [0;T] ! Ww from a finite discrete set Ww := fw ;:::;w g ⊂ R , jWwj = nWw < ¥ (1h). Both control profiles are subject to optimization. Moreover, we allow the end time T (1g), the continuous model np 1 nW n parameters p 2 R , and the discrete–valued model parameters r 2 Wr := fr ;:::;r r g ⊂ R r , jWr j = nr < ¥ (1i) to be subject to optimization as well. Control, parameters, and process trajectory may be constrained by inequality path eq in constraints c(·) (1d), equality constraints rc (·) and inequality constraints rc (·) coupled in time (1e), and decoupled eq in equality and inequality constraints ri (·), ri (·), 1 ≤ i ≤ nr (1f), imposed on a grid ftig1≤i≤Nr of time points on time horizon [0;T]. This constraint grid need not coincide with the point least-squares grid. Constraints (1d)–(1f) include initial values and boundary values; mixed state-control constraints; periodicity constraints; and simple bounds on states, controls, and parameters. The optimal control problem is conveniently expressed as follows: Z T minimize L(t;x(t);z(t);u(t);w(t); p;r) dt + E(T;x(T);z(T); p;r) (1a) x(·);u(·);w(·); t=0 p;r;T N + lsq jjl (t ;x(t );z(t );u(t );w(t ); p; )jj2 t 2 [ ;T]; ∑i=1 i i i i i i r 2, i 0 subject tox ˙(t) = f (t;x(t);z(t);u(t);w(t); p;r); t 2 [0;T]; (1b) 0 = g(t;x(t);z(t);u(t);w(t); p;r); t 2 [0;T]; (1c) 0 ≤ c(t;x(t);z(t);u(t);w(t); p;r); t 2 [0;T]; (1d) eq 0 = rc (x(0);z(0);x(T);z(T); p;r); (1e) in 0 ≤ rc (x(0);z(0);x(T);z(T); p;r); eq 0 = ri (x(ti);z(ti); p;r); ti 2 [0;T]; 1 ≤ i ≤ Nr; (1f) in 0 ≤ ri (x(ti);z(ti); p;r); Tmin ≤ T ≤ Tmax; (1g) w(t) 2 Ww; t 2 [0;T]; (1h) r 2 Wr : (1i) Direct and simultaneous methods for tackling the class of optimization problems (1) posed in function spaces are based on the first-discretize-then-optimize approach. A discretization scheme is chosen and applied to objective (1a), dynamics (1b, 1c), and path constraints (1d) of the optimization problem in order to obtain a finite-dimensional counterpart problem accessible to mathematical programming algorithms. This counterpart problem will usually be a high-dimensional and highly structured nonlinear problem (NLP) or mixed-integer nonlinear problem (MINLP). Thus, it readily falls into the domain of applicability of many mathematical optimization software packages already interfaced with AMPL, such as ALGENCAN [5,6], filterSQP [26],