logo资料库

gpops2QuickReference.pdf

第1页 / 共62页
第2页 / 共62页
第3页 / 共62页
第4页 / 共62页
第5页 / 共62页
第6页 / 共62页
第7页 / 共62页
第8页 / 共62页
资料共62页,剩余部分请下载后查看
Introduction to the General-Purpose Software GPOPS-II
Radau Pseudospectral Method Employed by GPOPS-II
Organization of GPOPS-II
Color Highlighting Throughout Document
Constructing an Optimal Control Problem Using GPOPS-II
Syntax for Input Structure bluesetup
Syntax for Structure redsetup.bluefunctions
Syntax for bluebounds Structure
Syntax of Endpoint Function redsetup.bluefunctions.blueendpoint
Syntax for Continuous Function redsetup.bluefunctions.bluecontinuous
Specifying an Initial Guess of The Solution
Scaling of Optimal Control Problem
Output from an Execution of GPOPS-II
Useful Information for Debugging a GPOPS-II Problem
GPOPS-II Examples
Hyper-Sensitive Problem
Multiple-Stage Launch Vehicle Ascent Problem
Tumor-Antiangiogenesis Optimal Control Problem
Reusable Launch Vehicle Entry
Minimum Time-to-Climb of a Supersonic Aircraft
Two-Strain Tuberculosis Optimal Control Problem
Concluding Remarks
GPOPS − II Version 1.0: A General-Purpose MATLAB Toolbox for Solving Optimal Control Problems Using the Radau Pseudospectral Method Michael A. Patterson Anil V. Rao University of Florida Gainesville, FL 32611-6250 USA January 2013
2 Preface GPOPS − II is a general-pupose software for solving nonlinear optimal control problems that arise in a wide variety applications including engineering, economics, and medicine. GPOPS − II uses some of the latest advancements in the area of pseudospectral methods for solving optimal control problems. GPOPS − II em- ploys an hp-adaptive Radau pseudospectral Gaussian quadrature method where the collocation is performed at the Legendre-Gauss-Radau quadrature points. GPOPS − II has been designed to work with the nonlinear programming (NLP) solvers SNOPT and IPOPT, and MATLAB mex files for both SNOPT and IPOPT are included with the software. GPOPS − II employs sparse finite-differencing to estimate all first and second derivatives required by the NLP solver. The software has been designed to be extremely flexible, allowing a user to formulate an optimal control problem in a way that makes sense for the problem being solved. Few, if any, restrictions have been placed on the manner in which a problem needs to be modeled. As stated, the software is general-purpose, that is, it has not been developed for any specific type of problem. While the developers of GPOPS − II make no guarantee as to the fitness of the software for any particular purpose, it is certainly hoped that software is useful for a variety of applications. Complete Overhaul from Previous Versions of GPOPS GPOPS − II represents a complete overhaul from the GPOPS software that was released between 2008 and 2012. Specifically, this new software, GPOPS − II, is organized in a completely different manner from GPOPS and has significantly more functionality from GPOPS. Furthermore, GPOPS − II does not maintain backward compatibility with GPOPS. While the authors of GPOPS − II realize that the lack of backward compatibility may be inconvenient for some users, the increased power and functionality of GPOPS − II will make it worth the short term inconvenience of the transition. In order to have as smooth a transition as possible to the new software, the authors of GPOPS − II are happy to assist users of GPOPS in rewriting their code for GPOPS − II. Acknowledgments The authors gratefully acknowledge support for this research from the U.S. Office of Naval Research (ONR) under Grant N00014-11-1-0068 and from the U.S. Defense Advanced Research Projects Agency (DARPA) Under Contract HR0011-12-0011. Disclaimer The views expressed are those of the authors and do not reflect the official policy or position of the Depart- ment of Defense or the U.S. Government. Furthermore, the contents of this document and the corresponding software are provided “as is” without any merchantability or fitness for any particular application. Neither authors nor their employers (past, present, or future) assume any responsibility whatsoever from any harm resulting from the software. The authors do, however, hope that users will find this software useful for research and other purposes. Licensing Agreement By downloading, using, modifying, or distributing GPOPS2, you agree to the terms of this license agreement. This license gives you extremely GENEROUS RIGHTS, so if you do not agree to the terms of this agreement, you may not proceed further with using, using, modifying, or distributing GPOPS2. License for GPOPS − II Software PLEASE READ THE FOLLOWING TERMS AND CONDITIONS CAREFULLY BEFORE PROCEED- ING TO DOWNLOAD GPOPS − II!
3 This page constitutes the official license for the General-Purpose Pseudospectral Optimal Control Soft- ware (hereafter referred to as GPOPS − II). By downloading, using, modifying, or distributing GPOPS − II you are agreeing to all of the the terms and conditions described henceforth. Do not proceed with the download of GPOPS − II you do not agree with any of the terms and conditions in this agreement. If you are either a student or employee at an academic institution (that is, K-12 or degree-granting higher- learning institution), an employee at a not-for-profit, or an employee of the U.S. Federal Government or U.S. State Government, GPOPS − II is available free-of-charge provided you are using it for non-commercial research and development. This free-of-charge non-commercial use license comes with the following rules: • You may use the software for any non-commercial purpose • You may make derivative works of the software (called a Derived Work), and you may copy and distribute any such Derived Work provided that the Derived Work is also for non-commercial purposes • If you distribute GPOPS − II or any Derived Work, you are required to provide any changes made to the source code to the authors of GPOPS − II so that we may include these changes in a future release if we find the changes useful • You must leave all existing copyright notices, warranty disclaimers, and license terms in place in any changes that you make • You may not add any restrictions beyond that of this license agreement in any Derived Work • You must conspicuously announce that the changes you have made are available under the original license for GPOPS − II • You must provide assurance that you will not make a profit of any kind from the distribution or re-distribution of GPOPS − II If you are an employee at a profit-making institution, the download and use of GPOPS − II requires a licensing fee, and this fee structure applies regardless of the kind of work being performed at your profit- making institution. The commercial licensing fee structure is as follows: • Individual License: $1000.00 for first-time purchase of any version of GPOPS − II; $200.00 for the purchase of any upgrade to a future major release. • Site-Wide Commercial License (Use at a Single Location): $5000.00 for first time purchase of any version of GPOPS − II; $1000.00 for the purchase of any upgrade to a future major release. • Company-Wide Commercial License: $10000.00 for first time purchase of any version of GPOPS − II; $2000.00 for the purchase of any upgrade to a future major release. DISCLAIMER: GPOPS − II is provided as-is with no warranties, none of any kind. Furthermore, the authors may not be held liable for any use of GPOPS − II, and you may not recover any damages for any reason whatsoever. Distribution of GPOPS − II GPOPS − II is a completely free software both for use and for redistribution. Furthermore, while it may be used within commercial organizations, it is not for sale or resale. The only exception to the sales restriction above is that GPOPS − II may be included as a part of a free open-source software (for example, a distribution of the Linux operating system). When distributing GPOPS − II with a free operating system, no fee beyond the price of the operating system itself may be added (that is, you cannot profit from the redistribution of GPOPS − II). GPOPS − II is not for commercial use with the exception that it may be used by commercial organizations for internal research and development. Any use of GPOPS − II by commercial organizations that involve the presentation of results for profit-making purposes is strictly prohibited. In addition, there are some things that you must shoulder: • You get no warranties of any kind;
4 • If the software damages you in any way, you may only recover direct damages up to the amount you paid for it (that is, you get zero if you did not pay anything for the software); • You may not recover any other damages, including those called ”consequential damages.” (The state or country where you live may not allow you to limit your liability in this way, so this may not apply to you). The GPOPS − II License continues perpetually, except that your license rights end automatically if • You do not abide by the ”give back to the community” terms (your licensees get to keep their rights if they abide); • Anyone prevents you from distributing the software under the terms of this license agreement. • You sell the software in any manner with the one exception listed above. GPOPS − II is provided “as is” without warranty of any kind, expressed or implies, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or dealings in the software.
CONTENTS Contents 1 Introduction to the General-Purpose Software GPOPS − II 1.1 Radau Pseudospectral Method Employed by GPOPS − II . . . . . . . . . . . . . . . . . . . . 1.2 Organization of GPOPS − II . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 Color Highlighting Throughout Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Constructing an Optimal Control Problem Using GPOPS − II 2.1 Syntax for Input Structure setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Syntax for Structure setup.functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3 Syntax for bounds Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4 Syntax of Endpoint Function setup.functions.endpoint . . . . . . . . . . . . . . . . . . . . . 2.5 Syntax for Continuous Function setup.functions.continuous . . . . . . . . . . . . . . . . . 2.6 Specifying an Initial Guess of The Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.7 Scaling of Optimal Control Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Output from an Execution of GPOPS − II 4 Useful Information for Debugging a GPOPS − II Problem 5 GPOPS − II Examples 5.1 Hyper-Sensitive Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Multiple-Stage Launch Vehicle Ascent Problem . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3 Tumor-Antiangiogenesis Optimal Control Problem . . . . . . . . . . . . . . . . . . . . . . . . 5.4 Reusable Launch Vehicle Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5 Minimum Time-to-Climb of a Supersonic Aircraft . . . . . . . . . . . . . . . . . . . . . . . . . 5.6 Two-Strain Tuberculosis Optimal Control Problem . . . . . . . . . . . . . . . . . . . . . . . . 6 Concluding Remarks 5 6 6 6 7 7 7 8 9 10 11 12 12 12 13 13 13 18 32 36 42 55 61
1 Introduction to the General-Purpose Software GPOPS − II 6 A P -phase optimal control problem can be stated in the following general form. Determine the state, y(p)(t) ∈ Rn(p) , in each phase p ∈ [1, . . . , P ], and the static parameters, s ∈ Rns , that minimize the cost functional f ∈ R, integrals, q(p) ∈ Rn(p) 0 ∈ R, final time, t(p) y , control, u(p)(t) ∈ Rn(p) u , initial time, t(p) q J = φhy(1)(t(1) 0 ), . . . , y(P )(t(P ) 0 ), t(1) 0 , . . . , t(P ) 0 , y(1)(t(1) f ), . . . , y(P )(t(P ) f ), t(1) f , . . . , t(P ) f , q(1), . . . , q(P ), si (1) subject to the dynamic constraints ˙y(p) = a(p)hy(p), u(p), t(p), si , (p = 1, . . . , P ), (2) the event constraints min ≤ bhy(1)(t(1) b(g) 0 ), . . . , y(P )(t(P ) 0 ), t(1) 0 , . . . , t(P ) 0 f ), . . . , y(P )(t(P ) , y(1)(t(1) (g = 1, . . . , G), f ), t(1) f , . . . , t(P ) f , q(1), . . . , q(P ), si ≤ b(g) max, the inequality path constraints min ≤ c(p)hy(p), u(p), t(p), si ≤ c(p) c(p) max, (p = 1, . . . , P ), and the integral constraints q(p) min ≤ q(p) ≤ q(p) max, (p = 1, . . . , P ) where q(p) i = Z t(p) f t(p) 0 Qihy(p), u(p), t(p), si dt, (i = 1, . . . , n(p) q ; p = 1, . . . , P ). (3) (4) (5) (6) While much of the time a user may want to solve a problem consisting of multiple phases, it is important to note that the phases need not be sequential. To the contrary, any two phases may be linked provided that the independent variable does not change direction (i.e., the independent variable moves in the same direction during each phase that is linked). 1.1 Radau Pseudospectral Method Employed by GPOPS − II The method employed by GPOPS − II is an hp-adaptive version of the Radau pseudospectral method. The Radau pseudospectral method is an orthogonal collocation Gaussian quadrature implicit integration method where collocation is performed at the Legendre-Gauss-Radau points. The theory behind the Radau pseu- dospectral method used in GPOPS − II can be found in Refs. 1, 2, 3, and 4. 1.2 Organization of GPOPS − II GPOPS − II is organized as follows. In order to specify the optimal control problem that is to be solved, the user must write the following MATLAB functions: (1) an endpoint function; and (2) a continuous function. The endpoint function defines how the the start and/or terminus in any of the phases in the problem, the integrals in any phase of the problem and the static parameters are related to one another. The endpoint function also defines the cost to be minimized. The continuous function defines the evolution of the dynamics in any phase of the problem, the integrands that are required to compute any integrals in any phase of the problem, and any path constraints in any phase of the problem. Next, the user must specify the lower and upper limits on the following quantities: (1) the time at the start and terminus of a phase; (2) the state at the start of a phase, during a phase, and at the terminus of a phase; (3) the control during a phase;
1.3 Color Highlighting Throughout Document 7 (4) the path constraints (5) the event constraints; (6) the static parameters. The remainder of this document is devoted to describing in detail the MATLAB syntax for describing the optimal control problem and each of the constituent functions. 1.3 Color Highlighting Throughout Document The following notation is adopted for use throughout the remainder of this document. First, all user-specified names will be denoted by red slanted characters. Second, any item denoted by blue boldface characters are pre-defined and cannot be changed by the user. Users who do not have color rendering capability will see only slanted and boldface characters, respectively. 2 Constructing an Optimal Control Problem Using GPOPS − II We now proceed to describe the constructs required to specify an optimal control problem in GPOPS − II. We note that the key MATLAB programming elements used in constructing an optimal control problem in GPOPS − II are structure and arrays of structures. In this Section we provide the details of constructing a problem using GPOPS − II. First, the call to GPOPS − II s given as output=gpops2(input), where input is a user-defined structure that contains all of the information about the optimal control problem to be solved and output is a structure that contains the information obtained by solving the optimal control problem. In this section we describe the contents of the structures input and output. 2.1 Syntax for Input Structure setup The user-defined structure setup contains required fields and optional fields. The required fields in the structure input are as follows: • name: a string with no blank spaces that contains the name of the problem; • functions: a structure that contains the name of the continuous function and the endpoint function (see Section 2.2 for further details); • bounds: an structure that contains the information about the lower and upper bounds on the different variables and constraints in the problem (see Section 2.3 for further details); • guess: an structure that contains a guess of the time, state, control, integrals, and static parameters in the problem (see Section 2.6 for further details); In addition to the above required fields in the structure setup, optional fields in the setup structure may be specified (these fields may be provided by the user if it may of benefit for a particular problem of interest). The optional fields in the structure setup are given as follows along with the list of possible values and the default values: • auxdata: a structure containing auxiliary data that may be used by different functions in the problem. Including auxdata eliminates any need to specify global variables for use in the problem. The following table provided the possible values and their defaults for the field setup.auxdata: Field Possible Values Default setup.auxdata Any Problem-Specific Data Not Provided
2.2 Syntax for Structure setup.functions 8 • derivatives: a structure that specifies the derivative approximation to be used by the NLP solver and the derivative order (’first’ or ’second’) to be used by the NLP solver. The field setup.derivatives con- tains three fields supplier, derivativelevel, and dependencies where the field setup.derivatives.supplier contains the type of derivative approximation , the field setup.derivatives.derivativelevel contains the derivative order, while the field setup.derivatives.dependencies determines how the depen- dencies are found. The following table provided the possible values and their defaults for the field setup.derivatives: Field Possible Values setup.derivatives.supplier ’sparseFD’, ’sparseBD’ or ’sparseCD’ Default ’sparseFD’ ’first’ setup.derivatives.derivativelevel setup.derivatives.dependencies ’first’ or ’second’ ’full’, ’sparse’ or ’sparseNaN’ ’sparseNaN’ • scales: a structure that specifies the type of scaling to be used when solving the problem. [Possible Values: ’none’ or ’automatic-bounds’; Default: ’none’]; Field Possible Values Default setup.scales ’none’ or ’automatic-bounds’ ’none’ • mesh: a structure that specifies the information as to the type of mesh refinement method to be used and the mesh refinement accuracy tolerance, as well as the initial mesh. The structure setup.mesh con- tains the fields method, tolerance, maxiteration, and phase. The field setup.mesh.method is a string that specified the particular mesh refinement method to be used, while the field setup.mesh.tolerance contains the desired accuracy tolerance of the mesh, while the field setup.mesh.maxiterations con- tains the maximum number of allowed mes iterations. Field setup.mesh.method setup.mesh.tolerance Possible Values ’hp’ or ’hp1’ Positive Number Between 0 and 1 setup.mesh.maxiteration Non-Negative Integer Default ’hp1’ 10−3 10 The field mesh.phase specifies the initial mesh intervals in a given phase and the number of col- location (Radau) points in each mesh interval. The field setup.mesh.phase(p).fraction contains the mesh intervals for each phase p = 1, . . . , P , where the mesh intervals are specified in a row vector that provides the fraction of a scaled interval [0, 1] that corresponds to each mesh interval. The field setup.mesh.phase(p).colpoints contains the number of collocation points in each phase p = 1, . . . , P , where the number of collocation points in each mesh interval is also specified as a row vector such that the ith entry in setup.mesh.phase(p).colpoints corresponds to the ith entry in setup.mesh.phase(p).fraction. Field setup.mesh.phase(p).fraction setup.mesh.phase(p).colpoints Possible Values Row Vector of Length M ≥ 1 of Positive Numbers > 0 and < 1 that Sum to Unity Row Vector of Length M ≥ 1 of Positive Integers > 1 and < 10 Default 0.1*ones(1,10) 4*ones(1,10) (M is the same as in setup.mesh.phase(p).fraction) It is important to note that GPOPS − II has been designed so that the independent variable must be monotonically increasing in each phase of the problem. 2.2 Syntax for Structure setup.functions The syntax for specifying the names of the MATLAB functions given in setup.functions given as follows: setup.functions.continuous = @continuousfun.m setup.functions.endpoint = @endpointfun.m The details of the syntax for each function are provided in Sections 2.4 and 2.5.
分享到:
收藏