Quick Reference Guide for GPOPS − II Version 1.0:
A General-Purpose MATLAB Toolbox for Solving
Optimal Control Problems Using Sparse Nonlinear
Programming and hp–Adaptive
Pseudospectral Methods
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 GPOPS2 Software
This is a license for the general-purpose optimal control software GPOPS2. The license for GPOPS2 is based
on the Simple Public License. In the same spirit as the Simple Public License, the language for the GPOPS2
3
License is similar to that of GPL 2.0. The words are different, but the goal is the same: to guarantee for
all users the freedom to share and change software. If anyone wonders about the meaning of the GPOPS2
License, they should interpret it as consistent with GPL 2.0.
The GPOPS2 License applies to the software’s source and object code and comes with any rights that
I have in it (other than trademarks). You agree to the GPOPS2 License simply by downloading, copying,
distributing, or making a derivative work of the software. You get the royalty-free right to
• Use the software for any purpose;
• Make derivative works of it (this is called a ”Derived Work”);
• Copy and distribute it and any Derived Work.
If you distribute the software or a Derived Work, you must give back to the community by
• Prominently noting the date of any changes you make;
• Leaving other people’s copyright notices, warranty disclaimers, and license terms in place;
• Providing the source code, build scripts, installation scripts, and interface definitions in a form that is
easy to get and best to modify;
• Licensing it to everyone under the terms of this license agreement without adding further restrictions
to the rights provided;
• Conspicuously announcing that it is available under this license.
Distribution of GPOPS2
GPOPS2 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 GPOPS2 may be included as a part of a free open-source software (for example, a distribution
of the Linux operating system). When distributing GPOPS2 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 GPOPS2). GPOPS2 is not for commercial use with the exception that it may be used by commercial
organizations for internal research and development. Any use of GPOPS2 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;
• 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 GPOPS2 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.
GPOPS2 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 4
Contents
5
1 Introduction to the General-Purpose Software GPOPS − II
A P -phase optimal control problem can be stated in the following general form. Determine the state,
y
(p)
(t) ∈ R
n
(p)
y
, control, u
(p)
(t) ∈ R
n
(p)
u
, initial time, t
(p)
0
∈ R, final time, t
(p)
f
∈ R, integrals, d
(p)
∈ R
n
(p)
d
, in
each phase p ∈ [1, . . . , P ], and the static parameters, s ∈ R
n
s
, that minimize the cost functional
J = φ
h
y
(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 )
, s
i
(1)
subject to the dynamic constraints
˙
y
(p)
= a
(p)
h
y
(p)
, u
(p)
, t
(p)
, s
i
, (p = 1, . . . , P ), (2)
the event constraints
b
(g)
min
≤ b
h
y
(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 )
, s
i
≤ b
(g)
max
,
(g = 1, . . . , G),
(3)
the inequality path constraints
c
(p)
min
≤ c
(p)
h
y
(p)
, u
(p)
, t
(p)
, s
i
≤ c
(p)
max
, (p = 1, . . . , P ), (4)
and the integral constraints
q
(p)
min
≤ q
(p)
≤ q
(p)
max
, (p = 1, . . . , P ) (5)
where
q
(p)
i
=
Z
t
(p)
f
t
(p)
0
Q
i
h
y
(p)
(t), u
(p)
(t), t, s
i
dt, (i = 1, . . . , n
(p)
q
; p = 1, . . . , P ). (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. ?, ?, ?, and ?.
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
- 2
- 3
前往页