efficient solutions to nonlinear optimal...
TRANSCRIPT
EFFICIENT SOLUTIONS TO NONLINEAR OPTIMAL CONTROL PROBLEMS USINGADAPTIVE MESH ORTHOGONAL COLLOCATION METHODS
By
MICHAEL PATTERSON
A DISSERTATION PRESENTED TO THE GRADUATE SCHOOLOF THE UNIVERSITY OF FLORIDA IN PARTIAL FULFILLMENT
OF THE REQUIREMENTS FOR THE DEGREE OFDOCTOR OF PHILOSOPHY
UNIVERSITY OF FLORIDA
2013
c© 2013 Michael Patterson
2
For My Parents
3
ACKNOWLEDGMENTS
First and foremost, I would like to thank Dr. Anil V. Rao for taking a chance on
me,providing me an opportunity to achieve beyond any goal I could imagine, and never
letting me settle for good enough. I would also like to thank my committee members
Dr. Gloria Wiens, Dr. Norman Fitz-Coy, and Dr. William Hager for their time, guidance,
and experience. Next, I would also like to thank everyone that I have worked with
in the Vehicle Dynamics and Optimization Laboratory (VDOL). Specifically, I would
like to thank Arthur Scherich for being my friend from the start, Divya Garg for her
collaboration, Chris Darby for his work ethic, Camila Francolin for always being the most
interesting person in the room, Matthew Weinstein for his excellent help in completing
our research on automatic differentiation, Kathryn Schubert for putting up with my
distractions, and Begum Senses, Fengjin Liu, and Darin Toscano for always having a fun
person nearby when I was working.
4
TABLE OF CONTENTS
page
ACKNOWLEDGMENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
LIST OF TABLES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
LIST OF FIGURES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
ABSTRACT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
CHAPTER
1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2 MATHEMATICAL BACKGROUND . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.1 Bolza Optimal Control Problem . . . . . . . . . . . . . . . . . . . . . . . . 192.2 Numerical Methods for Optimal Control . . . . . . . . . . . . . . . . . . . 22
2.2.1 Indirect Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222.2.1.1 Indirect shooting method . . . . . . . . . . . . . . . . . . 232.2.1.2 Indirect multiple shooting method . . . . . . . . . . . . . 24
2.2.2 Direct Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262.2.2.1 Direct shooting . . . . . . . . . . . . . . . . . . . . . . . 272.2.2.2 Multiple direct shooting . . . . . . . . . . . . . . . . . . . 272.2.2.3 Direct collocation . . . . . . . . . . . . . . . . . . . . . . 29
2.3 Family of Legendre-Gauss Direct Collocation Methods . . . . . . . . . . 292.3.1 Transformed Continuous Bolza Problem . . . . . . . . . . . . . . . 292.3.2 LG, LGR, and LGL Collocation Points . . . . . . . . . . . . . . . . 302.3.3 Legendre-Gauss-Lobatto Orthogonal Collocation Method . . . . . 322.3.4 Legendre-Gauss Orthogonal Collocation Method . . . . . . . . . . 332.3.5 Legendre-Gauss-Radau Orthogonal Collocation Method . . . . . 352.3.6 Benefits of Using Legendre-Gauss-Radau Collocation Method . . 36
2.4 Numerical Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372.4.1 Unconstrained Optimization . . . . . . . . . . . . . . . . . . . . . . 372.4.2 Equality Constrained Optimization . . . . . . . . . . . . . . . . . . 382.4.3 Inequality Constrained Optimization . . . . . . . . . . . . . . . . . 40
3 LEGENDRE-GAUSS-RADAU COLLOCATION SPARSE STRUCTURE . . . . . 42
3.1 Notation and Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . 423.2 Optimal Control Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . 443.3 Variable-Order Legendre-Gauss-Radau Collocation Method . . . . . . . 473.4 Legendre-Gauss-Radau Collocation Method NLP Derivatives . . . . . . . 53
3.4.1 Gradient of Objective Function . . . . . . . . . . . . . . . . . . . . 553.4.2 Constraint Jacobian Differential Form . . . . . . . . . . . . . . . . 573.4.3 Constraint Jacobian Integral Form . . . . . . . . . . . . . . . . . . 623.4.4 Lagrangian Hessian . . . . . . . . . . . . . . . . . . . . . . . . . . 67
5
3.4.4.1 Hessian of endpoint function . . . . . . . . . . . . . . . . 683.4.4.2 Hessian of collocation point function differential form . . . 713.4.4.3 Hessian of collocation point function integral form . . . . 77
3.5 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 833.6 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 843.7 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
4 hp ADAPTIVE MESH REFINEMENT . . . . . . . . . . . . . . . . . . . . . . . . 96
4.1 Motivation for New ph Adaptive Collocation Method . . . . . . . . . . . . . 964.2 Bolza Optimal Control Problem . . . . . . . . . . . . . . . . . . . . . . . . 994.3 Legendre-Gauss-Radau Collocation Method . . . . . . . . . . . . . . . . 1034.4 ph Adaptive Mesh Refinement Method . . . . . . . . . . . . . . . . . . . . 105
4.4.1 Error Estimate in Each Mesh Interval . . . . . . . . . . . . . . . . . 1054.4.2 Rationale for Error Estimate . . . . . . . . . . . . . . . . . . . . . . 1064.4.3 Estimation of Required Polynomial Degree within a Mesh Interval . 1094.4.4 p Then h Strategy for Mesh Refinement . . . . . . . . . . . . . . . 110
4.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1124.5.1 Hyper-Sensitive Problem . . . . . . . . . . . . . . . . . . . . . . . . 1134.5.2 Tumor Anti-Angiogenesis Problem . . . . . . . . . . . . . . . . . . 1194.5.3 Reusable Launch Vehicle Entry . . . . . . . . . . . . . . . . . . . . 120
4.6 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1274.7 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
5 GPOPS-II: MULTIPLE PHASE OPTIMAL CONTROL SOFTWARE . . . . . . . 129
5.1 General Multiple Phase Optimal Control Problems . . . . . . . . . . . . . 1295.2 Legendre-Gauss-Radau Collocation Method . . . . . . . . . . . . . . . . 130
5.2.1 Single-Phase Optimal Control Problem . . . . . . . . . . . . . . . . 1315.2.2 Variable-Order Legendre-Gauss-Radau Collocation Method . . . . 134
5.3 Major Components of GPOPS-II . . . . . . . . . . . . . . . . . . . . . . . 1365.3.1 NLP Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
5.3.1.1 NLP variables . . . . . . . . . . . . . . . . . . . . . . . . 1385.3.1.2 NLP objective and constraint functions . . . . . . . . . . . 140
5.3.2 Sparse Structure of NLP Derivative Functions . . . . . . . . . . . . 1425.3.3 Optimal Control Problem Scaling for NLP . . . . . . . . . . . . . . 1435.3.4 Computation of Derivatives Required by the NLP Solver . . . . . . 1465.3.5 Determining the Optimal Control Function Dependencies . . . . . 1475.3.6 Adaptive Mesh Refinement . . . . . . . . . . . . . . . . . . . . . . 1485.3.7 Algorithmic Flow of GPOPS-II . . . . . . . . . . . . . . . . . . . . . 149
5.4 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1505.4.1 Hyper-Sensitive Problem . . . . . . . . . . . . . . . . . . . . . . . . 1515.4.2 Reusable Launch Vehicle Entry . . . . . . . . . . . . . . . . . . . . 1545.4.3 Space Station Attitude Control . . . . . . . . . . . . . . . . . . . . . 1575.4.4 Kinetic Batch Reactor . . . . . . . . . . . . . . . . . . . . . . . . . 1605.4.5 Multiple-Stage Launch Vehicle Ascent Problem . . . . . . . . . . . 169
6
5.5 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1725.6 Limitations of GPOPS-II . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1725.7 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
REFERENCES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
BIOGRAPHICAL SKETCH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
7
LIST OF TABLES
Table page
3-1 NLP performance without exploiting sparsity . . . . . . . . . . . . . . . . . . . . 93
3-2 NLP performance exploiting sparsity . . . . . . . . . . . . . . . . . . . . . . . . 94
3-3 Summary of NLP constraint, Jacobian, and Lagrangian Hessian sizes . . . . . 94
4-1 Hyper-sensitive problem error analysis . . . . . . . . . . . . . . . . . . . . . . . 116
4-2 Hyper-sensitive problem mesh refinement analysis . . . . . . . . . . . . . . . . 118
4-3 Tumor anti-agiogenesis mesh refinement analysis . . . . . . . . . . . . . . . . 122
4-4 Reusable launch vehicle entry problem mesh refinement analysis . . . . . . . . 124
5-1 Mesh refinement history for hyper-sensitive problem . . . . . . . . . . . . . . . 154
5-2 Performance of GPOPS-II on the reusable launch vehicle entry problem . . . . 157
5-3 Vehicle properties for multiple-stage launch vehicle ascent problem . . . . . . . 171
5-4 Constants used in the launch vehicle ascent optimal control problem . . . . . . 171
8
LIST OF FIGURES
Figure page
2-1 Schematic showing LGL, LGR, and LG orthogonal collocation points . . . . . . 31
3-1 Composite Legendre-Gauss-Radau differentiation matrix . . . . . . . . . . . . 52
3-2 Composite Legendre-Gauss-Radau integration and value difference matrices . 54
3-3 General Jacobian sparsity for the Legendre-Gauss-Radau differential scheme . 61
3-4 General Jacobian sparsity for the Legendre-Gauss-Radau integral scheme . . 66
3-5 General Hessian sparsity for the Legendre-Gauss-Radau differential Scheme . 76
3-6 General Hessian sparsity for the Legendre-Gauss-Radau integral scheme . . . 82
3-7 Solution to orbit-raising optimal control problem . . . . . . . . . . . . . . . . . . 90
3-8 Orbit-raising optimal control problem Jacobian sparsity . . . . . . . . . . . . . . 91
3-9 Orbit-raising optimal control problem Hessian sparsity . . . . . . . . . . . . . . 92
4-1 Motivation examples absolute errors . . . . . . . . . . . . . . . . . . . . . . . . 100
4-2 Motivation examples absolute error estimates . . . . . . . . . . . . . . . . . . . 108
4-3 Error based approximate polynomial degree increase . . . . . . . . . . . . . . 110
4-4 Hyper-sensitive problem solution and mesh refinement history . . . . . . . . . 117
4-5 Hyper-sensitive problem mesh refinement solutions near endpoints . . . . . . . 118
4-6 Tumor anti-angiogenesis problem solution and mesh refinement history . . . . 121
4-7 Reusable launch vehicle entry problem solution on final mesh . . . . . . . . . . 125
4-8 Reusable launch vehicle entry problem mesh history . . . . . . . . . . . . . . . 126
5-1 Schematic of linkages for multiple-phase optimal control problem . . . . . . . . 131
5-2 Single-phase composite Legendre-Gauss-Radau differentiation matrix . . . . . 137
5-3 Single-phase composite Legendre-Gauss-Radau integration matrix . . . . . . 137
5-4 Single-phase composite Legendre-Gauss-Radau E matrix . . . . . . . . . . . . 142
5-5 Differential scheme NLP constraint Jacobian and Lagrangian Hessian . . . . . 144
5-6 integral scheme NLP constraint Jacobian and Lagrangian Hessian . . . . . . . 145
5-7 Flowchart of the GPOPS-II algorithm . . . . . . . . . . . . . . . . . . . . . . . . 150
9
5-8 Solution to hyper-sensitive optimal control problem . . . . . . . . . . . . . . . . 152
5-9 Solution to hyper-sensitive problem near t = 0 and t = tf . . . . . . . . . . . . 153
5-10 Mesh refinement history for hyper-sensitive problem . . . . . . . . . . . . . . . 153
5-11 Reusable launch vehicle entry problem solution . . . . . . . . . . . . . . . . . . 156
5-12 State solution to space station attitude control problem . . . . . . . . . . . . . . 160
5-13 Control solution to space station attitude control problem . . . . . . . . . . . . 161
5-14 State solution to kinetic batch reactor problem . . . . . . . . . . . . . . . . . . 165
5-15 Control solution to kinetic batch reactor problem . . . . . . . . . . . . . . . . . 166
5-16 Phase 1 state solution to kinetic batch reactor problem . . . . . . . . . . . . . . 167
5-17 Phase 1 control solution to kinetic batch reactor problem . . . . . . . . . . . . . 168
5-18 Solution of multiple-stage launch vehicle ascent problem . . . . . . . . . . . . . 173
10
Abstract of Dissertation Presented to the Graduate Schoolof the University of Florida in Partial Fulfillment of theRequirements for the Degree of Doctor of Philosophy
EFFICIENT SOLUTIONS TO NONLINEAR OPTIMAL CONTROL PROBLEMS USINGADAPTIVE MESH ORTHOGONAL COLLOCATION METHODS
By
Michael Patterson
May 2013
Chair: Dr. Anil RaoMajor: Mechanical Engineering
In a direct collocation method, a continuous-time optimal control problem is
transcribed to a finite-dimensional nonlinear programming problem. Solving this
nonlinear programming problem as efficiently as possible requires that sparsity at
both the first- and second-derivative levels be exploited. In this dissertation the first and
second derivative nonlinear programming problem sparsity is exploited using Gaussian
quadrature orthogonal collocation at Legendre-Gauss-Radau points. Furthermore,
a variable-order mesh refinement method is developed that allows for changes in
both the number of mesh intervals and the degree of the approximating polynomial
within a mesh interval. This mesh refinement employs a relative error estimate based
on the difference between the Lagrange polynomial approximation of the state and
a Legendre-Gauss-Radau quadrature integration of the dynamics within a mesh
interval. This relative error estimate is used to decide if the degree of the approximating
polynomial within a mesh should be increased or if the mesh interval should be divided
into sub-intervals. Finally, a reusable software package is described that efficiently
computes solutions to multiple phase optimal control problems. This software package
exploits the sparse structure of the Radau collocation method, while also implementing
the aforementioned variable-order mesh refinement method.
11
CHAPTER 1INTRODUCTION
The goal of solving an optimal control problem is to determine the control of a
dynamical system that minimizes (or maximizes) a desired performance index while
simultaneously satisfying the constraints of the system. Solutions to optimal control
problems can be found using many different techniques. Analytic techniques for solving
optimal control problems involve finding the necessary conditions for optimality, usually
by means of calculus of variations [1, 2]. Unfortunately as problems grow in size and
complexity, it becomes increasingly difficult to find a solution analytically. Consequently,
optimal control problems generally need to be solved using numerical methods.
Numerical methods for solving optimal control problems fall into two categories:
direct methods and indirect methods [3, 4]. In a direct method the optimal state and
control are found by directly minimizing (or maximizing) the performance index subject to
the constraints of the system. Indirect methods involve finding the necessary conditions
for optimality, and then determining the state, control, and costate that satisfy these
conditions. Indirect methods can produce very accurate solutions, but are dependent
upon finding the necessary conditions for optimality which can be very difficult. Direct
methods may not offer the accuracy of indirect methods, but do not require that the
necessary conditions for optimality be derived. Also, direct methods are not as
dependent on a priori knowledge of the optimal solution. Because of the flexibility of
direct methods, they will be the focus of this dissertation.
Over the past two decades, a particular class of direct methods called direct
collocation methods have become a popular choice for finding numerical solutions
to optimal control problems. In a direct collocation method, the state is approximated
using a set of basis (or trial) functions and the constraints are collocated at specified
set of points in the time interval of interest. Direct collocation methods are employed
either as h, p or hp–methods [5–9]. In an h–method, the state is approximated using
12
many fixed low-degree polynomial (e.g., second-degree or third-degree) mesh intervals.
Convergence in an h–method is then achieved by increasing the number of mesh
intervals [10–12]. In a p–method, the state is approximated using a fixed number of
mesh intervals (usally only a single mesh interval is used), and convergence is then
achieved by increasing the degree of the approximating polynomial [13–20]. In an
hp–method, convergence is achieved by increasing both the number of mesh intervals
and the degree of the polynomial within each mesh interval [21, 22].
Recently, a great amount of research has been focused on orthogonal collocation
methods [13–20, 23–29]. In a orthogonal collocation method, the collocation points are
based on accurate quadrature rules and the basis functions are typically Chebyshev or
Lagrange polynomials. Originally, orthogonal collocation methods were employed as
p–methods. For problems whose solutions are smooth and well-behaved, a orthogonal
collocation method has a simple structure and converges at an exponential rate [30–32].
The most well developed p–type orthogonal collocation methods are the Legendre-
Gauss orthogonal collocation method [15, 23], the Legendre-Gauss-Radau orthogonal
collocation method [18, 19, 27], and the Legendre-Gauss-Labatto orthogonal colloca-
tion method [13]. More recently, it has been found that computational efficiency and
accuracy can be increased by using either an h [27] or an hp orthogonal collocation
method [21, 22].
While orthogonal collocation methods are highly accurate, proper implementation is
important in order to obtain solutions in a computationally efficient manner. Specifically,
modern large scale gradient-based nonlinear programming problem (NLP) solvers
require that first and/or second derivatives of the NLP functions, or estimates of these
derivatives, be supplied. In a first-derivative (quasi-Newton) NLP solver, the objective
function gradient and constraint Jacobian are used together with a dense quasi-Newton
approximation of the Lagrangian Hessian (typically a Broyden-Fletcher-Goldfarb-Shanno
(BFGS) [33–36] or Davidon-Fletcher-Powell (DFP) [37–39] quasi-Newton approximation
13
is used). In a second-derivative (Newton) NLP solver, the objective function gradient
and constraint Jacobian are used together with the Lagrangian Hessian of the NLP
Lagrangian. Examples of commonly used first-derivative NLP solvers include NPSOL
[40] and SNOPT [41, 42], while well known second-derivative NLP solvers include
IPOPT [43] and KNITRO [44].
In general, first-derivative methods for solving NLPs are more commonly used than
second-derivative methods because of the great challenge that arises from computing
an the Lagrangian Hessian. It is known, however, that providing the Lagrangian Hessian
can significantly improve the computational performance of an NLP solver over using
a quasi-Newton method. This potential for a large increase in efficiency and reliability
is particularly evident when the NLP is sparse. While having an accurate Lagrangian
Hessian is desirable, even for sparse NLP’s computing a Hessian is inefficient if not
done properly. While current uses of orthogonal collocation methods have exploited
sparsity at the first derivative level, sparsity at the second derivative level has not yet
been fully understood or exploited.
Because a NLPs performance is strongly dependent on the quality of the derivatives
it requires, an efficient approach is required for computing the first and second
derivatives of NLP functions arising from a direct orthogonal collocation method [29, 45].
In this dissertation the sparse structure of the Legendre-Gauss-Radau orthogonal
collocation method is described [18, 19, 22, 27]. The Legendre-Gauss-Radau
collocation method is the focus of this dissertation because of the elegant structure
of the. Furthermore, the Legendre-Gauss-Radau orthogonal collocation method
has the feature that the NLP derivative functions can be obtained by differentiating
only the functions of the continuous-time optimal control problem. Because the
optimal control functions depend upon many fewer variables than the functions of
the NLP, differentiating the optimal control problem functions reduces significantly the
computational effort required to compute the NLP derivative functions. Furthermore, the
14
NLP derivative functions that result from the transcription of the Legendre-Gauss-Radau
orthogonal collocation method are shown to have a sparse block structure.
The second part of this dissertation focuses on mesh refinement methods for
solving optimal control problems that employ the aforementioned Radau collocation
method. Several mesh refinement methods employing direct collocation methods have
been described in recent years [21, 22, 46, 47]. Reference [46] describes a method
that employs a differentiation matrix to attempt to identify switches, kinks, corners, and
other discontinuities in the solution and uses Gaussian quadrature rules to generate a
mesh that is dense near the end points of the time interval of interest. Reference [47]
employs a density function and attempts to generate a fixed-order mesh on which to
solve the problem. References [21] and [22] describe hp adaptive methods where the
error estimate is based on the difference between the derivative approximation of the
state and the right-hand side of the dynamics at the midpoints between collocation
points. The error estimates used in Refs. [22] and [21] induces a great deal of noise
making these methods computationally intractable when a high-accuracy solution is
desired and do not take advantage of the exponential convergence rate of a orthogonal
collocation method.
In addition to sparsity exploitation, in this dissertation computational efficiency
is shown to be further improved via a new variable-order mesh refinement method.
The method is divided into three parts. First, an approach is developed for estimating
the relative error in the solution within each mesh interval. This relative error estimate
is obtained by comparing the original state variable to a higher order approximation
of the state. This relative error estimate is used to determine if the degree of the
polynomial approximation should be increased or if mesh intervals should be added.
The polynomial degree is increased in a mesh interval if it is estimated that the solution
in the mesh interval requires a polynomial degree that is less than a maximum allowable
degree to satisfy the desired tolerance on the next mesh iteration. Otherwise, the
15
mesh is refined. This process is repeated on a series of meshes until a specified
accuracy tolerance is met. The decision to increase the polynomial degree or refine
the mesh is based on the base-p logarithm of the ratio of the maximum relative error
and the accuracy tolerance and is consistent with the known exponential convergence
of a orthogonal collocation method for a problem whose solution is smooth. The
effectiveness of this strategy is studied on three examples that have different features
in the optimal solution and, thus, exercise different aspects of the new hp approach. It
is found that the method in this thesis achieves a specified accuracy tolerance using a
significantly smaller NLP size when compared with standard fixed-order h methods.
The method of this thesis is fundamentally different from the any of these previously
developed methods. First, in this thesis we develop an approach that is based on
varying the order of the approximation in each mesh interval and using the exponential
convergence rate of a orthogonal collocation method. Furthermore, the method of
this thesis estimates the relative error using the difference between an interpolated
value of the state and a Legendre-Gauss-Radau quadrature approximation to the
integral of the dynamics. This relative error estimate remains computationally tractable
when a high-accuracy solution is desired and reduces significantly the number of
collocation points required to meet a specified accuracy tolerance when compared
with the methods of Ref. [21] or [22]. Finally, the mesh refinement method developed
in this thesis is a simple yet efficient way to generate meshes and leads to reduced
computation times and increased accuracy when compared with fixed-order h and p
methods.
Finally , this dissertation also describes a new optimal control software called
GPOPS-II that employs the aforementioned variable-order Legendre-Gauss-Radau
orthogonal collocation method. GPOPS-II represents a significant advancement in
mathematical software over previously developed software that employs Gaussian
quadrature orthogonal collocation. In particular, it is noted that a previously developed
16
Gaussian quadrature orthogonal collocation software called GPOPS was published in
[17]. While GPOPS-II is similar to GPOPS in that both software programs implement
Gaussian orthogonal collocation, GPOPS-II is a fundamentally different software
program than GPOPS. First, GPOPS employs p (global) collocation in each phase of
the optimal control problem. It is known that p collocation schemes are limited in that
they have difficulty solving problems whose solutions change rapidly in certain regions
or are discontinuous. Moreover, p methods become computationally intractable as
the degree of the approximating polynomial becomes very large. GPOPS-II, however,
employs hp-adaptive mesh refinement where the polynomial degree, number of mesh
intervals, and width of each mesh interval can be varied. The hp-adaptive methods allow
for placement of collocation points in regions of the solution where additional information
is needed to capture key features of the optimal solution. Next, GPOPS is limited in
that it can only be used with quasi-Newton (first derivative) NLP solvers and derivative
approximations are performed on the large NLP functions. On the other hand, GPOPS-II
implements the sparse derivative approximations described in this dissertation, by
approximating derivatives of the optimal control functions and inserting these derivatives
into the appropriate locations in the NLP derivative functions, the NLP derivatives are
computed with greater efficiency. Moreover, GPOPS-II implements approximations to
both first and second derivatives. Consequently, GPOPS-II utilizes in an efficient manner
the full capabilities of a much wider range of NLP solvers (for example, full Newton NLP
solvers such as IPOPT [43] and KNITRO [44]) and, as a result, is capable of solving a
much wider range of optimal control problems as compared with GPOPS.
The software described in this dissertation employs the aforementioned
Legendre-Gauss-Radau orthogonal collocation method [18–20, 29] in both differential
and integral form. The key components of the software are described are described in
detail and the software is demonstrated on five challenging optimal control problems.
17
This dissertation is organized as follows.. Chapter 2 describes the mathematical
background necessary to understand the concepts of optimal control. A nonlinear
optimal control problem is stated and the continuous-time first-order necessary
conditions for this problem are derived. Next, numerical methods for optimal control
are discussed using both indirect and direct methods. Moreover, three orthogonal
collocation methods are described. Chapter 3 provides a detailed description of
the structure of the Legendre-Gauss-Radau orthogonal collocation method in both
differential and integral forms. Next, an efficient method to compute the NLP derivative
functions directly from the derivatives of the optimal control problem functions is
described along with the computational performance gained by exploiting this structure.
Chapter 4 describes a variable-order mesh refinement method, as well as a motivation
for using variable-order mesh refinement is presented along with a way to accurately
estimate the solution error on the mesh. Furthermore, a mesh refinement method based
on the exponential convergence of the orthogonal collocation method is developed,
where the mesh is refined as a function of the estimated error and the minimum and
maximum polynomial allowed in each mesh interval. Finally, Chapter 5 describes in
detail the new optimal control software GPOPS-II.
18
CHAPTER 2MATHEMATICAL BACKGROUND
The first objective of this chapter is to provide an overview of different numerical
methods for solving optimal control problems. These methods are divided into two
categories: indirect methods and direct methods. The key types of numerical methods
within each of these categories is described. The second objective is to describe the
class of discretization methods that are used as the basis of this thesis. Specifically,
methods that employ collocation using the family of Legendre-Gauss quadrature
points are provided. This family of collocation points includes Legendre-Gauss,
Legendre-Gauss-Radau, and Legendre-Gauss-Lobatto quadrature points. Moreover,
after providing descriptions of the orthogonal collocation methods that arise from using
these points, a justification is given as to why the methods developed in the remainder
of this dissertation are based on Legendre-Gauss-Radau collocation. Finally, the third
objective is to provide a short introduction to finite-dimensional numerical optimization.
2.1 Bolza Optimal Control Problem
The objective of an optimal control problem is to determine the state and control
that optimize a performance index subject to dynamic constraints, boundary conditions,
and path constraints. Consider the following optimal control problem in Bolza form.
Determine the state, y(t) ∈ Rny , control, u(t) ∈ R
ny , initial time, t0, and final time, tf , that
minimize the cost functional
J = φ(y(t0), t0, y(tf ), tf ) +
∫ tf
t0
g(y(t), u(t), t)dt, (2–1)
subject to the dynamic constraints
dy
dt= a(y(t), u(t), t), (2–2)
the path constraints
c(y(t), u(t), t)≤ 0, (2–3)
19
and boundary conditions
b(y(t0), t0, y(tf ), tf ) = 0, (2–4)
where the functions φ, g, a, c and b are defined by the following mappings:
φ : Rny × R× R
ny × R× Rnq → R,
g : Rny × R
nu × R → R,
a : Rny × R
nu × R → Rny ,
c : Rny × R
nu × R → Rnc ,
b : Rny × R× R
ny × R× Rnq → R
nb ,
The Bolza problem of Eqs. (2–1)–(2–4) historically has been solved using a branch
of mathematics called calculus of variations to obtain a set of first-order necessary
conditions for optimality [1, 48, 49]. A solution to the optimality conditions is called
an extremal solution, and second-order conditions can be checked to ensure that the
extremal solution is a minimum. Unconstrained optimization problems that depend
on continuous functions of time require that the first variation, δJ (y(t)), of the cost
functional, J (y(t)), on an optimal path y(t)∗, vanish for all admissible variations δy(t)
such that
J (y(t)∗, δy(t)) = 0. (2–5)
For a constrained optimization problem, an extremal solution is generated from the
continuous-time first-order necessary conditions by applying the calculus of variations
to an augmented cost. The augmented cost is obtained by appending the constraints to
the cost functional using the Lagrange multipliers. The augmented cost is given as
J = φ(y(t0), t0, y(tf ), tf )− νT
b(y(t0), t0, y(tf ), tf )
+
∫ tf
t0
[
g(y(t), u(t), t)− λ(t)T(y− a(y(t), u(t), t))− µ(t)Tc(y(t), u(t), t)]
dt,(2–6)
where λ(t) ∈ Rny , µ(t) ∈ R
nc , and ν ∈ R
nb are the Lagrange multipliers corresponding
to Eqs. (2–2), (2–3), and (2–4), respectively. The quantity λ(t) is called the costate or
20
the adjoint. The variation with respect to each free variable is set to zero as shown in
Eq. (2–5) resulting in a set of first-order necessary conditions for optimality. Moreover, it
is convenient to determine the first-order optimality conditions in terms of the augmented
Hamiltonian.
H(y(t), u(t),λ(t),µ(t), t) = g(y(t), u(t), t)+λT(t)a(y(t), u(t), t)−µT(t)c(y(t), u(t), t).
(2–7)
The first-order optimality conditions are then conveniently expressed as
y(t)T
=∂H∂λ= a(y(t), u(t), t)
λ(t)T
= −∂H∂y
0 =∂H∂u
λT
(t0) = − ∂φ
∂y(t0)+ ν
T ∂b
∂y(t0)
λT
(tf ) =∂φ
∂y(tf )− νT ∂b
∂y(tf )
H(t0) =∂φ
∂t0− νT ∂b
∂t0
H(tf ) = − ∂φ
∂tf+ ν
T ∂b
∂tf,
(2–8)
where
µi(t) = 0 when ci(y(t), u(t), t) < 0,
µi(t) ≤ 0 when ci(y(t), u(t), t) = 0,(i = 1, ... , nc). (2–9)
When c(t)i < 0 the path constraint in Eq. (2–3) is inactive. Therefore, by making
µ(t)i = 0, the constraint is simply ignored in augmented cost, Furthermore, the negative
value of µ(t)i when c(t)i = 0 is interpreted such that improving the cost may only come
from violating the constraint [48].
For some problems, the control cannot be uniquely determined, either implicitly or
explicitly, from these optimality conditions. In such cases, the weak form of Pontryagin’s
minimum principle can be used which solves for the permissible control that minimizes
the augmented Hamiltonian in Eq. (2–7). If U is the set of permissible controls, then
21
Pontryagin’s minimum principle states that the optimal control, u∗ ∈ U , satisfies the
condition
H(y∗(t), u∗(t),λ∗(t),µ∗(t), t) ≤ H(y∗(t), u(t),λ∗(t),µ∗(t), t), ∀u ∈ U . (2–10)
The first-order optimality conditions of Eq. (2–8) define a set of necessary conditions
that must be satisfied for an extremal solution of an optimal control problem. The
second-order sufficiency conditions can be implemented to confirm that the extremal
solution is the desired minimum or maximum.
2.2 Numerical Methods for Optimal Control
Often it is difficult to obtain analytic solutions to optimal control problems.
Furthermore, as the complexity of the optimal control problem increases, finding
solutions via analytical methods becomes intractable (or may not have a analytic
solution). As a result, numerical methods for solving differential equations, root finding,
and numerical optimization must be employed to solve most optimal control problems.
Numerical methods optimal control fall into one of two categories, indirect methods
and direct methods. In an indirect method, the calculus of variations is employed to
obtain the first-order optimality conditions of Eqs. (2–8) and (2–9). Moreover, when
the first-order optimality conditions are satisfied an extremal solution is obtained. In a
direct method, the state and/or control are approximated using an appropriate function
approximation (e.g., polynomial approximation or piecewise constant parameterization).
Furthermore, the cost functional is approximated as a cost function. The coefficients of
the function approximations are then treated as optimization variables and the problem
is transcribed to a numerical optimization problem.
2.2.1 Indirect Methods
In an indirect method, the calculus of variations is employed to obtain the first-order
optimality conditions of Eqs. (2–8) and (2–9). These conditions result in a two-point
(or, in the case of a complex problem, a multi-point) boundary-value problem. This
22
boundary-value problem actually has a special structure because it arises from taking
the derivative of a Hamiltonian and this boundary-value problem is solved using the
appropriate boundary conditions. The beauty of using an indirect method is that the
state and costate are solved for and the resulting solution is readily verified to be an
extremal trajectory. The disadvantage of indirect methods is that the boundary-value
problem is often extremely difficult to solve, particularly for problems that span large time
intervals or problems with interior point constraints.
2.2.1.1 Indirect shooting method
Consider the following boundary-value problem that results from the first-order
optimality conditions of Eq. (2–8)
p(t) =
HT
λ
−HT
y
, (2–11)
with the boundary conditions
p(t0) = p0
p(tf ) = pf .
(2–12)
It is known that the first-order optimality conditions of Eq. (2–8) do not provide the
complete set of boundary conditions. In order to find a solution to the boundary-value
problem, an initial guess is made of the unknown boundary conditions at one end of the
interval. Using this guess, together with the known boundary conditions, the dynamics
of Eq. (2–11) are then integrated using numerical integration techniques (e.g., Euler,
Hermite–Simpson, Runge-Kutta etc.) to find the boundary conditions at the other end.
Using forward integration the final boundary condition is determined as
pf = p0 +
∫ tf
t0
p(t)dt, (2–13)
23
using backward integration the initial condition is determined as
p0 = pf +
∫ t0
tf
p(t)dt, (2–14)
A solution to the boundary-value problem can be obtained from the root finding problem
where pf − pf = 0 (or p0 − p0 = 0 if using backward integration) where the variables
are the unknown boundary conditions. The solution obtained from the boundary-value
problem satisfies the first-order optimality conditions of Eq. (2–8), thus providing a
extremal solution to the optimal control problem.
Although indirect shooting may seem to be a simple approach that yields to a
low-dimensional root finding problem, it can be difficult to implement in practice. First,
the first-order optimality conditions of the optimal control problem are required and can
be very difficult to derive. Second, the values of the costate boundary conditions are
non-intuitive, making it difficult to guess the unknown values. Finally, the error from
numerical integration can grow rapidly when integrating over long time intervals, of if the
dynamics change rapidly over the time interval of interest
2.2.1.2 Indirect multiple shooting method
Consider the following boundary-value problem that results from the first-order
optimality conditions of Eq. (2–8)
p(t) =
HT
λ
−HT
y
, (2–15)
with the boundary conditions
p(t0) = p0
p(tf ) = pf .
(2–16)
It is known that the first-order optimality conditions of Eq. (2–8) do not provide the
complete set of boundary conditions. In order to find a solution to the boundary-value
problem, the time domain is divided into K intervals, such that the k th interval is on the
24
domain [Tk−1,Tk ] where t0 = T0 < T1 · · · < TK = tf . Moreover, an initial guess is
made for the unknown boundary conditions at one end of the problem, as well as all
values for each interior point condition p(Tk), (k = 1, ... ,K − 1). The dynamics are then
numerically integrated over each interval, using forward integration
pk = pk−1 +
∫ Tk
Tk−1
p(t)dt, k = 1, ... ,K , (2–17)
or backward integration
pk−1 = pk +
∫ Tk−1
Tk
p(t)dt, k = K , ... , 1, (2–18)
A solution to the boundary-value problem can be obtained from the root finding problem
where pk − pk = 0, (k = 1, ... ,K) (or pk−1 − pk−1 = 0, (k = K , ... , 1, ) if using backward
integration) where the variables are the unknown boundary conditions and all interior
point conditions. The solution obtained from the boundary-value problem satisfies the
first-order optimality conditions of Eq. (2–8), thus providing a extremal solution to the
optimal control problem.
Indirect multiple shooting, like indirect shooting requires that the first-order
optimality conditions be derived, but unlike indirect shooting, the integration is performed
over many sub intervals of the original domain. Furthermore, the root finding problem
that arises from multiple indirect shooting contains more variables and constraints
then the root finding problem from indirect shooting. Although it may seem that
multiple indirect shooting has more difficulties the indirect shooting because of the
larger problem size, multiple indirect shooting actually has several advantages over
indirect shooting. The numerical integration error is reduced because the integration is
preformed over smaller intervals then when using indirect shooting. Also, the smaller
intervals can better handle dynamics that have multiple time-scales, increasing the array
of problems that can be solved.
25
2.2.2 Direct Methods
The first-order optimality conditions of Eq. (2–8) are often difficult to formulate.
Furthermore, numerical methods that solve these equations (indirect methods) generally
require an accurate initial guess, which is often non-intuitive. For these reasons direct
methods have become a very popular alternative to indirect methods. Rather than
formulate a set of optimality conditions, direct methods transcribe or convert the
infinite-dimensional optimal control problem into a finite-dimensional optimization
problem with algebraic constraints. A direct transcription method has three fundamental
steps [10]:
Step 1: Convert the dynamic system into a problem with a finite set of variables andalgebraic constraints.
Step 2: Solve the finite-dimensional problem using a parameter optimization method.
Step 3: Determine the accuracy of the finite-dimensional approximation and ifnecessary repeat the transcription and optimization steps.
Depending upon the type of direct method employed, the size of the nonlinear
optimization problem [or nonlinear programming problem (NLP)] can be rather small
(e.g., as in a direct shooting) or may be quite large (e.g., a direct collocation method).
It may be counter-intuitive that solving the larger NLP would be preferred over solving
the boundary-value problem of a indirect method, but in practice, the NLP can be easier
to solve, and does not require as accurate of an initial guess. There also exist several
powerful and well known NLP solvers such as SNOPT [41, 42], IPOPT [43] and KNITRO
[44].
Unlike indirect methods, in direct methods there is no need to discretize and
approximate the costate. However, if an accurate costate estimate can be generated,
this information can help validate the optimality of the solution from a direct approach.
Consequently, many direct methods attempt to produce a costate approximation based
26
on the Lagrange multipliers involved in the finite-dimensional nonlinear optimization
problem.
2.2.2.1 Direct shooting
In the direct shooting method the control is parameterized using a specified
functional of the form
u(t) =
p∑
i=1
αiβi(t), (2–19)
where α1, ... ,αp is the set of control parameters, and β1(t), ... ,βp(t) is a set of known
functions. The Bolza problem of Eqs. (2–1)–(2–4) is then transformed to have the
following form. Minimize the cost
J = φ(y(t0), t0, y(tf ), tf ) +
∫ tf
t0
g(y(t), u(t), t)dt, (2–20)
subject to the path constraints
c(y(t), u(t), t) ≤ 0, (2–21)
and boundary conditions
b(y(t0), t0, y(tf ), tf ) = 0, (2–22)
where the state is found as
y(t) = y(t0) +
∫ t
t0
a(y(t), u(t), t)dt, (2–23)
where the integrals of Eqs. (2–20) and (2–23) are approximated using numerical
integration techniques (e.g., Euler, Hermite–Simpson, Runge-Kutta etc.). The
optimization problem is then solved to find the optimal values of the unknown
components of the initial state, and the p control parameters α1, ... ,αp that minimize
Eq. (2–20).
2.2.2.2 Multiple direct shooting
The direct shooting technique can also be applied using by dividing the time domain
into multiple intervals known as multiple direct shooting where the time domain is
27
divided into K intervals, where each time interval is on the domain [Tk−1,Tk ], k =
1, ... ,K where t0 = T0 < T1 · · · < TK = tf . The control is parameterized in each interval
as
uk(t) =
pk∑
i=1
αki βki (t), k = 1, ... ,K , (2–24)
where αk1, ... ,αkp is the set of control parameters in interval k , and βk1(t), ... ,β
kp(t) is
a set of known functions in interval k . The Bolza problem of Eqs. (2–1)–(2–4) is then
transformed to have the following form. Minimize the cost
J = φ(y(t0), t0, y(tf ), tf ) +K∑
k=1
∫ Tk
Tk−1
g(yk(t), uk(t), t)dt, (2–25)
subject to the path constraints
c(yk(t), uk(t), t) ≤ 0, (2–26)
the boundary conditions
b(y(t0), t0, y(tf ), tf ) = 0, (2–27)
and the continuity constraints
yk(Tk) = yk+1(Tk), k = 1, ... ,K − 1, (2–28)
where the state is found as
yk(t) = yk(Tk−1) +
∫ Tk
Tk−1
a(yk(t), uk(t), t)dt, k = 1, ... ,K , (2–29)
where the integrals of Eqs. (2–25) and (2–29) are approximated using numerical
integration techniques (e.g., Euler, Hermite–Simpson, Runge-Kutta etc.). The
optimization problem is then solved to find the optimal values of the unknown
components of the initial state y(t0, and the pk control parameters αk1, ... ,αkp in each
interval k = 1, ... ,K that minimize Eq. (2–25).
28
2.2.2.3 Direct collocation
Direct collocation methods, where both the state and control are parameterized,
have become a very popular class of methods for optimal control over the last
twenty years. The increase in use of direct collocation methods is a result of the
improvement of NLP solvers. In a direct collocation method both the state and control
are approximated using a specified functional form, where the two most common forms
are local collocation and global collocation. Similar to multiple direct shooting, local
collocation methods divide the time domain into K intervals, where each time interval
is on the domain [Tk−1,Tk ], k = 1, ... ,K where t0 = T0 < T1 · · · < TK = tf , where
a functional approximation is applied to the state and control in each interval. Global
collocation methods apply the functional approximation to both the state and control over
the entire domain. Furthermore, typically global collocation methods use a much higher
order functional approximation over a single interval, where local collocation methods
use a low order functional approximation in each interval over many intervals. A specific
class of direct collocation methods called orthogonal collocation methods, where
collocation is performed at set orthogonal Gaussian-quadrature points is described in
detail in Section 2.3.
2.3 Family of Legendre-Gauss Direct Collocation Methods
This section will provide a detailed description of direct collocation
methods using the Legendre-Gauss-Lobatto (LGL), Legendre-Gauss (LG), and
Legendre-Gauss-Radau (LGR) points. The approach for LGL collocation is referred
to as the Legendre-Gauss-Lobatto collocation method, the second approach for LG
collocation, called the Legendre-Gauss collocation method, and a third approach for
LGR collocation, called the Legendre-Gauss-Radau collocation method.
2.3.1 Transformed Continuous Bolza Problem
The Bolza problem of Eqs. (2–1)–(2–4) is defined on the time interval t ∈ [t0, tf ]
where time is the independent variable. Furthermore, it may be useful to redefine the
29
Bolza problem so that the independent variable is contained on a fixed domain. The
independent variable t can be mapped to a new independent variable τ ∈ [−1, 1] via the
affine transformation
τ =2t
tf − t0+tf + t0tf − t0
. (2–30)
Using Eq. (2–30) the Bolza problem of Eqs. (2–1)–(2–4) can be redefined as follows.
Determine the state, y(τ) ∈ Rn, control, u(τ) ∈ R
m, initial time, t0, and final time, tf , that
minimize the cost functional
J = φ(y(−1), t0, y(1), tf ) +tf − t02
∫ 1
−1
g(y(τ), u(τ), τ ; t0, tf )dτ , (2–31)
subject to the dynamic constraints
dy
dτ=tf − t02a(y(τ), u(τ), τ ; t0, tf ), (2–32)
the path constraints
c(y(τ), u(τ), τ ; t0, tf ) ≤ 0, (2–33)
the boundary conditions
b(y(−1), t0, y(1), tf ) = 0 (2–34)
The optimal control problem of Eqs. (2–31)–(2–34) will be referred to as the trans-
formed continuous Bolza problem. It is noted that the optimal control problem of
Eqs. (2–31)–(2–34) can be transformed from the time interval τ ∈ [−1, 1] to the
time interval t ∈ [t0, tf ] via the affine transformation
t =tf − t02
τ +tf + t02
(2–35)
2.3.2 LG, LGR, and LGL Collocation Points
The Legendre-Gauss (LG), Legendre-Gauss-Radau (LGR), and
Legendre-Gauss-Lobatto (LGL) collocation points lie on the open interval τ ∈ (−1, 1),
the half open interval τ ∈ [−1, 1) or τ ∈ (−1, 1], and the closed interval τ ∈ [−1, 1],
30
h−1 −0.5 0 0.5 1
LGL
LGR
LG
τ
Co
llo
cati
on
Po
ints
LG Points Do Not Include Either Endpoint
LGR Points Include One Endpoint
LGL Points Include Both Endpoints
Figure 2-1. Schematic showing LGL, LGR, and LG orthogonal collocation points.
respectively. A depiction of these three sets of collocation points is shown in Fig. 2-1
where it is seen that the LG points contain neither -1 or 1, the LGR points contain only
one of the points -1 or 1 (in this case, the point -1), and the LGL points contain both -1
and 1. Denoting N as the number of collocation points and PN(τ) as the N th-degree
Legendre polynomial defined as
PN(τ) =1
2NN!
dN
dτN[
(τ2 − 1)N]
. (2–36)
The LG points are the roots of PN(τ), the LGR points are the roots of (PN−1(τ) + PN(τ)),
and the LGL points are the roots of PN−1(τ) together with the points -1 and 1. The
polynomials whose roots are the respective points are summarized as follows:
LG: Roots obtained from PN(τ)
LGR: Roots obtained from (PN−1(τ) + PN(τ))
LGL: Roots obtained from PN−1(τ) together with the points -1 and 1
It is seen from Fig. 2-1 that the LG and LGL points are symmetric about the origin
31
whereas the LGR points are asymmetric. In addition, the LGR points are not unique in
that two sets of points exist (one including the point -1 and the other including the point
1). The LGR points that include the terminal endpoint are often called the flipped LGR
points, however in this dissertation, the standard set of LGR points will be focused on.
2.3.3 Legendre-Gauss-Lobatto Orthogonal Collocation Met hod
In the Legendre-Gauss-Lobatto orthogonal collocation method, both collocation and
interpolation are performed at the LGL points. The state in the Legendre-Gauss-Lobatto
collocation method is approximated as
y(τ) ≈ Y(τ) =N∑
i=1
ℓi(τ)Y(τi) (2–37)
where the Lagrange polynomials ℓi(τ), (i = 1, ... ,N) are defined as
ℓi(τ) =
N∏
j=1
j 6=i
τ − τjτi − τj
(2–38)
The time derivative of the state is then given as
y(τ) ≈ Y(τ) =N∑
i=1
ℓi(τ)Y(τi) (2–39)
The approximation to the time derivative of the state given in Eq. (2–39) is then applied
at the N LGL collocation points (τ1, ... , τN) as
y(τk) ≈ Y(τk) =N∑
i=1
ℓi(τk)Y(τi) =N∑
i=1
DLGLki Y(τi), (k = 1, ... ,N) (2–40)
where DLGLki , (k , i = 1, ... ,N) is the N × N Legendre-Gauss-Lobatto collocation
method differentiation matrix, it is further noted that the Legendre-Gauss-Lobatto
collocation method differentiation matrix is singular. The continuous-time dynamics
given in Eq. (2–32) are then collocated at the N LGL points as
N∑
i=1
DLGLki Y(τi)−tf − t02a(Y(τk),U(τk), τk ; t0, tf ) = 0, (k = 1, ... ,N) (2–41)
32
Next, the continuous-time cost functional is approximated using a Gauss-Lobatto
quadrature as
J ≈ φ(Y(τ1), τ1,Y(τN), τN ; t0, tf ) +tf − t02
N∑
i=1
wLGLi g(Y(τi),U(τi), τi ; t0, tf ) (2–42)
where wLGLi , (i = 1, ... ,N) are the LGL weights. The continuous-time boundary
conditions are then approximated as
b(Y(τ1),Y(τN), τ1, τN ; t0, tf ) = 0 (2–43)
Finally, the path constraints are approximated at the N LGL collocation points as
c(Y(τk),U(τk), τk ; t0, tf ) ≤ 0, (k = 1, ... ,N). (2–44)
2.3.4 Legendre-Gauss Orthogonal Collocation Method
In the Legendre-Gauss orthogonal collocation method collocation is performed at
the at the LG points, while interpolation is performed at the LG points and the initial point
τ0 = −1. The boundary conditions are enforced by adding the support point τN+1 = 1.
The state in the Legendre-Gauss collocation method is approximated as
y(τ) ≈ Y(τ) =N∑
i=0
ℓi(τ)Y(τi) (2–45)
where the Lagrange polynomials ℓi(τ) (i = 0, ... ,N) are defined as
ℓi(τ) =N∏
j=0
j 6=i
τ − τjτi − τj
(2–46)
The time derivative of the state is then given as
y(τ) ≈ Y(τ) =N∑
i=0
ℓi(τ)Y(τi) (2–47)
33
The approximation to the time derivative of the state given in Eq. (2–47) is then applied
at the N LG collocation points (τ1, ... , τN) as
y(τk) ≈ Y(τk) =N∑
i=0
ℓi(τk)Y(τi) =
N∑
i=0
DLGki Y(τi), (k = 1, ... ,N) (2–48)
where DLGki , (k = 1, ... ,N; i = 0, ... ,N) is the N × (N + 1) Legendre-Gauss collocation
method differentiation matrix. Unlike the Legendre-Gauss-Lobatto collocation method
differentiation matrix, the Legendre-Gauss collocation method differentiation matrix is
not square (it has more columns than rows) because the state is approximated using
a different set of points than are used to collocate the dynamics. In particular, the
dynamics are collocated at the N LG points as
N∑
i=0
DLGki Y(τi)−tf − t02a(Y(τk),U(τk), τk ; t0, tf ) = 0, (k = 1, ... ,N) (2–49)
Next, in order to account for the initial and terminal points (i.e., the boundary points
τ0 = −1 and τN+1 = 1), an additional variable Y(τN+1) is defined via a Gauss quadrature
as
Y(τN+1) ≡ Y(τ0) +tf − t02
N∑
i=1
wLGi a(Y(τi),U(τi), τi ; t0, tf ) (2–50)
Next, the continuous-time cost functional is approximated using a Gauss quadrature as
J ≈ φ(Y(τ0), τ0,Y(τN+1), τN+1; t0, tf ) +tf − t02
N∑
i=1
wLGi g(Y(τi),U(τi), τi ; t0, tf ) (2–51)
where wLGi , (i = 1, ... ,N) are the Legendre-Gauss weights. Where the endpoint cost
in the Legendre-Gauss collocation method is evaluated at the boundary points τ0 = −1
and τN+1 = 1. Furthermore, similar to the way that the endpoint cost is evaluated at the
boundary points, the continuous-time boundary conditions are also approximated at the
boundary points as
b(Y(τ0), τ0,Y(τN), τN+1; t0, tf ) = 0 (2–52)
34
Finally, the path constraints are approximated at the N LG points as
c(Y(τk),U(τk), τk ; t0, tf ) ≤ 0, (k = 1, ... ,N). (2–53)
2.3.5 Legendre-Gauss-Radau Orthogonal Collocation Metho d
In the Legendre-Gauss-Radau orthogonal collocation method collocation is
performed at the at the LGR points, while interpolation is performed at the LGR points
and the final point τN+1 = 1. The state in the Legendre-Gauss-Radau collocation method
is approximated as
y(τ) ≈ Y(τ) =N+1∑
i=1
ℓi(τ)Y(τi) (2–54)
where the Lagrange polynomials ℓi(τ) (i = 1, ... ,N + 1) are defined as
ℓi(τ) =N+1∏
j=1
j 6=i
τ − τjτi − τj
(2–55)
The time derivative of the state is then given as
y(τ) ≈ Y(τ) =N+1∑
i=1
ℓi(τ)Y(τi) (2–56)
The approximation to the time derivative of the state given in Eq. (2–56) is then applied
at the N LGR collocation points (τ1, ... , τN) as
y(τk) ≈ Y(τk) =N+1∑
i=1
ℓi(τk)Y(τi) =
N+1∑
i=1
DRPMki Y(τi), (k = 1, ... ,N) (2–57)
where DLGRki , (k = 1, ... ,N; i = 1, ... ,N + 1) is the N × (N + 1) Legendre-Gauss-Radau
collocation method differentiation matrix. It is noted that the Legendre-Gauss-Radau
collocation method differentiation matrix is not square (it has more columns than rows)
because the state is approximated using a different set of points than are used to
collocate the dynamics. In particular, the dynamics are collocated at the N LGR points
35
as
N+1∑
i=1
DLGRki Y(τi)−tf − t02a(Y(τk),U(τk), τk ; t0, tf ) = 0, (k = 1, ... ,N) (2–58)
Next, the continuous-time cost functional is approximated using a Gauss-Radau
quadrature as
J ≈ φ(Y(τ1), τ1,Y(τN+1), τN+1; t0, tf ) +tf − t02
N∑
i=1
wLGRi g(Y(τi),U(τi), τi ; t0, tf ) (2–59)
It is noted that he endpoint cost in the Legendre-Gauss-Radau collocation method is
evaluated at the boundary points τ1 = −1 and τN+1 = 1. Furthermore, similar to the way
that the endpoint cost is applied at the boundary points, the continuous-time boundary
conditions are also approximated at the boundary points as
b(Y(τ1), τ1,Y(τN+1), τN+1; t0, tf ) = 0 (2–60)
Finally, the path constraints are approximated at the N LGR points as
c(Y(τk),U(τk), τk ; t0, tf ) ≤ 0, (k = 1, ... ,N − 1). (2–61)
2.3.6 Benefits of Using Legendre-Gauss-Radau Collocation M ethod
This dissertation will focus on the Legendre-Gauss-Radau collocation method
for the following reasons. First, the Legendre-Gauss-Radau collocation method
differentiation matrix is not singular as in the Legendre-Gauss-Lobatto collocation
method. Furthermore, because the Legendre-Gauss-Lobatto collocation method
differentiation matrix is singular, several problems arise with the method such as a
poor costate approximation from the Lagrange multipliers and on some problems
a failure to find a accurate control. Second, unlike the Legendre-Gauss collocation
method that depends upon using a integration quadrature to obtain the final state,
the Legendre-Gauss-Radau collocation method has the final state (and initial
state) as discretized variables. Finally, the Legendre-Gauss-Radau collocation
36
method has a value of the control at one of the endpoints, this feature makes the
Legendre-Gauss-Radau collocation uniquely valuable when implemented as a multiple
interval method because the control remains collocated at the interval points.
2.4 Numerical Optimization
In a direct collocation approximation of an optimal control problem, the
continuous-time optimal control problem is transcribed into a nonlinear programming
problem (NLP). The objective of a NLP is to find a set of parameters that minimizes
some cost function that is subject to a set of algebraic equality or inequality constraints.
In order to describe how an NLP yields and optimal solution this section will provide
a background of unconstrained optimization, equality constrained optimization, and
inequality constrained optimization.
2.4.1 Unconstrained Optimization
Consider the following problem of determining the minimum of a function subject to
multiple variables without any constraints. Minimize the objective function
J(x), (2–62)
where x ∈ Rn. For x∗ to be a locally minimizing point, the objective function must be
greater when evaluated at any neighboring point, i.e.,
J(x) > J(x). (2–63)
In order to develop a set of sufficient conditions defining a locally minimizing point x∗,
first, a three term Taylor series expansion about some point, x, is used to approximate
the objective function as
J(x) = J(x) + g(x)(x− x) + 12(x− x)TH(x)(x− x), (2–64)
37
where the gradient vector, g(x) ∈ R1×n, is
g(x) =
[
∂J∂x1
· · · ∂J∂xn
]
, (2–65)
and the symmetric Hessian matrix, H(x) ∈ R1×n is
H(x) =
∂2J∂x21
∂2J∂x1∂x2
· · · ∂2J∂x1∂xn
∂2J∂x2∂x1
∂2J∂x22
· · · ∂2J∂x2∂xn
......
. . ....
∂2J∂xn∂x1
∂2J∂xn∂x2
· · · ∂2J∂x2n
. (2–66)
For bfx∗ to be a local minimizing point, two conditions must be satisfied. First, a
necessary condition is that g(x∗) must be zero, i.e.,
g(x∗) = 0. (2–67)
The necessary condition by itself only defines an extremal point which can be a local
minimum, local maximum, or saddle point. In order to ensure x∗ is a local minimum, then
an additional condition that must be satisfied is
(x− x∗)TH(x− x∗) > 0. (2–68)
Eqs. (2–67) and (2–68) together define the necessary and sufficient conditions for a
local minimum.
2.4.2 Equality Constrained Optimization
Consider the following equality constrained optimization problem, minimize the
objective function
J(x), (2–69)
subject to the equality constraints
f(x) = 0, (2–70)
38
where x ∈ Rn, and f(x) ∈ R
m. Finding the minimum of the objective function subject to
equality constraints uses an approach similar to the calculus of variations approach for
determining the extremal of functionals. The Lagrangian is defined as
ℓ(x,λ) = J(x)− λTf(x), (2–71)
where λ ∈ Rm is the set of Lagrange multipliers respect to the equality constraints.
Moreover, the necessary conditions for the minimum of the Lagrangian is that (x∗,λ∗)
satisfies the conditions
∇xℓ(x∗,λ∗) = g(x)−GT(x)λ = 0,
∇λℓ(x∗,λ∗) = −f(x) = 0,
(2–72)
where the Jacobian matrix, G(x) ∈ Rm×n, is defined as
G(x) = ∇xf(x) =
∂f1∂x1
∂f1∂x2
· · · ∂f1∂xn
∂f2∂x1
∂f2∂x2
· · · ∂f2∂xn
......
. . ....
∂fm∂x1
∂fm∂x2
· · · ∂fm∂xn
. (2–73)
It is noted that at a extremal of the Lagrangian, the equality constraint of Eq. (2–70) is
satisfied. Furthermore, the necessary conditions of Eq. (2–72) are satisfied at extremal
points, and do not specify a minimum. In order to specify a minimum, first, the Hessian
of the Lagrangian is defined as
Hℓ(x,λ) = ∇2xxℓ(x,λ) = ∇2xxJ(x)−m∑
i=1
λi∇2xxfi(x), (2–74)
then, a sufficient condition for a minimum is that
vT
Hℓ(x,λ)v > 0, (2–75)
for any vector v in the constraint tangent space.
39
2.4.3 Inequality Constrained Optimization
Consider the following optimization problem that has both equality constraints, and
inequality constraints, minimize the objective function
J(x), (2–76)
subject to the equality constraints
f(x) = 0, (2–77)
and the inequality constraints
c(x) ≤ 0, (2–78)
where x ∈ Rn, f(x) ∈ R
m, and c(x) ∈ Rp, where some of the inequality constraints c(x)
are satisfied as equalities such that
cj(x) = 0, j ∈ A,
cj(x) < 0, j ∈ B,(2–79)
where A is considered the active set, and B is the inactive set. Next, the Lagrangian is
defined as
ℓ(x,λ) = J(x)− λTf(x)− (ψ(A))Tc(A)(x), (2–80)
where λ ∈ Rm is the set of Lagrange multipliers associated with the equality constraints,
and ψ(A) ∈ Rq is the set of Lagrange multipliers associated with the active set of the
inequality constraints, where q is the number of active constraints of c(x). Furthermore,
it is of note that ψ(B) = 0 ,and therefore, the inactive set of constraints are ignored. The
necessary conditions for the minimum of the Lagrangian is that the point (x∗,λ8,ψ(A)∗
satisfies
∇xℓ(x∗,λ∗,ψ(A)∗) = g(x)− GTf (x)λ−GTc(A)(x)ψ(A) = 0,
∇λℓ(x∗,λ∗,ψ(A)∗) = −f(x) = 0,
∇ψ(A)ℓ(x∗,λ∗,ψ(A)∗) = −c(A)(x) = 0,
(2–81)
40
It is noted that at a extremal of the Lagrangian, the constraints of Eqs. (2–77) and (2–78)
are satisfied. Furthermore, the necessary conditions of Eq. (2–81) are satisfied at
extremal points, and do not specify a minimum. In order to specify a minimum, first, the
Hessian of the Lagrangian is defined as
Hℓ(x,λ,ψ(A)) = ∇2xxℓ(x,λ,ψ(A)) = ∇2xxJ(x)−
m∑
i=1
λi∇2xxfi(x)−q∑
j=1
ψ(A)j ∇2xxcj(x), (2–82)
then, a sufficient condition for a minimum is that
vT
Hℓ(x,λ,ψ(A))v > 0, (2–83)
for any vector v in the constraint tangent space.
41
CHAPTER 3LEGENDRE-GAUSS-RADAU COLLOCATION SPARSE STRUCTURE
In this chapter the structure of the variable-order Legendre-Gauss-Radau
orthogonal collocation method is developed. The description of the sparse structure
includes expressions for the first, and second derivatives of the resulting non-linear
program. Furthermore, the sparsity of the resulting derivatives is shown and the
sturucture is demonstrated on an example problem. The work in this chapter is based
on the work from Refs. [29, 50].
This chapter is organized as follows. In Section 3.1 we provide our notation and
conventions used throughout this paper. In Section 3.2 we state the continuous-time
optimal control problem. In Section 3.3, we state the Legendre-Gauss-Radau
orthogonal collocation method [18–20] that is used to derive the NLP derivative
functions. In Section 3.4 we derive expressions for the objective function gradient,
constraint Jacobian, and Lagrangian Hessian of the NLP that arises from the
discretization of the continuous-time optimal control problem of Section 3.2 using the
Legendre-Gauss-Radau orthogonal collocation method of Section 3.3. In Section 3.5 we
provide a discussion of the underlying structure of the derivative functions. In Section
3.6 we provide an example that demonstrates the great improvement in computational
efficiency obtained using the method of this paper. Finally, in Section 3.7 we provide
conclusions on our work.
3.1 Notation and Conventions
Throughout this paper the following notation and conventions will be employed.
All scalars will be represented by lower-case symbols (e.g., y , u). All vector functions
of time will be treated as row vectors and will be denoted by lower-case bold symbols.
Thus, if p(t) ∈ Rn is a vector function of time, then p(t) = [p1(t) · · · pn(t)]. Any vector
that is not a function of time will be denoted as a column vector, that is a static vector
z ∈ Rn will be treated as a column vector. Next, matrices will be denoted by upper
42
case bold symbols. Thus, P ∈ RN×n is a matrix of size N × n. Furthermore, if f(p),
f : Rn −→ Rm, is a function that maps row vectors p ∈ R
n to row vectors f(p) ∈ Rm, then
the result of evaluating f(p) at the points (p1, ... , pN) is the matrix F ∈ RN×n ≡ [f(pk)]1N ,
F1N ≡ [f(pk)]1N =
f(p1)
...
f(pN)
.
A single subscript i attached to a matrix denotes a particular row of the matrix, i.e., Pi is
the i th row of the matrix P. A double subscript i , j attached to a matrix denotes element
located in row i and column j of the matrix, i.e., Pi,j is the (i , j)th element of the matrix
P. Furthermore, the notation P:,j will be used to denote all of the rows and column j of a
matrix P. Finally, PT will be used to denote the transpose of a matrix P.
Next, let P and Q be n ×m matrices. Then the element-by-element multiplication of
P and Q is defined as
P Q =
p11q11 · · · p1mq1m...
. . ....
pn1qn1 · · · pnmqnm
.
It is noted further that P Q is not standard matrix multiplication. Furthermore, if p ∈ Rn,
then the operation diag (p) denotes n × n diagonal matrix formed by the elements of p,
diag (p) =
p1 0 · · · 0
0 p2 · · · 0...
.... . .
...
0 0 · · · pn
.
Finally, the notation 0n×m represents an n × m matrix of zeros, while 1n×m represent an
n ×m matrix of all ones.
43
Next, we define the notation for derivatives of functions of vectors. First, let f (p),
f : Rn −→ R. Then ∇pf (p) ∈ Rn is a row vector of length n and is defined as
∇pf (p) =[
∂f
∂p1· · · ∂f
∂pn
]
Next, let f(p), f : Rn → Rm, where p may be either a row vector or a column vector and
f(p) has the same orientation (i.e., either row vector or column vector) as p. Then ∇pf is
the m by n matrix whose i th row is ∇pfi , that is,
∇pf =
∇pf1...
∇pfm
=
∂f1∂p1
· · · ∂f1∂pn
.... . .
...∂fm∂p1
· · · ∂fm∂pn
The following conventions will be used for second derivatives of scalar functions. Given
a function f (p, q), where f : Rn × Rm → R maps a pair of row vectors p ∈ R
n and q ∈ Rm
to a scalar f (p, q) ∈ R, then the mixed second derivative ∇2pq is an n by m matrix,
∇2pqf =
∂2f
∂p1∂q1· · · ∂2f
∂p1∂qm...
. . ....
∂2f
∂pn∂q1· · · ∂2f
∂pn∂qm
=[
∇2qpf]T.
Thus, for a function of the form f (p), where f : Rn → R we have
∇2ppf =
∂2f
∂p21· · · ∂2f
∂p1∂pn...
. . ....
∂2f
∂pn∂p1· · · ∂2f
∂p2n
=[
∇2ppf]T.
3.2 Optimal Control Problem
Consider the following general optimal control problem, determine the state,
y(t) ∈ Rny , the control u(t) ∈ R
nu , the integral q ∈ Rnq , the initial time, t0, and the
44
terminal time, tf , on the time interval t ∈ [t0, tf ] that minimize the cost functional
J = φ(y(t0), t0, y(tf ), tf , q) (3–1)
subject to the dynamic constraints
dy
dt= a(y(t), u(t), t), (3–2)
the inequality path constraints
cmin ≤ c(y(t), u(t), t) ≤ cmax, (3–3)
the integral constraints
qi =
∫ tf
t0
gi(y(t), u(t), t) dt, (i = 1, ... , nq), (3–4)
and the boundary conditions
bmin ≤ b(y(t0), t0, y(tf ), tf , q) ≤ bmin. (3–5)
The functions φ, q, a, c and b are defined by the following mappings:
φ : Rny × R× R
ny × R× Rnq → R,
g : Rny × R
nu × R → Rnq ,
a : Rny × R
nu × R → Rny ,
c : Rny × R
nu × R → Rnc ,
b : Rny × R× R
ny × R× Rnq → R
nb ,
where we remind the reader that all vector functions of time are treated as row vectors.
In this paper, it will be useful to modify the optimal control problem given in
Eqs. (3–1)–(3–5) as follows. Let τ ∈ [−1,+1] be a new independent variable. The
variable t is then defined in terms of τ as
t =tf − t02
τ +tf + t02. (3–6)
45
The optimal control problem of Eqs. (3–1)–(3–5) is then defined in terms of the variable
τ as follows. Determine the state, y(τ) ∈ Rny , the control u(τ) ∈ R
nu , the integral q ∈ Rnq ,
the initial time, t0, and the terminal time tf on the time interval τ ∈ [−1,+1] that minimize
the cost functional
J = φ(y(−1), t0, y(+1), tf , q) (3–7)
subject to the dynamic constraints
dy
dτ=tf − t02a(y(τ), u(τ), τ ; t0, tf ), (3–8)
the inequality path constraints
cmin ≤ c(y(τ), u(τ), τ ; t0, tf ) ≤ cmax, (3–9)
the integral constraints
qi =tf − t02
∫ +1
−1
gi(y(τ), u(τ), τ ; t0, tf ) dτ , (i = 1, ... , nq), (3–10)
and the boundary conditions
bmin ≤ b(y(−1), t0, y(+1), tf , q) ≤ bmin. (3–11)
Suppose now that the time interval τ ∈ [−1,+1] is divided into a mesh consisting of K
mesh intervals [Tk−1,Tk ], k = 1, ... ,K , where (T0, ... ,TK) are the mesh points. The
mesh points have the property that −1 = T0 < T1 < T2 < · · · < TK = Tf = +1. Next,
let y(k)(τ) and u(k)(τ) be the state and control in mesh interval k . The optimal control
problem of Eqs. (3–7)–(3–11) can then written as follows. First, the cost functional of
Eq. (3–7) can be written as
J = φ(y(1)(−1), t0, y(K)(+1), tf , q), (3–12)
46
Next, the dynamic constraints of Eq. (3–8) in mesh interval k can be written as
dy(k)(τ)
dτ=tf − t02a(y(k)(τ), u(k)(τ), τ ; t0, tf ), (k = 1, ... ,K). (3–13)
Furthermore, the path constraints of (3–9) in mesh interval k are given as
cmin ≤ c(y(k)(τ), u(k)(τ), τ ; t0, tf ) ≤ cmax, (k = 1, ... ,K). (3–14)
the integral constraints of (3–10) are given as
qi =tf − t02
K∑
k=1
∫ Tk
Tk−1
gi(y(k)(τ), u(k)(τ), τ ; t0, tf ) dτ , (i = 1, ... , nq), (k = 1, ... ,K).
(3–15)
Finally, the boundary conditions of Eq. (3–11) are given as
bmin ≤ b(y(1)(−1), t0, y(K)(+1), tf , q) ≤ bmax. (3–16)
Because the state must be continuous at each interior mesh point, it is required that the
condition y(T−k ) = y(T
+k ), be satisfied at the interior mesh points (T1, ... ,TK−1).
3.3 Variable-Order Legendre-Gauss-Radau Collocation Met hod
The multiple-interval form of the continuous-time optimal control problem in Section
3.2 is discretized using the previously developed Legendre-Gauss-Radau orthogonal
collocation method as described in Ref. [18]. While the Legendre-Gauss-Radau
orthogonal collocation method is chosen, with only slight modifications the approach
developed in this paper can be used with other orthogonal collocation methods
(e.g., the Legendre-Gauss orthogonal collocation method [15, 17, 23] or the
Legendre-Gauss-Lobatto orthogonal collocation method [13]). An advantage of
using the Legendre-Gauss-Radau orthogonal collocation method is that the continuity
conditions y(T−k ) = y(T
+k ) across mesh points are particularly easy to implement.
47
In the Lobatto, the state of the continuous-time optimal control problem is
approximated in each mesh interval k ∈ [1, ... ,K ] as
y(k)(τ) ≈ Y(k)(τ) =Nk+1∑
j=1
Y(k)j ℓ(k)j (τ), ℓ(k)j (τ) =
Nk+1∏
l=1l 6=j
τ − τ (k)l
τ (k)j − τ (k)l, (3–17)
where τ ∈ [−1,+1], ℓ(k)j (τ), j = 1, ... ,Nk + 1, is a basis of Lagrange polynomials,
(τ (k)1 , ... , τ(k)Nk) are the Legendre-Gauss-Radau [51] (LGR) collocation points in mesh
interval k defined on the subinterval τ ∈ [Tk−1,Tk), and τ (k)Nk+1 = Tk is a noncollocated
point. Differentiating Y(k)(τ) in Eq. (3–17) with respect to τ , we obtain
dY(k)(τ)
dτ=
Nk+1∑
j=1
Y(k)j
dℓ(k)j (τ)
dτ. (3–18)
The cost functional of Eq. (3–12) is then shown as
J = φ(Y(1)1 , t0,Y(K)NK+1, tK , q), (3–19)
where Y(1)1 is the approximation of y(T0 = −1), and Y(K)NK+1 is the approximation of
y(TK = +1). Collocating the dynamics of Eq. (3–13) at the Nk LGR points using
Eq. (3–18), we have
Nk+1∑
j=1
D(k)ij Y
(k)j − tf − t0
2a(Y
(k)i ,U
(k)i , τ
(k)i ; t0, tf ) = 0, (i = 1, ... ,Nk). (3–20)
where U(k)i , i = 1, ... ,Nk , are the approximations of the control at the Nk LGR points in
mesh interval k ∈ [1, ... ,K ], and t(k)i is obtained from τ (k)k using Eq. (3–6) and
D(k)ij =
[
dℓ(k)j (τ)
dτ
]
τ(k)i
, (i = 1, ... ,Nk , j = 1, ... ,Nk + 1, k = 1, ... ,K), (3–21)
is the Nk × (Nk + 1) Legendre-Gauss-Radau orthogonal collocation differentiation
matrix [18] in mesh interval k ∈ [1, ... ,K ]. While the dynamics can be collocated in
differential form, alternatively the dynamics can be collocated using the equivalent
integral form of the Legendre-Gauss-Radau orthogonal collocation method as described
48
in Refs. [18–20]. The integral form of the Legendre-Gauss-Radau orthogonal collocation
method is given as
Y(k)i+1 −Y
(k)1 − tf − t0
2
Nk∑
j=1
I(k)ij a(Y
(k)i ,U
(k)i , τ
(k)i ; t0, tf ) = 0, (i = 1, ... ,Nk), (3–22)
where I (k)ij , (i = 1, ... ,Nk , j = 1, ... ,Nk , k = 1, ... ,K) is the Nk × Nk Legendre-Gauss-
Radau orthogonal collocation integration matrix in mesh interval k ∈ [1, ... ,K ], and is
obtained from the differentiation matrix as
I(k) ≡ D−12:Nk+1
, (3–23)
Finally, it is noted for completeness that I(k)D(k)1 = −1, where 1 is a column vector
of length Nk of all ones. Next, the path constraints of Eq. (3–14) in mesh interval
k ∈ [1, ... ,K ] are enforced at the Nk LGR points as
cmin ≤ c(Y(k)i ,U(k)i , τ
(k)i ; t0, tf ) ≤ cmax, (i = 1, ... ,Nk), (3–24)
the integral constraints of Eq. (3–15) is then approximated as
qi ≈K∑
k=1
Nk∑
j=1
tf − t02w(k)j gi(Y
(k)j ,U
(k)j , τ
(k)j ; t0, tf ), (i = 1, ... , nq), (3–25)
where w (k)j , j = 1, ... ,Nk are the LGR quadrature weights [51] in mesh interval
k ∈ [1, ... ,K ] defined on the interval τ ∈ [Tk−1,Tk) Furthermore, the boundary
conditions of Eq. (3–16) are approximated as
bmin ≤ b(Y(1)1 , t0,Y(K)NK+1, tf , q) ≤ bmax. (3–26)
It is noted that continuity in the state at the interior mesh points k ∈ [1, ... ,K − 1] is
enforced via the condition
Y(k)Nk+1
= Y(k+1)1 , (k = 1, ... ,K − 1), (3–27)
49
where we note that the same variable is used for both Y(k)Nk+1 and Y(k+1)1 . Hence, the
constraint of Eq. (3–27) is eliminated from the problem because it is taken into account
explicitly. The NLP that arises from the Legendre-Gauss-Radau orthogonal collocation
method is then to minimize the cost function of Eq. (3–19) subject to the algebraic
constraints of Eqs. (3–20)–(3–26).
Suppose now that we define the following quantities in mesh intervals k ∈ [1, ... ,K−
1] and the final mesh interval K :
τ (k) =[
τ(k)i
]1
Nk
, k = 1, ... ,K − 1 , τ (K) =[
τ(K)i
]1
NK+1,
t(k) =[
t(k)i
]1
Nk
, k = 1, ... ,K − 1 , t(K) =[
t(K)i
]1
NK+1,
Y(k) =[
Y(k)i
]1
Nk
, k = 1, ... ,K − 1 , Y(K) =[
Y(K)i
]1
NK+1,
U(k) =[
U(k)i]1
Nk
, k = 1, ... ,K , A(k) =[
a(Y(k)i ,U
(k)i , τ
(k)i ; t0, tf )
]1
Nk
,
C(k) =[
c(Y(k)i ,U
(k)i , τ
(k)i ; t0, tf )
]1
Nk
, , G(k) =[
g(Y(k)i ,U
(k)i , τ
(k)i ; t0, tf )
]1
Nk
,
w(k) = [wi ]1Nk, , N =
K∑
k=1
Nk .
50
We then define the following quantities:
τ =
τ (1)
...
τ (K)
, t =
t(1)
...
t(K)
,
w =
w(1)
...
w(K)
, Y =
Y(1)
...
Y(K)
,
U =
U(1)
...
U(K)
, A =
A(1)
...
A(K)
,
C =
C(1)
...
C(K)
, G =
G(1)
...
G(K)
.
(3–28)
It is noted for completeness that t ∈ RN+1, τ ∈ R
N+1, Y ∈ R(N+1)×ny , U ∈ R
N×nu ,
G ∈ RN×nq , A ∈ R
N×ny , and C ∈ RN×nc . The cost function and discretized dynamic
constraints given in Eqs. (3–19) and (3–20) can then be written compactly as
J = φ(Y1, t0,YN+1, tf , q) (3–29)
∆ = DY − tf − t02A = 0, (3–30)
where ∆ ∈ RN×ny and D is the composite Legendre-Gauss-Radau orthogonal
collocation differentiation matrix. A schematic of the composite Legendre-Gauss-Radau
orthogonal collocation differentiation matrix D is shown in Fig. 3-1 where it is seen
that D has a block structure with nonzero elements in the row-column indices
51
Block 1
Block 2
Block 3
Block K
(2) Zeros Except in Blocks
(1) Block k is of Size Nk by Nk+1
(3) Total Size N by N+1
Figure 3-1. Structure of composite Legendre-Gauss-Radau orthogonal collocationdifferentiation matrix where the mesh consists of K mesh intervals.
(∑k−1l=1 Nl + 1, ... ,
∑k
l=1Nl ,∑k−1l=1 Nl + 1, ... ,
∑k
l=1Nl + 1), where for every mesh interval
k ∈ [1, ... ,K ] the nonzero elements are defined by the matrix given in Eq. (3–21). When
the dynamics are collocated in integral form, the dynamic constraints of Eq .(3–22) can
be written compactly as
∆ = EY − tf − t02IA = 0, (3–31)
where ∆ ∈ RN×ny , I is the composite Legendre-Gauss-Radau orthogonal
collocation integration matrix, and E is the value difference matrix. Schematics of
the composite Legendre-Gauss-Radau orthogonal collocation integration matrix
I, and the composite value difference matrix E are shown in Fig. 3-2, where it is
seen that I has a block structure with nonzero elements in the row-column indices
(∑k−1l=1 Nl + 1, ... ,
∑k
l=1Nl ,∑k−1l=1 Nl + 1, ... ,
∑k
l=1Nl), where for every mesh interval
k ∈ [1, ... ,K ] the nonzero elements are defined by the matrix given in Eq. (3–23). The
Radau value difference matrix E is used as a compact way compute the state difference
52
Y(k)i+1 − Y(k)1 , (i = 1, ... ,Nk, k = 1, ... ,K), where E(k)1 = 1 where 1 is a column vector
of length Nk of all ones, and E(k)2:Nk+1 is the negative identity matrix. Next, the discretized
path constraints of Eq. (3–24) are expressed as
Cmin ≤ C ≤ Cmax, (3–32)
where Cmin and Cmax are matrices of the same size as C and whose rows contain the
vectors cmin and cmax, respectively. Furthermore, the discretized integral constraints of
Eq. (3–25) are expressed as
ρ = q− tf − t02wTG = 0, (3–33)
where ρ ∈ RN×ny . Moreover, the discretized boundary conditions of Eq. (3–26) can be
written as
bmin ≤ b(Y1, t0,YN+1, tf , q) ≤ bmax. (3–34)
The nonlinear programming problem (NLP) associated with the Legendre-Gauss-Radau
orthogonal collocation method is then to minimize the cost function of Eq. (3–29) subject
to the algebraic constraints of Eqs. (3–30)–(3–34). Finally, let (α,β) ∈ RN+1 be defined
as
α =∂t
∂t0=1− τ2
, β =∂t
∂tf=1+ τ
2, (3–35)
where the derivatives in Eq. (3–35) are obtained from Eq. (3–6).
3.4 Legendre-Gauss-Radau Collocation Method NLP Derivati ves
The nonlinear programming problem (NLP) arising from the
Legendre-Gauss-Radau orthogonal collocation method presented in Section 3.3 has the
following general form. Determine the vector of decision variables z ∈ RN(ny+nc )+2 that
minimizes the cost function
f (z) (3–36)
53
Block 1
Block 2
Block 3
Block K
(2) Zeros Except in Blocks
(1) Block k is of Size Nk by Nk
(3) Total Size N by N
A Composite integration matrix
Block 1
Block 2
Block 3
Block K
(3) Zeros Except in Blocks
(1) Block k is of Size Nk by Nk+1
(4) Total Size N by N+1
-1
-1
-1
-1
-1
1
1
1
1
1
-1
-1
-1
-1
-1
1
1
1
1
1
-1
-1
-1
1
1
1
-1
-1
-1
-1
1
1
1
1
B Value difference matrix
Figure 3-2. Structures of composite Legendre-Gauss-Radau orthogonal collocationintegration and value difference matrices where the mesh consists of Kmesh intervals.
54
subject to the constraints
hmin ≤ h(z) ≤ hmax. (3–37)
In the case of the Legendre-Gauss-Radau orthogonal collocation method, the decision
vector, z, constraint function h(z), and cost function f (z) are given, respectively, as
z =
Y:,1
...
Y:,ny
U:,1...
U:,nu
q1:nq
t0
tf
, h =
∆:,1
...
∆:,ny
C:,1
...
C:,nc
ρ1:nq
b1:nb
, f (z) = φ(z), (3–38)
where φ is obtained directly from Eq. (3–29). We now systematically determine
expressions for the gradient of the NLP objective function, the Jacobian of the NLP
constraints, and the Hessian of the NLP Lagrangian. The key result of this section
is that these NLP derivatives are obtained by differentiating the functions of the
continuous-time optimal control problem as defined in Eqs. (3–1)–(3–5) of Section
3.2 as opposed to differentiating the functions of the NLP.
3.4.1 Gradient of Objective Function
The gradient of the objective function in Eq. (3–38) with respect to the
Legendre-Gauss-Radau orthogonal collocation method NLP decision vector z is given
as
∇zf = ∇zφ. (3–39)
55
The derivative ∇zφ is obtained as
∇zφ =[
∇Yφ ∇Uφ ∇qφ ∇t0φ ∇tf φ]
, (3–40)
where
∇Yφ =
[
∇Y:,1φ · · · ∇Y:,ny φ]
,
∇Uφ = [01×Nnu ] ,
∇qφ =
[
∇q1φ · · · ∇qnqφ]
,
(3–41)
The derivatives ∇Y:,iφ, ∇qiφ, ∇t0φ and ∇tf φ are obtained as
∇Y:,iφ =
[
∂φ
∂Y1,i01×(N−1)
∂φ
∂YN+1,i
]
, i = 1, ... , ny
∇qkφ =∂φ
∂qk, k = 1, ... , nq
∇t0φ =∂φ
∂t0,
∇tf φ =∂φ
∂tf,
(3–42)
where (i , l = 1, ... , ny ), and (k = 1, ... , nq) It is seen from Eqs. (3–39)–(3–42) that
computing the objective function gradient, ∇zf , requires the first derivatives of φ be
computed with respect to the initial state, Y1, initial time, t0, final state, YN+1, final time,
tf , and the integral variables q. The NLP objective function gradient is then assembled
using the equations derived in this section.
56
3.4.2 Constraint Jacobian Differential Form
The Jacobian of the constraints is defined as
∇zh =
∇z∆:,1...
∇z∆:,ny∇zC:,1
...
∇zC:,nc∇zρ1
...
∇zρnb∇zb1
...
∇zbnb
(3–43)
The first derivatives of the defect constraints are obtained as
∇z∆:,l =[
∇Y∆:,l ∇U∆:,l ∇q∆:,l ∇t0∆:,l ∇tf∆:,l]
, l = 1, ... , ny , (3–44)
where
∇Y∆:,l =[
∇Y:,1∆:,l · · · ∇Y:,ny∆:,l]
∇U∆:,l =
[
∇U:,1∆:,l · · · ∇U:,nu∆:,l
]
∇q∆:,l = 0N×nq
, l = 1, ... , ny . (3–45)
57
The first derivatives ∇Y:,i∆:,l , (i , l = 1, ... , ny ), ∇U:,j∆:,l , (j = 1, ... , nu, l = 1, ... , ny ), ∇t0∆:,l ,
(l = 1, ... , ny ), and ∇tf∆:,l , (l = 1, ... , ny), can be obtained as
∇Y:,i∆:,l =[
δilD:,1:N − tf−t02diag
(
[
∂al∂yi
]1
N
)
δD:,N+1
]
,
∇U:,j∆:,l = −tf − t02diag
(
[
∂al∂uj
]1
N
)
,
∇t0∆:,l =1
2[al ]
1N − tf − t0
2α
[
∂al∂t
]1
N
,
∇tf∆:,l = −12[al ]
1N − tf − t0
2β
[
∂al∂t
]1
N
,
(3–46)
where (i , l = 1, ... , ny), and (j = 1, ... , nu). Furthermore, δil is the Kronecker delta
function
δil =
1 , i = l
0 , otherwise.
The first derivatives of the path constraints are given as
∇zC:,p =[
∇YC:,p ∇UC:,p ∇qC:,p ∇t0C:,p ∇tfC:,p]
, p = 1, ... , nc , (3–47)
where
∇YC:,p =[
∇Y:,1C:,p · · · ∇Y:,nyC:,p]
∇UC:,p =
[
∇U:,1C:,p · · · ∇U:,nuC:,p
]
∇qC:,p = 0N×nq
, p = 1, ... , nc . (3–48)
58
The first derivatives ∇Y:,iC:,p, ∇U:,jC:,p, ∇t0C:,p and ∇tfC:,p can be found in a sparse
manner as
∇Y:,iC:,p =[
diag
(
[
∂cp∂yi
]1
N
)
0N×1
]
,
∇U:,jC:,p = diag
(
[
∂cp∂uj
]1
N
)
,
∇t0C:,p = α [
∂cp∂t
]1
N
,
∇tfC:,p = β [
∂cp∂t
]1
N
,
(3–49)
where (i = 1, ... , ny), (j = 1, ... , nu), and (p = 1, ... , nc). The first derivatives of the
integral constraints are given as
∇zρr =[
∇Yρr ∇Uρr ∇qρr ∇t0ρr ∇tf ρr]
, r = 1, ... , nq. (3–50)
where
∇Yρr =[
∇Y:,1ρr · · · ∇Y:,ny ρr]
,
∇Uρr =
[
∇U:,1ρr · · · ∇U:,nu ρr
]
,
∇qρr =[
∇q1ρr · · · ∇qnq ρr]
,
r = 1, ... , nq. (3–51)
59
The derivatives ∇Y:,iγ, ∇U:,jγ, ∇t0γ and ∇tf γ are obtained as
∇Y:,iρr =[
− tf−t02
w [
∂gr∂yi
]1
N
T
0
]
,
∇U:,jρr = − tf−t02
w [
∂gr∂uj
]1
N
T
,
∇qkρr =
1 , k = r ,
0 , k 6= r ,
∇t0ρr = 12wT [gr ]
1N − tf−t0
2wT
α [
∂gr∂t
]1
N
,
∇tf ρr = −12wT [gr ]
1N − tf−t0
2wT
β [
∂gr∂t
]1
N
,
(3–52)
where (i = 1, ... , ny), (j = 1, ... , nu), and (k , r = 1, ... , nq). The first derivatives of the
boundary conditions are given as
∇zbm =[
∇Ybm ∇Ubm ∇qbm ∇t0bm ∇tf bm]
, m = 1, ... , nq, (3–53)
where
∇Ybm =
[
∇Y:,1bm · · · ∇Y:,ny bm]
∇Ubm = 01×Nnu
∇qbm =
[
∇q1bm · · · ∇qnq bm]
,
, m = 1, ... , nq. (3–54)
The first derivatives ∇Y:,ibm, ∇t0bm and ∇tf bm can be found in a sparse manner as
∇Y:,ibm =
[
∂bm∂Y1,i
01×N−1∂bm
∂YN+1,i
]
,
∇qkbm =∂bm∂qk,
∇t0bm =∂bm∂t0,
∇tf bm =∂bm∂tf,
(3–55)
60
Def
ect
1
State 1 State 2 State ny
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Zeros or Diagonal
Block+D-M
atrix Zeros or D
iagonal
Block+D-M
atrix
D
efec
t 2
Def
ect
ny
Control 1 Control nu
Pat
h 1
Either Zeros or
Diagonal Block
Pat
h n
c
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Bo
un
dar
yC
on
dit
ion
s
Either Zeros orEndpoints only
Either Zeros orEndpoints only All Zeros
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Zeros or Diagonal
Block+D-M
atrixEither Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
t0 tf
q1 qnq
ρn
qρ
1
Identity
All Zeros
All Zeros
Figure 3-3. General Jacobian sparsity pattern for the Legendre-Gauss-Radauorthogonal collocation differential Scheme.
where (i = 1, ... , ny), (k = 1, ... , nq), and (m = 1, ... , nb).
It is seen from Eqs. (3–43)–(3–55) that the NLP constraint Jacobian requires that
the first derivatives of a, c, and ρ be determined with respect to the continuous-time
state, y, continuous-time control, u, and continuous-time, t, and that the derivatives
of b be computed with respect to the initial state, Y1, the initial time, t0, the final state,
YN+1, the final time, tf , and the integral variables q. Furthermore, these derivatives are
computed at either the N collocation points (in the case of the derivatives of a, c, and
ρ) or are computed at the endpoints (in the case of b). The NLP constraint Jacobian is
61
then assembled using the equations derived in this section. The sparsity pattern for a
general Legendre-Gauss-Radau orthogonal collocation method NLP constraint Jacobian
is shown in Fig. 3-3.
3.4.3 Constraint Jacobian Integral Form
The Jacobian of the constraints is defined as
∇zh =
∇z∆:,1...
∇z∆:,ny∇zC:,1
...
∇zC:,nc∇zρ1
...
∇zρnb∇zb1
...
∇zbnb
(3–56)
The first derivatives of the defect constraints are obtained as
∇z∆:,l =[
∇Y∆:,l ∇U∆:,l ∇q∆:,l ∇t0∆:,l ∇tf∆:,l]
, l = 1, ... , ny , (3–57)
where
∇Y∆:,l =[
∇Y:,1∆:,l · · · ∇Y:,ny∆:,l]
∇U∆:,l =
[
∇U:,1∆:,l · · · ∇U:,nu∆:,l
]
∇q∆:,l = 0N×nq
, l = 1, ... , ny . (3–58)
62
The first derivatives ∇Y:,i∆:,l , (i , l = 1, ... , ny ), ∇U:,j∆:,l , (j = 1, ... , nu, l = 1, ... , ny ), ∇t0∆:,l ,
(l = 1, ... , ny ), and ∇tf∆:,l , (l = 1, ... , ny), can be obtained as
∇Y:,i∆:,l =[
δilE:,1:N − tf−t02I ∗ diag
(
[
∂al∂yi
]1
N
)
δE:,N+1
]
,
∇U:,j∆:,l = −tf − t02I ∗ diag
(
[
∂al∂uj
]1
N
)
,
∇t0∆:,l =1
2I [al ]
1N − tf − t0
2I
(
α [
∂al∂t
]1
N
)
∇tf∆:,l = −12I [al ]
1N − tf − t0
2I
(
β [
∂al∂t
]1
N
)
,
(3–59)
where (i , l = 1, ... , ny), and (j = 1, ... , nu). Furthermore, δil is the Kronecker delta
function
δil =
1 , i = l
0 , otherwise.
The first derivatives of the path constraints are given as
∇zC:,p =[
∇YC:,p ∇UC:,p ∇qC:,p ∇t0C:,p ∇tfC:,p]
, p = 1, ... , nc , (3–60)
where
∇YC:,p =[
∇Y:,1C:,p · · · ∇Y:,nyC:,p]
∇UC:,p =
[
∇U:,1C:,p · · · ∇U:,nuC:,p
]
∇qC:,p = 0N×nq
, p = 1, ... , nc . (3–61)
63
The first derivatives ∇Y:,iC:,p, ∇U:,jC:,p, ∇t0C:,p and ∇tfC:,p can be found in a sparse
manner as
∇Y:,iC:,p =[
diag
(
[
∂cp∂yi
]1
N
)
0N×1
]
,
∇U:,jC:,p = diag
(
[
∂cp∂uj
]1
N
)
,
∇t0C:,p = α [
∂cp∂t
]1
N
,
∇tfC:,p = β [
∂cp∂t
]1
N
,
(3–62)
where (i = 1, ... , ny), (j = 1, ... , nu), and (p = 1, ... , nc). The first derivatives of the
integral constraints are given as
∇zρr =[
∇Yρr ∇Uρr ∇qρr ∇t0ρr ∇tf ρr]
, r = 1, ... , nq. (3–63)
where
∇Yρr =[
∇Y:,1ρr · · · ∇Y:,ny ρr]
,
∇Uρr =
[
∇U:,1ρr · · · ∇U:,nu ρr
]
,
∇qρr =[
∇q1ρr · · · ∇qnq ρr]
,
r = 1, ... , nq. (3–64)
64
The derivatives ∇Y:,iγ, ∇U:,jγ, ∇t0γ and ∇tf γ are obtained as
∇Y:,iρr =[
− tf−t02
w [
∂gr∂yi
]1
N
T
0
]
,
∇U:,jρr = − tf−t02
w [
∂gr∂uj
]1
N
T
,
∇qkρr =
1 , k = r ,
0 , k 6= r ,
∇t0ρr = 12wT [gr ]
1N − tf−t0
2wT
α [
∂gr∂t
]1
N
,
∇tf ρr = −12wT [gr ]
1N − tf−t0
2wT
β [
∂gr∂t
]1
N
,
(3–65)
where (i = 1, ... , ny), (j = 1, ... , nu), and (k , r = 1, ... , nq). The first derivatives of the
boundary conditions are given as
∇zbm =[
∇Ybm ∇Ubm ∇qbm ∇t0bm ∇tf bm]
, m = 1, ... , nq, (3–66)
where
∇Ybm =
[
∇Y:,1bm · · · ∇Y:,ny bm]
∇Ubm = 01×Nnu
∇qbm =
[
∇q1bm · · · ∇qnq bm]
,
, m = 1, ... , nq. (3–67)
The first derivatives ∇Y:,ibm, ∇t0bm and ∇tf bm can be found in a sparse manner as
∇Y:,ibm =
[
∂bm∂Y1,i
01×N−1∂bm
∂YN+1,i
]
,
∇qkbm =∂bm∂qk,
∇t0bm =∂bm∂t0,
∇tf bm =∂bm∂tf,
(3–68)
65
Def
ect
1
State 1 State 2 State ny
D
efec
t 2
Def
ect
ny
Control 1 Control nu
Pat
h 1
Either Zeros or
Diagonal Block
Pat
h n
c
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Bo
un
dar
yC
on
dit
ion
s
Either Zeros orEndpoints only
Either Zeros orEndpoints only All Zeros
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
t0 tf
q1 qnq
ρn
qρ
1
Identity
All Zeros
All Zeros
Zeros or Integration
Block+F-Matrix
Zeros or Integration
Block+F-Matrix
Zeros or Integration
Block+F-Matrix
Either Zeros or
Integration Block
Either Zeros or
Integration Block
Either Zeros or
Integration Block
Either Zeros or
Integration Block
Either Zeros or
Integration Block
Either Zeros or
Integration Block
Either Zeros or
Integration Block
Either Zeros or
Integration Block
Either Zeros or
Integration Block
Either Zeros or
Integration Block
Figure 3-4. General Jacobian sparsity pattern for the Legendre-Gauss-Radauorthogonal collocation integral scheme.
where (i = 1, ... , ny), (k = 1, ... , nq), and (m = 1, ... , nb).
It is seen from Eqs. (3–56)–(3–68) that the NLP constraint Jacobian requires that
the first derivatives of a, c, and ρ be determined with respect to the continuous-time
state, y, continuous-time control, u, and continuous-time, t, and that the derivatives
of b be computed with respect to the initial state, Y1, the initial time, t0, the final state,
YN+1, the final time, tf , and the integral variables q. Furthermore, these derivatives are
computed at either the N collocation points (in the case of the derivatives of a, c, and
ρ) or are computed at the endpoints (in the case of b). The NLP constraint Jacobian is
66
then assembled using the equations derived in this section. The sparsity pattern for a
general Legendre-Gauss-Radau orthogonal collocation method NLP constraint Jacobian
is shown in Fig. 3-4.
3.4.4 Lagrangian Hessian
The Lagrangian of the NLP given in Eqs. (3–36) and (3–37) is defined as
L = σf (z) + ΛTh(z), (3–69)
where σ ∈ R and Λ ∈ RN(ny+nc )+nq+nm is a vector of Lagrange multipliers. The vector Λ is
given as
Λ =
Γ:,1
...
Γ:,ny
Ψ:,1
...
Ψ:,nc
η
ν
, (3–70)
where Γi,j , (i = 1, ... ,N, j = 1, ... , ny ) are the Lagrange multipliers associated with
the defect constraints of Eq. (3–30), Ψi,j , (i = 1, ... ,N, i = 1, ... , nc) are the Lagrange
multipliers associated with the path constraints of Eq. (3–32), ηi , (i = 1, ... , nq) are the
Lagrange multipliers associated with Eq. (3–33), and νi , (i = 1, ... , nb) are the Lagrange
multipliers associated with the boundary conditions of Eq. (3–34). The Lagrangian can
then be represented as
L = σφ+
ny∑
i=1
ΓT:,i∆:,i +
nc∑
p=1
ΨT:,pC:,p +
nq∑
r=1
ηrρr +
nb∑
m=1
νmbm (3–71)
67
For convenience in the discussion that follows, the Hessian of the Lagrangian will be
decomposed into two parts as
∇2zzL = ∇2zzLE +∇2zzLI , (3–72)
where LE represents those parts of the Lagrangian that are functions of the endpoints
functions φ and b,
LE = σφ+
nb∑
q=1
νqbq, (3–73)
while LI represents those parts of the Lagrangian that are functions of collocation point
functions, ∆, C and ρ,
LI =ny∑
i=1
ΓT:,i∆:,i +
nc∑
p=1
ΨT:,pC:,p +
nq∑
r=1
ηrρr . (3–74)
In the next subsections we describe the second derivatives of the functions LE and LI .
It is noted that the Hessian is symmetric, thus, only the lower triangular portion of ∇2zzLEand ∇2zzLI are computed.
3.4.4.1 Hessian of endpoint function
The Hessian of LE with respect to the decision variable vector z, denoted ∇2zzLE , is
defined as
∇2zzLE =
∇2YYLE (∇2UYLE)T (∇2qYLE)T (∇2t0YLE)T (∇2tf YLE)T
∇2UYLE ∇2UULE (∇2qULE)T (∇2t0ULE)T (∇2tf ULE)T
∇2qYLE ∇2qULE ∇2qqLE (∇2t0qLE)T (∇2tf qLE)T
∇2t0YLE ∇2t0ULE ∇2t0qLE ∇2t0t0LE (∇2tf t0LE)T
∇2tf YLE ∇2tf ULE ∇2tf qLE ∇2tf t0LE ∇2tf tfLE
, (3–75)
68
where the blocks of ∇2zzLE are defined as
∇2YYLE =
∇2Y:,1Y:,1LE(
∇2Y:,2Y:,1LE)T · · ·
(
∇2Y:,ny Y:,1LE)T
∇2Y:,2Y:,1LE ∇2Y:,2Y:,2LE · · ·(
∇2Y:,ny Y:,2LE)T
......
. . ....
∇2Y:,ny Y:,1LE ∇2Y:,ny Y:,2LE · · · ∇2Y:,ny Y:,nyLE
,
∇2qYLE =
∇2q1Y:,1LE · · · ∇2q1Y:,nyLE...
. . ....
∇2qnqY:,1LE · · · ∇2qnqY:,nyLE
,
∇2qqLE =
∇2q1q1LE(
∇2q2q1LE)T · · ·
(
∇2qnq q1LE)T
∇2q2q1LE ∇2q2q2LE · · ·(
∇2qnq q2LE)T
......
. . ....
∇2qnqq1LE ∇2qnq q2LE · · · ∇2qnq qnqLE
,
∇2t0YLE =[
∇2t0Y:,1LE · · · ∇2t0Y:,nyLE]
,
∇2t0qLE =[
∇2t0q1LE · · · ∇2t0qnqLE]
,
∇2tf YLE =[
∇2tf Y:,1LE · · · ∇2tf Y:,nyLE]
,
∇2tf qLE =[
∇2tf q1LE · · · ∇2tf qnqLE]
,
where
∇2UYLE = 0Nnu×(N+1)ny ,
∇2UULE = 0Nnu×Nnu ,
∇2qULE = 0nq×Nnu ,
∇2t0ULE = 01×Nnu ,
∇2tf ULE = 01×Nnu .
69
The matrices ∇2Y:,iY:,jLE , ∇2qkY:,jLE , ∇2qkqrLE , ∇2t0Y:,jLE , ∇2t0qrLE , ∇2t0t0LE , ∇2tf Y:,jLE ,
∇2tf qrLE , ∇2tf t0LE and ∇2tf tfLE are obtained in a sparse manner as
∇2Y:,iY:,jLE =
∂2LE∂Y1,i∂Y1,j
01×N−1∂2LE
∂Y1,i∂YN+1,j
0N−1×1 0N−1×N−1 0N−1×1
∂2LE∂YN+1,i∂Y1,j
01×N−1∂2LE
∂YN+1,i∂YN+1,j
,(i = 1, ... , ny ),
(j = 1, ... , i),
∇2t0Y:,jLE =
[
∂2LE∂t0∂Y1,j
01×N−1∂2LE
∂t0∂YN+1,j
]
, (j = 1, ... , ny),
∇2qkY:,jLE =
[
∂2LE∂qk∂Y1,j
01×N−1∂2LE
∂qk∂YN+1,j
]
,(k = 1, ... , nq),
(j = 1, ... , ny),
∇2qkqrLE =∂2LE∂qk∂qr
,(k = 1, ... , nq),
(r = 1, ... , k),
∇2t0qrLE =∂2LE∂t0∂qr
, (r = 1, ... , nq),
∇2t0t0LE =∂2LE∂t20,
∇2tf Y:,jLE =
[
∂2LE∂tf ∂Y1,j
01×N−1∂2LE
∂tf ∂YN+1,j
]
, (j = 1, ... , ny),
∇2tf qrLE =∂2LE∂tf ∂qr
, (r = 1, ... , nq),
∇2tf t0LE =∂2LE∂tf ∂t0
,
∇2tf tfLE =∂2LE∂t2f,
(3–76)
where we recall that LE is itself a function of the Mayer cost, φ, and the boundary
condition function, b. Because φ and b are functions of the continuous-time optimal
control problem, the Hessian ∇2zzLE with respect to the NLP decision vector z can itself
70
be obtained by differentiating the functions of the continuous-time optimal control prob-
lem, and assembling these derivatives into the correct locations of the NLP Lagrangian
Hessian.
3.4.4.2 Hessian of collocation point function differentia l form
The Hessian ∇2zzLI is defined as
∇2zzLI =
∇2YYLI (∇2UYLI )T (∇2qYLI )T (∇2t0YLI)T (∇2tfYLI )T
∇2UYLI ∇2UULI (∇2qULI )T (∇2t0ULI )T (∇2tfULI )T
∇2qYLI ∇2qULI ∇2qqLI (∇2t0qLI )T (∇2tf qLI)T
∇2t0YLI ∇2t0ULI ∇2t0qLI ∇2t0t0LI (∇2tf t0LI)T
∇2tf YLI ∇2tf ULI ∇2tf qLI ∇2tf t0LI ∇2tf tfLI
, (3–77)
71
where the blocks of ∇2zzLI are given as
∇2YYLI =
∇2Y:,1Y:,1LI(
∇2Y:,2Y:,1LI)T · · ·
(
∇2Y:,ny Y:,1LI)T
∇2Y:,2Y:,1LI ∇2Y:,2Y:,2LI · · ·(
∇2Y:,ny Y:,2LI)T
......
. . ....
∇2Y:,ny Y:,1LI ∇2Y:,ny Y:,2LI · · · ∇2Y:,ny Y:,nyLI
,
∇2UYLI =
∇2U:,1Y:,1LI · · · ∇2U:,1Y:,nyLI...
. . ....
∇2U:,nuY:,1LI · · · ∇2U:,nuY:,nyLI
,
∇2UULI =
∇2U:,1U:,1LI(
∇2U:,2U:,1LI)T
· · ·(
∇2U:,nuU:,1LI)T
∇2U:,2U:,1LI ∇2U:,2U:,2LI · · ·(
∇2U:,nuU:,2LI)T
......
. . ....
∇2U:,nuU:,1LI ∇2U:,nuU:,2LI · · · ∇2U:,nuU:,nuLI
,
∇2t0YLI =[
∇2t0Y:,1LI · · · ∇2t0Y:,nyLI]
,
∇2t0ULI =[
∇2t0U:,1LI · · · ∇2t0U:,nuLI]
,
∇2tf YLI =[
∇2tf Y:,1LI · · · ∇2tf Y:,nyLI]
,
∇2tf ULI =[
∇2tf U:,1LI · · · ∇2tf U:,nuLI]
,
where
∇2qYLI = 0nq×(N+1)ny ,
∇2qULI = 0nq×Nnu ,
∇2qqLI = 0nq×nq ,
∇2t0qLI = 01×nq ,
∇2tf qLI = 01×nq .
72
The matrices ∇2Y:,iY:,jLI , ∇2U:,iY:,jLI , ∇2U:,iU:,jLI , ∇2t0Y:,jLI , ∇2t0U:,jLI , ∇2t0t0LI , ∇2tf Y:,jLI ,
∇2tf U:,jLI , ∇2tf t0LI and ∇2tf tfLI are obtained in a sparse manner as
∇2Y:,iY:,jLI =
diag
(
[
∂2LI∂yi∂yj
]1
N
)
0N×1
01×N 0
, (i = 1, ... , ny , j = 1, ... , i),
∇2U:,iY:,jLI =[
diag
(
[
∂2LI∂ui∂yj
]1
N
)
0N×1
]
, (i = 1, ... , nu, j = 1, ... , ny ),
∇2U:,iU:,jLI = diag
(
[
∂2LI∂ui∂uj
]1
N
)
, (i = 1, ... , nu, j = 1, ... , i),
∇2t0Y:,jLI =
[
[
∂2LI∂t0∂yj
]1
N
T
0
]
, (j = 1, ... , ny),
∇2t0U:,jLI =
[
∂2LI∂t0∂uj
]1
N
T
, (j = 1, ... , nu),
∇2t0t0LI =∂2LI∂t20,
∇2tf Y:,jLI =
[
[
∂2LI∂tf ∂yj
]1
N
T
0
]
, (j = 1, ... , ny ),
∇2tf U:,jLI =
[
∂2LI∂tf ∂uj
]1
N
T
, (j = 1, ... , nu),
∇2tf t0LI =∂2LI∂tf ∂t0
,
∇2tf tfLI =∂2LI∂t2f.
(3–78)
It is seen that the derivatives given in Eq. (3–78) are functions of the derivatives of LIwith respect to the components of the continuous-time state, y(t), the components
of the continuous-time control, u(t), the initial time, t0, and the final time, tf . The
derivatives[
∂2LI∂yi∂yj
]1
N,[
∂2LI∂ui∂yj
]1
N,[
∂2LI∂ui∂uj
]1
N,[
∂2LI∂t0∂yj
]1
N,[
∂2LI∂t0∂uj
]1
N, ∂2LI
∂t20,[
∂2LI∂tf ∂yj
]1
N,[
∂2LI∂tf ∂uj
]1
N,
73
∂2LI∂tf ∂t0
, and ∂2LI∂t2f
are given, respectively, as
[
∂2LI∂yi∂yj
]1
N
= −tf − t02
ny∑
l=1
Γ:,l [
∂2al∂yi∂yj
]1
N
+
nq∑
k=1
ηkw [
∂2gk∂yi∂yj
]1
N
+
nc∑
p=1
Ψ:,p [
∂2cp∂yi∂yj
]1
N
, (i , j = 1, ... , ny),
(3–79)
[
∂2LI∂ui∂yj
]1
N
= −tf − t02
ny∑
l=1
Γ:,l [
∂2al∂ui∂yj
]1
N
+
nq∑
k=1
ηkw [
∂2gk∂ui∂yj
]1
N
+
nc∑
p=1
Ψ:,p [
∂2cp∂ui∂yj
]1
N
, (i = 1, ... , nu, j = 1, ... , ny ),
(3–80)
[
∂2LI∂ui∂uj
]1
N
= −tf − t02
ny∑
l=1
Γ:,l [
∂2al∂ui∂uj
]1
N
+
nq∑
k=1
ηkw [
∂2gk∂ui∂uj
]1
N
+
nc∑
p=1
Ψ:,p [
∂2cp∂ui∂uj
]1
N
, (i , j = 1, ... , nu),
(3–81)
[
∂2LI∂t0∂yj
]1
N
=1
2
ny∑
l=1
Γ:,l [
∂al∂yj
]1
N
+
nq∑
k=1
ηkw [
∂gk∂yj
]1
N
− tf − t02
α
ny∑
l=1
Γ:,l [
∂2al∂t∂yj
]1
N
+
nq∑
k=1
ηkw [
∂2gk∂t∂yj
]1
N
+α
nc∑
p=1
Ψ:,p [
∂2cp∂t∂yj
]1
N
, (j = 1, ... , ny),
(3–82)
[
∂2LI∂t0∂uj
]1
N
=1
2
ny∑
l=1
Γ:,l [
∂al∂uj
]1
N
+
nq∑
k=1
ηkw [
∂gk∂uj
]1
N
− tf − t02
α
ny∑
l=1
Γ:,l [
∂2al∂t∂uj
]1
N
+
nq∑
k=1
ηkw [
∂2gk∂t∂uj
]1
N
+α
nc∑
p=1
Ψ:,p [
∂2cp∂t∂uj
]1
N
, (j = 1, ... , nu),
(3–83)
74
∂2LI∂t20
= αT
ny∑
l=1
Γ:,l [
∂al∂t
]1
N
+
nq∑
k=1
ηkw [
∂gk∂t
]1
N
− tf − t02
αT
[
ny∑
l=1
Γ:,l [
∂2al∂t2
]1
N
+
nq∑
k=1
ηkw [
∂2gk∂t2
]1
N
α]
+αT
[
nc∑
p=1
Ψ:,p [
∂2cp∂t2
]1
N
α]
,
(3–84)
[
∂2LI∂tf ∂yj
]1
N
= −12
ny∑
l=1
Γ:,l [
∂al∂yj
]1
N
+
nq∑
k=1
ηkw [
∂gk∂yj
]1
N
− tf − t02
β
ny∑
l=1
Γ:,l [
∂2al∂t∂yj
]1
N
+
nq∑
k=1
ηkw [
∂2gk∂t∂yj
]1
N
+ β
nc∑
p=1
Ψ:,p [
∂2cp∂t∂yj
]1
N
, (j = 1, ... , ny),
(3–85)
[
∂2LI∂tf ∂uj
]1
N
= −12
ny∑
l=1
Γ:,l [
∂al∂uj
]1
N
+
nq∑
k=1
ηkw [
∂gk∂uj
]1
N
− tf − t02
β
ny∑
l=1
Γ:,l [
∂2al∂t∂uj
]1
N
+
nq∑
k=1
ηkw [
∂2gk∂t∂uj
]1
N
+ β
nc∑
p=1
Ψ:,p [
∂2cp∂t∂uj
]1
N
, (j = 1, ... , nu),
(3–86)
∂2LI∂tf ∂t0
= −12αT
ny∑
l=1
Γ:,l [
∂al∂t
]1
N
+
nq∑
k=1
ηkw [
∂gk∂t
]1
N
+1
2βT
ny∑
l=1
Γ:,l [
∂al∂t
]1
N
+
nq∑
k=1
ηkw [
∂gk∂t
]1
N
− tf − t02
αT
[
ny∑
l=1
Γ:,l [
∂2al∂t2
]1
N
+
nq∑
k=1
ηkw [
∂2gk∂t2
]1
N
β]
+αT
[
nc∑
p=1
Ψ:,p [
∂2cp∂t2
]1
N
β]
,
(3–87)
75
Control nu
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
t0 tf
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Diagonal Block
With Corners
Diagonal Block
With Corners
Diagonal Block
With Corners
Diagonal Block
With Corners
Control 1 State ny State 1
q1 qnq
All Zeros
All Zeros
Figure 3-5. General Hessian sparsity pattern for the Legendre-Gauss-Radau orthogonalcollocation differential scheme.
∂2LI∂t2f
= −βT
ny∑
l=1
Γ:,l [
∂al∂t
]1
N
+
nq∑
k=1
ηkw [
∂gk∂t
]1
N
− tf − t02
βT
[
ny∑
l=1
Γ:,l [
∂2al∂t2
]1
N
+
nq∑
k=1
ηkw [
∂2gk∂t2
]1
N
β]
+ βT
[
nc∑
p=1
Ψ:,p [
∂2cp∂t2
]1
N
β]
.
(3–88)
It is seen from the above derivation that the Hessian of LI with respect to the NLP
decision vector z is a function of the first and second derivatives of the functions a and
g, and the second derivatives of the function c, where a, c, and g are defined in the
76
optimal control problem of Section 3.2. Thus, the Hessian of LI can be obtained as a
function of derivatives associated with the functions of the optimal control problem stated
in Section 3.2. Figure. 3-5 shows the sparsity pattern of a general NLP Lagrangian
Hessian obtained from the discretization of the continuous-time problem using the
Legendre-Gauss-Radau orthogonal collocation method.
3.4.4.3 Hessian of collocation point function integral for m
The Hessian ∇2zzLI is defined as
∇2zzLI =
∇2YYLI (∇2UYLI )T (∇2qYLI )T (∇2t0YLI)T (∇2tfYLI )T
∇2UYLI ∇2UULI (∇2qULI )T (∇2t0ULI )T (∇2tfULI )T
∇2qYLI ∇2qULI ∇2qqLI (∇2t0qLI )T (∇2tf qLI)T
∇2t0YLI ∇2t0ULI ∇2t0qLI ∇2t0t0LI (∇2tf t0LI)T
∇2tf YLI ∇2tf ULI ∇2tf qLI ∇2tf t0LI ∇2tf tfLI
, (3–89)
77
where the blocks of ∇2zzLI are given as
∇2YYLI =
∇2Y:,1Y:,1LI(
∇2Y:,2Y:,1LI)T · · ·
(
∇2Y:,ny Y:,1LI)T
∇2Y:,2Y:,1LI ∇2Y:,2Y:,2LI · · ·(
∇2Y:,ny Y:,2LI)T
......
. . ....
∇2Y:,ny Y:,1LI ∇2Y:,ny Y:,2LI · · · ∇2Y:,ny Y:,nyLI
,
∇2UYLI =
∇2U:,1Y:,1LI · · · ∇2U:,1Y:,nyLI...
. . ....
∇2U:,nuY:,1LI · · · ∇2U:,nuY:,nyLI
,
∇2UULI =
∇2U:,1U:,1LI(
∇2U:,2U:,1LI)T
· · ·(
∇2U:,nuU:,1LI)T
∇2U:,2U:,1LI ∇2U:,2U:,2LI · · ·(
∇2U:,nuU:,2LI)T
......
. . ....
∇2U:,nuU:,1LI ∇2U:,nuU:,2LI · · · ∇2U:,nuU:,nuLI
,
∇2t0YLI =[
∇2t0Y:,1LI · · · ∇2t0Y:,nyLI]
,
∇2t0ULI =[
∇2t0U:,1LI · · · ∇2t0U:,nuLI]
,
∇2tf YLI =[
∇2tf Y:,1LI · · · ∇2tf Y:,nyLI]
,
∇2tf ULI =[
∇2tf U:,1LI · · · ∇2tf U:,nuLI]
,
where
∇2qYLI = 0nq×(N+1)ny ,
∇2qULI = 0nq×Nnu ,
∇2qqLI = 0nq×nq ,
∇2t0qLI = 01×nq ,
∇2tf qLI = 01×nq .
78
The matrices ∇2Y:,iY:,jLI , ∇2U:,iY:,jLI , ∇2U:,iU:,jLI , ∇2t0Y:,jLI , ∇2t0U:,jLI , ∇2t0t0LI , ∇2tf Y:,jLI ,
∇2tf U:,jLI , ∇2tf t0LI and ∇2tf tfLI are obtained in a sparse manner as
∇2Y:,iY:,jLI =
diag
(
[
∂2LI∂yi∂yj
]1
N
)
0N×1
01×N 0
, (i = 1, ... , ny , j = 1, ... , i),
∇2U:,iY:,jLI =[
diag
(
[
∂2LI∂ui∂yj
]1
N
)
0N×1
]
, (i = 1, ... , nu, j = 1, ... , ny ),
∇2U:,iU:,jLI = diag
(
[
∂2LI∂ui∂uj
]1
N
)
, (i = 1, ... , nu, j = 1, ... , i),
∇2t0Y:,jLI =
[
[
∂2LI∂t0∂yj
]1
N
T
0
]
, (j = 1, ... , ny),
∇2t0U:,jLI =
[
∂2LI∂t0∂uj
]1
N
T
, (j = 1, ... , nu),
∇2t0t0LI =∂2LI∂t20,
∇2tf Y:,jLI =
[
[
∂2LI∂tf ∂yj
]1
N
T
0
]
, (j = 1, ... , ny ),
∇2tf U:,jLI =
[
∂2LI∂tf ∂uj
]1
N
T
, (j = 1, ... , nu),
∇2tf t0LI =∂2LI∂tf ∂t0
,
∇2tf tfLI =∂2LI∂t2f.
(3–90)
It is seen that the derivatives given in Eq. (3–90) are functions of the derivatives of LIwith respect to the components of the continuous-time state, y(t), the components
of the continuous-time control, u(t), the initial time, t0, and the final time, tf . The
derivatives[
∂2LI∂yi∂yj
]1
N,[
∂2LI∂ui∂yj
]1
N,[
∂2LI∂ui∂uj
]1
N,[
∂2LI∂t0∂yj
]1
N,[
∂2LI∂t0∂uj
]1
N, ∂2LI
∂t20,[
∂2LI∂tf ∂yj
]1
N,[
∂2LI∂tf ∂uj
]1
N,
79
∂2LI∂tf ∂t0
, and ∂2LI∂t2f
are given, respectively, as
[
∂2LI∂yi∂yj
]1
N
= −tf − t02
ny∑
l=1
Γ:,l [
∂2al∂yi∂yj
]1
N
+
nq∑
k=1
ηkw [
∂2gk∂yi∂yj
]1
N
+
nc∑
p=1
Ψ:,p [
∂2cp∂yi∂yj
]1
N
, (i , j = 1, ... , ny),
(3–91)
[
∂2LI∂ui∂yj
]1
N
= −tf − t02
ny∑
l=1
Γ:,l [
∂2al∂ui∂yj
]1
N
+
nq∑
k=1
ηkw [
∂2gk∂ui∂yj
]1
N
+
nc∑
p=1
Ψ:,p [
∂2cp∂ui∂yj
]1
N
, (i = 1, ... , nu, j = 1, ... , ny ),
(3–92)
[
∂2LI∂ui∂uj
]1
N
= −tf − t02
ny∑
l=1
Γ:,l [
∂2al∂ui∂uj
]1
N
+
nq∑
k=1
ηkw [
∂2gk∂ui∂uj
]1
N
+
nc∑
p=1
Ψ:,p [
∂2cp∂ui∂uj
]1
N
, (i , j = 1, ... , nu),
(3–93)
[
∂2LI∂t0∂yj
]1
N
=1
2
ny∑
l=1
Γ:,l [
∂al∂yj
]1
N
+
nq∑
k=1
ηkw [
∂gk∂yj
]1
N
− tf − t02
α
ny∑
l=1
Γ:,l [
∂2al∂t∂yj
]1
N
+
nq∑
k=1
ηkw [
∂2gk∂t∂yj
]1
N
+α
nc∑
p=1
Ψ:,p [
∂2cp∂t∂yj
]1
N
, (j = 1, ... , ny),
(3–94)
[
∂2LI∂t0∂uj
]1
N
=1
2
ny∑
l=1
Γ:,l [
∂al∂uj
]1
N
+
nq∑
k=1
ηkw [
∂gk∂uj
]1
N
− tf − t02
α
ny∑
l=1
Γ:,l [
∂2al∂t∂uj
]1
N
+
nq∑
k=1
ηkw [
∂2gk∂t∂uj
]1
N
+α
nc∑
p=1
Ψ:,p [
∂2cp∂t∂uj
]1
N
, (j = 1, ... , nu),
(3–95)
80
∂2LI∂t20
= αT
ny∑
l=1
Γ:,l [
∂al∂t
]1
N
+
nq∑
k=1
ηkw [
∂gk∂t
]1
N
− tf − t02
αT
[
ny∑
l=1
Γ:,l [
∂2al∂t2
]1
N
+
nq∑
k=1
ηkw [
∂2gk∂t2
]1
N
α]
+αT
[
nc∑
p=1
Ψ:,p [
∂2cp∂t2
]1
N
α]
,
(3–96)
[
∂2LI∂tf ∂yj
]1
N
= −12
ny∑
l=1
Γ:,l [
∂al∂yj
]1
N
+
nq∑
k=1
ηkw [
∂gk∂yj
]1
N
− tf − t02
β
ny∑
l=1
Γ:,l [
∂2al∂t∂yj
]1
N
+
nq∑
k=1
ηkw [
∂2gk∂t∂yj
]1
N
+ β
nc∑
p=1
Ψ:,p [
∂2cp∂t∂yj
]1
N
, (j = 1, ... , ny),
(3–97)
[
∂2LI∂tf ∂uj
]1
N
= −12
ny∑
l=1
Γ:,l [
∂al∂uj
]1
N
+
nq∑
k=1
ηkw [
∂gk∂uj
]1
N
− tf − t02
β
ny∑
l=1
Γ:,l [
∂2al∂t∂uj
]1
N
+
nq∑
k=1
ηkw [
∂2gk∂t∂uj
]1
N
+ β
nc∑
p=1
Ψ:,p [
∂2cp∂t∂uj
]1
N
, (j = 1, ... , nu),
(3–98)
∂2LI∂tf ∂t0
= −12αT
ny∑
l=1
Γ:,l [
∂al∂t
]1
N
+
nq∑
k=1
ηkw [
∂gk∂t
]1
N
+1
2βT
ny∑
l=1
Γ:,l [
∂al∂t
]1
N
+
nq∑
k=1
ηkw [
∂gk∂t
]1
N
− tf − t02
αT
[
ny∑
l=1
Γ:,l [
∂2al∂t2
]1
N
+
nq∑
k=1
ηkw [
∂2gk∂t2
]1
N
β]
+αT
[
nc∑
p=1
Ψ:,p [
∂2cp∂t2
]1
N
β]
,
(3–99)
81
Control nu
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
t0 tf
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Diagonal Block
With Corners
Diagonal Block
With Corners
Diagonal Block
With Corners
Diagonal Block
With Corners
Control 1 State ny State 1
q1 qnq
All Zeros
All Zeros
Figure 3-6. General Hessian sparsity pattern for the Legendre-Gauss-Radau orthogonalcollocation integral scheme.
∂2LI∂t2f
= −βT
ny∑
l=1
Γ:,l [
∂al∂t
]1
N
+
nq∑
k=1
ηkw [
∂gk∂t
]1
N
− tf − t02
βT
[
ny∑
l=1
Γ:,l [
∂2al∂t2
]1
N
+
nq∑
k=1
ηkw [
∂2gk∂t2
]1
N
β]
+ βT
[
nc∑
p=1
Ψ:,p [
∂2cp∂t2
]1
N
β]
,
(3–100)
where it is noted that
Γ = IΓ. (3–101)
82
It is seen from the above derivation that the Hessian of LI with respect to the NLP
decision vector z is a function of the first and second derivatives of the functions a and
g, and the second derivatives of the function c, where a, c, and g are defined in the
optimal control problem of Section 3.2. Thus, the Hessian of LI can be obtained as a
function of derivatives associated with the functions of the optimal control problem stated
in Section 3.2. Figure. 3-6 shows the sparsity pattern of a general NLP Lagrangian
Hessian obtained from the discretization of the continuous-time problem using the
Legendre-Gauss-Radau orthogonal collocation method.
3.5 Discussion
While perhaps not evident at first glance, the approach of Section 3.4 only requires
differentiation of the much smaller and simpler functions of the continuous-time optimal
control problem of Section 3.2 as opposed to differentiation of the much larger and
more complicated objective and constraint functions of the NLP. For example, using our
approach, the NLP constraint Jacobian of Section 3.4.2 is obtained using Eqs. (3–46),
(3–49), and (3–55), where the first derivatives of the defect constraints and path
constraints are evaluated at the N collocation points, while the derivatives of the
boundary condition function are evaluated at the endpoints of the interval. Thus, the
Jacobian is obtained by evaluating only the functions of the continuous-time optimal
control problem as opposed to differentiating the much larger and more complicated
objective and constraint functions of the NLP. The simplicity of the approach developed
in this paper over differentiating the NLP is particularly evident when computing the
Lagrangian Hessian of Section 3.4.4. Specifically, from Eqs. (3–76) and (3–78) it is seen
that the Hessian is obtained by differentiating the functions LI and LE with respect to
the continuous-time state, control, and time at either the endpoints (in the case LE )
or the N collocation points (in the case of LI ). Furthermore, because LE and LI are
scalar functions, a variety of differentiation techniques can be utilized in an efficient and
easy to understand manner. Effectively, the NLP objective function gradient, constraint
83
Jacobian, and Lagrangian Hessian are obtained by differentiating a subset of simpler
and smaller functions. Because the derivatives of these simpler and smaller functions
are evaluated at only the collocation points or the endpoints of the time interval, the
expressions derived in Section 3.4 provide the most efficient way to compute the NLP
derivative functions.
3.6 Example
Consider the following variation of the orbit-raising optimal control problem taken
from Ref. [48]. Minimize the cost functional
J = −r(tf ) (3–102)
subject to the dynamic constraints
r = vr ,
θ = vθ/r
vr = v 2θ /r − µ/r2 + au1,
vθ = −vrvθ/r + au2,
(3–103)
the equality path constraint
c = u21 + u22 = 1, (3–104)
and the boundary conditions
b1 = r(0) − 1 = 0,
b2 = θ(0) = 0,
b3 = vr(0) = 0,
b4 = vθ(0)− 1 = 0,
b5 = vr(tf ) = 0,
b6 =√
µ/r(tf )− vθ(tf ) = 0,
(3–105)
84
where µ = 1, T = 0.1405, m0 = 1, m = 0.0749, tf = 3.32, and
≡ a(t) = T
m0 − |m|t . (3–106)
In this example the continuous-time state and control are given, respectively, as
y(t) =
[
r(t) θ(t) vt(t) vθ(t)
]
,
u(t) =
[
u1(t) u2(t) ,
]
while the right-hand side function of the dynamics, the path constraint function, and the
boundary condition function are given, respectively, as
a(y(t), u(t), t) =
[
vr vθ/r v2θ /r − µ/r2 + au1 −vrvθ/r + au2
]
c(y(t), u(t), t) = u21 + u22 − 1
b(y(t0), t0, y(tf ), tf ) =
[
r(0) − 1 θ(0) vr(0) vθ(0)− 1 vr(tf )√
µ/r(tf )− vθ(tf )]
.
Finally, the lower and upper bounds on the path constraints and boundary conditions
are all zero. Because the first five boundary conditions, (b1, ... , b5), are simple bounds
on the initial and final continuous-time state, they will be enforced in the NLP as simple
bounds on the NLP variables corresponding to the initial and terminal state. The 6th
boundary condition, b6, on the other hand, is a nonlinear function of the terminal state
and, thus, will be enforced in the NLP as a nonlinear constraint.
The NLP arising from the Legendre-Gauss-Radau orthogonal collocation
discretization of the optimal control problem given in Eqs. (3–102)–(3–105) was
solved using NLP solver IPOPT [43]. It is noted that IPOPT can be used as either a
first-derivative NLP solver (where the objective function gradient and constraint Jacobian
are supplied) or can be used as a second-derivative NLP solver (where the objective
function gradient, constraint Jacobian, and Lagrangian Hessian are supplied). When
used as a first-derivative quasi-Newton NLP solver, IPOPT approximates the Lagrangian
85
Hessian using a limited-memory BFGS update. When used as a second derivative NLP
solver, the lower-triangular portion of the sparse Lagrangian Hessian is used. It is noted
that the computational efficiency and reliability of IPOPT are enhanced by providing an
accurate, sparse, and efficiently computed Lagrangian Hessian.
In order to see the effectiveness of the derivation of Section 3.4, in this example the
Legendre-Gauss-Radau orthogonal collocation method NLP was solved using IPOPT
by either directly differentiating the NLP objective function, f , the constraints, h, and the
Lagrangian, L, or by differentiating the functions φ, g, a, c, and b of the continuous-time
optimal control problem as given in Eqs. (3–1)–(3–5), respectively and using the method
derived in Section 3.4. When the NLP functions are directly differentiated and IPOPT
is applied as a first-derivative NLP, the first derivatives of f and h are computed using
either
(i) first forward-differencing;
(ii) the forward-mode object-oriented MATLAB automatic differentiator INTLAB [52].
When the NLP functions are directly differentiated and IPOPT is applied as a
second-derivative NLP solver, the first derivatives of f and h and the second derivatives
of L are computed using
(iii) method (i) plus a second forward-difference to approximate the Hessian of L;
(iv) method (ii) plus the forward-mode object-oriented MATLAB automatic differentiatorINTLAB [52] to compute the Hessian of L.
When the optimal control functions φ, g, a, c, and b are differentiated and IPOPT is used
as a first-derivative NLP solver, the first derivatives of φ, g, a, c, and b are computed
using either
(v) first forward-differencing of φ, g, a, c, and b;
(vi) analytic differentiation of φ, g, a, c, and b.
86
When the optimal control functions φ, g, a, c, and b are differentiated and IPOPT is used
as a second-derivative NLP solver, the first and second derivatives of φ, g, a, c, and b
are computed using either
(vii) the method of (v) plus second forward-differencing to approximate the secondderivatives of φ, g, a, c, and b;
(viii) analytic differentiation to obtain the second derivatives of φ, g, a, c, and b.
For completeness, the Jacobian and Hessian sparsity patterns for this example are
shown, respectively, in Figs. 3-8 and 3-9. When using finite-differencing or INTLAB to
differentiate the NLP constraint function, only the nonlinear parts were differentiated; all
known linear parts of the NLP constraint function were obtained a priori and stored for
later use. When implementing the mapping derived in Section 3.4, only the functions
of the continuous-time problem shown in Section 3.2 are computed; the appropriate
NLP derivative matrices are then obtained by inserting these derivatives into the correct
locations in the appropriate matrix using the mapping of Section 3.4. It is noted that
the NLP constraint Jacobian and Lagrangian Hessian sparsity patterns, shown in
Figs. 3-8 and 3-9, are found using the derivation given in Section 3.4 by differentiating
the continuous-time optimal control problem, and are implemented for all derivative
methods. All computations were performed on an Intel Core 2 Duo 660 2.4 GHz
computer with 2 GB of RAM running 32-bit OpenSuse Linux with MATLAB 2010a and
IPOPT version 3.6, where IPOPT was compiled with the sparse symmetric linear solver
MA57 [53]. Finally, for each of the methods (i)–(viii) the values in the NLP derivatives
matrices were verified using both (a) the derivative checker built into IPOPT and (b) a
comparison between the derivatives obtained using the method of Section 3.4 and the
derivatives obtained using the automatic differentiator INTLAB [52].
The example was solved using K = (16, 32, 64, 128, 256, 512) equally-spaced
mesh intervals with 4 LGR points in each mesh interval. A typical solution to obtained
for this example is shown in Fig. 3-7. Tables 3-1 and 3-2 summarize the computational
87
performance using methods (i)–(iv) and methods (v)–(viii), respectively. In particular,
Tables 3-1 and 3-2 show that differentiating the functions of the optimal control problem
and using the approach of Section 3.4 is significantly more computationally efficient
than direct differentiation of the NLP functions. More specifically, it is seen in Tables
3-1 and 3-2 that, regardless of whether the NLP solver is used as a quasi-Newton
or Newton method, the difference in computational efficiency between direct NLP
function differentiation and the approach of this paper grows to several orders of
magnitude. As an example, for N = 2048 method (i) takes 2246 s while method (v)
takes 27.1 s whereas method (iii) takes 5871 s while method (vii) takes 23.1 s. As a
result, differentiating only the functions of the optimal control problem has a substantial
computational benefit for large problems over direct differentiation of the NLP functions.
Next, it is useful to compare finite-differencing against either automatic or analytic
differentiation. First, when comparing methods (i) and (ii) to methods (iii) and (iv) in
Table 3-1 [that is, comparing finite-differencing against automatic differentiation of
the NLP functions], it is seen that using IPOPT with as a quasi-Newton method with
INTLAB is significantly more efficient than using any other method where the NLP
functions are differentiated directly. Correspondingly, direct differentiation of the NLP
functions using IPOPT in second-derivative mode is by far the least efficient because it
is computationally costly to compute the Hessian Lagrangian in this manner. In addition
to computational cost, INTLAB suffers from the problem that MATLAB runs out of
memory for N = 1024 or N = 2048. Thus, even though IPOPT converges in many
fewer iterations in second-derivative mode, the cost per iteration required to compute
the Lagrangian Hessian is significantly higher than the cost to use the quasi-Newton
Hessian approximation.
Next, Table 3-3 summarizes the problem size and density of the NLP constraint
Jacobian and Lagrangian Hessian for the different values of K . It is interesting to
observe that the densities of both the NLP constraint Jacobian and Lagrangian Hessian
88
decrease quickly as a function of the overall problem size (number of variables and
constraints). Because the number of nonzeros in the Jacobian and Hessian matrices
grows slowly as a function of K , one would expect that the execution time would also
grow slowly. As seen from the results in Table 3-2, the approach developed in Section
3.4 of this paper exploits the slow growth in the number of nonzeros, thus maintaining
computational tractability as the NLP increases in size. Table 3-1 on the other hand
shows that, when the NLP functions are directly differentiated, many unnecessary
calculations are performed which degrades performance to the point where direct
differentiation becomes intractable for large values of K .
The results obtained by differentiating the optimal control functions using
the derivation of Section 3.4 are significantly different from those obtained using
direct differentiation of the NLP functions. In particular, it is seen that using either
finite-differencing or analytic differentiation, the computation times using the method
of Section 3.4 are much lower than those obtained by direct differentiation of the NLP
functions. In addition, the benefit of using second analytic derivatives (a reduction
in computation time by a factor of two over second finite-differencing) demonstrates
that, with an accurate Hessian, only a small fraction of the total execution time is spent
inside the NLP solver. Instead, the majority of the execution time is spent evaluating
the Hessian. As a result, the speed with which IPOPT can generate a solution in
second-derivative mode depends heavily upon the efficiency with which the Lagrangian
Hessian can be computed. Referring again to Table 3-3, it is seen that the method
of this paper takes advantage of the sparsity in the NLP constraint Jacobian and
Lagrangian Hessian as K increases. Because the method presented in this paper has
the benefit that an accurate Hessian can be computed quickly, the time required to solve
the NLP is greatly reduced over direct differentiation of the NLP functions.
89
t
y(t)=(r(t),θ(t),v
r(t),v θ(t))
r(t)
θ(t)
vr(t)
vθ(t)
00
0.5
0.5
1
1
1.5
1.5
2
2
2.5
2.5 3 3.5
A
t
u(t)=(u
1(t),u2(t))
u1(t)
u2(t)
-1
-0.8
-0.6
-0.4
-0.2
0
0
0.2
0.4
0.5
0.6
0.8
1
1 1.5 2 2.5 3 3.5
B
Figure 3-7. Solution to orbit-raising optimal control problem for 16 equally-spaced meshintervals of 4 LGR points each (N = 64).
90
Def
ect r
D-M
atrix Plus
Diagonal
D-M
atrix Plus
Diagonal
D-M
atrix Plus
Diagonal
D-M
atrix Plus
Diagonal
State r State θ
Def
ect θ
Def
ect v θ
Control u1 Control u2
Pat
h
State vr State vθ
Def
ect v r
b6
t0 tf
Figure 3-8. NLP Constraint Jacobian sparsity pattern for the orbit-raising optimal controlproblem.
91
State r State θ Control u1 Control u2
t0 tf State vr State vθ
Figure 3-9. NLP Lagrangian Hessian sparsity pattern for the orbit-raising optimal controlproblem.
92
Table 3-1. Direct differentiation of the NLP functions using finite-differencing and INTLABfor the orbit-raising problem using the Legendre-Gauss-Radau orthogonalcollocation method with K = (16, 32, 64, 128, 256, 512) equally-spaced meshintervals, Nk = 4 LGR points per mesh interval, and the NLP solver IPOPT.
Derivative Method for IPOPT K N NLP Major Iterations CPU Time (s)(i) 16 64 141 36.2(i) 32 128 121 57.9(i) 64 256 125 133(i) 128 512 176 435(i) 256 1024 212 1051(i) 512 2048 196 2246(ii) 16 64 118 2.9(ii) 32 128 115 3.6(ii) 64 256 136 5.7(ii) 128 512 156 10.2(ii) 256 1024 158 19.4(ii) 512 2048 143 31.2(iii) 16 64 32 44.5(iii) 32 128 35 100(iii) 64 256 46 263(iii) 128 512 49 708(iii) 256 1024 56 2058(iii) 512 2048 67 5871(iv) 16 64 33 2.3(iv) 32 128 39 5.4(iv) 64 256 43 17.1(iv) 128 512 77 126(iv) 256 1024 Out of Memory Out of Memory(iv) 512 2048 Out of Memory Out of Memory
93
Table 3-2. Differentiation of the optimal control problem functions together with theapproach of section 3.4 using finite-differencing and analytic differentiation forthe orbit-raising problem using the Legendre-Gauss-Radau orthogonalcollocation method with K = (16, 32, 64, 128, 256, 512) equally-spaced meshintervals, Nk = 4 LGR points in each mesh interval, and the NLP solverIPOPT.
Derivative Method for IPOPT K N NLP Major Iterations CPU Time (s)(v) 16 64 144 1.7(v) 32 128 114 1.9(v) 64 256 132 3.5(v) 128 512 157 7.6(v) 256 1024 152 13.7(v) 512 2048 164 27.1(vi) 16 64 113 1.3(vi) 32 128 106 1.7(vi) 64 256 132 3.2(vi) 128 512 154 6.8(vi) 256 1024 150 12.1(vi) 512 2048 136 21.1(vii) 16 64 31 0.83(vii) 32 128 35 1.3(vii) 64 256 45 2.5(vii) 128 512 48 4.9(vii) 256 1024 56 11.0(vii) 512 2048 60 23.1(viii) 16 64 30 0.54(viii) 32 128 35 0.93(viii) 64 256 41 1.6(viii) 128 512 42 2.5(viii) 256 1024 49 5.3(viii) 512 2048 60 10.9
Table 3-3. Summary of problem sizes and densities of NLP constraint Jacobian andLagrangian Hessian for the orbit-raising problem using theLegendre-Gauss-Radau orthogonal collocation method withK = (16, 32, 64, 128, 256, 512) equally-spaced mesh intervals, Nk = 4 LGRpoints in each mesh interval, and the NLP solver IPOPT.
NLP NLP Jacobian Jacobian Hessian HessianK N Variables Constraints Non-Zeros Density (%) Non-Zeros Density (%)16 64 390 321 2498 2.00 1925 1.2732 128 774 641 4994 1.01 3845 0.64264 256 1542 1281 9986 0.506 7685 0.323128 512 3078 2561 19970 0.253 15365 0.162256 1024 6150 5121 39938 0.127 30725 0.0812512 2048 12294 10241 79874 0.0634 61445 0.0407
94
3.7 Conclusions
Explicit expressions have been derived for the objective function gradient, constraint
Jacobian, and Lagrangian Hessian of a nonlinear programming problem that arises
in direct orthogonal collocation methods for solving continuous-time optimal control
problems. A key feature of the procedure developed in this paper is that only the
functions of the continuous-time optimal control problem need to be differentiated
in order to determine the nonlinear programming problem derivative functions. As a
result, it is possible to obtain these derivative functions much more efficiently than
would be the case if the nonlinear programming problem functions were directly
differentiated. In addition, the approach derived in this paper explicitly identifies the
sparse structure of the nonlinear programming problem. The approach developed in this
paper can significantly improve the computational efficiency and reliability of solving the
nonlinear programming problem arising from the Legendre-Gauss-Radau orthogonal
collocation method approximation, particularly when using a second-derivative nonlinear
programming problem solver where the Lagrangian Hessian can be exploited. An
example has been studied to show the efficiency of various derivative options and the
approach developed in this paper is found to improve significantly the efficiency with
which the nonlinear programming problem is solved.
95
CHAPTER 4HP ADAPTIVE MESH REFINEMENT
The purpose of this chapter is to describe a systematic way to estimate the error
in the Radau discretization of an optimal control problem using the fact that Radau
collocation is a Gaussian quadrature integration method. Based on the derived estimate
of the error, we provide a simple yet effective hp variable-order mesh refinement method
that allows both the degree of the approximating polynomial and the number of mesh
intervals to vary. The method is demonstrated on three non-trivial examples, and is
found to be more computationally efficient and produces a smaller mesh for a given
accuracy tolerance when compared with traditional fixed-order methods.
This chapter is organized as follows. In Section 4.1 we provide a motivation for
our new ph method. In Section 4.2 we state the continuous-time Bolza optimal control
problem. In Section 4.3, we state the integral form of the as the basis for the ph mesh
refinement method developed in this chapter. In Section 4.4 we develop the error
estimate and our new ph adaptive mesh refinement method. In Section 4.5 we apply the
method of Section 4.4 to three examples that highlight different features of the method.
In Section 4.6 we provide a discussion of the method and a comparison with traditional
fixed-order h methods. Finally, in Section 4.7 we provide conclusions on the method.
4.1 Motivation for New ph Adaptive Collocation Method
Because the method described in this chapter increases the degree of the
approximating polynomial of a mesh interval before it subdivides the mesh interval into
more mesh intervals, the method is referred to as a ph method. consider the following
two first-order differential equations on the interval τ ∈ [−1,+1]:
dy1
dτ= f1(τ) = π cos(πτ), y1(−1) = y10, (4–1)
dy2
dτ= f2(τ) =
0, −1 ≤ τ < −1/2
π cos(πτ), −1/2 ≤ τ ≤ +1/2,
0, +1/2 < τ ≤ +1
, y2(−1) = y20. (4–2)
96
The solutions to the differential equations of Eqs. (4–1) and (4–2) are given, respectively,
as
y1(τ) = y10 + sin(πτ), (4–3)
y2(τ) =
y20, −1 ≤ τ < −1/2,
y20 + 1 + sin(πτ), −1/2 ≤ τ ≤ +1/2,
y20 + 2, +1/2 < τ ≤ +1.
(4–4)
Suppose now that it is desired to approximate the solutions to the differential equations
of Eqs. (4–1) and (4–2) using the following two different methods that employ the
Legendre-Gauss-Radau [51] collocation method as described in various forms in
Refs. [18–20, 27, 29]: (1) a p method based on an N thk degree Legendre-Gauss-Radau
orthogonal collocation method on [−1,+1] where Nk is allowed to vary; and (2) an
h method using K equally spaced mesh intervals where K is allowed to vary and a
fixed fourth-degree Legendre-Gauss-Radau orthogonal collocation method on each
mesh interval. Suppose further that within any mesh interval [Tk−1,Tk ] the Lagrange
polynomial approximations have the form
y(k)i (τ) ≈ Y
(k)i (τ) =
N+1∑
j=1
Y(k)ij ℓ(k)j (τ), ℓ(k)j (τ) =
N+1∏
l=1l 6=j
τ − τ(k)l
τ (k)j − τ (k)l, (4–5)
where the support points for ℓ(k)j (τ), j = 1, ... ,Nk+1, are the Nk Legendre-Gauss-Radau
points [51] (τ (k)1 , ... , τ(k)N ) on [Tk−1,Tk ] along with a non-collocated point τ (k)N+1 = Tk that
defines the end of the mesh interval. Within any particular mesh interval [Tk−1,Tk ] ⊆
[−1,+1], the approximations of y (k)i (τ), i = 1, 2, are given at the support points
τ (k)j+1, j = 1, ... ,N , as
y(k)i (τ
(k)j+1) ≈ Y (k)i (τ (k)j+1) = Y (k)i1 +
N∑
l=1
I(k)jl fi(τ
(k)l ), (i = 1, 2), (j = 1, ... ,N), (4–6)
97
where Y (k)i1 is the approximation to yi(τ(k)1 ) at the start of the mesh interval and I (k)jl (j , l =
1, ... ,Nk) is the Nk × Nk Legendre-Gauss-Radau integration matrix (see Ref. [18] for
details) defined on the mesh interval [Tk−1,Tk ].
Suppose now that we define the maximum absolute error in the solution of the
differential equation as
Ei = maxj∈[1,...,Nk ]
k∈[1,...,K ]
∣
∣
∣Y(k)ij − yi(τ (k)j )
∣
∣
∣, (i = 1, 2).
Figs 4-1A and 4-1B show the base-10 logarithm of E1 as a function of N for the p
method and as a function of K for the h method. First, it is seen that because y1(τ) is
a smooth function, the p method converges exponentially as a function of N while the
h method converges significantly more slowly as a function of K . Figures 4-1C and
4-1D show E2. Unlike y1, the function y2 is continuous but not smooth. As a result, the h
method converges faster than the p method because no single polynomial (regardless
of degree) on [−1,+1] is able to approximate the solution to Eq. (4–2) as accurately
as a piecewise polynomial. However, while the h method converges more quickly than
does the p method when approximating the solution of Eq. (4–2), it is seen that the h
method does not converge as quickly as the p method does when approximating the
solution to Eq. (4–1). In fact, when approximating the solution of Eq. (4–1) it is seen that
the h method achieves an error of ≈ 10−7 for K = 24 whereas the p method converges
exponentially and achieves an error of ≈ 10−15 for N = 20. As a result, an h method
does not provide the fastest possible convergence rate when approximating the solution
to a differential equation whose solution is smooth.
Given the aforementioned p and h analysis, suppose now that it is desired to
improve upon the convergence rate of an h method when approximating the solution
of a differential equation whose solution is not accurately approximated using a
single polynomial. In particular, suppose it is desired to approximate the solution of
Eq. (4–2) using an approach that is a hybrid of a p and an h method, namely a ph
98
Legendre-Gauss-Radau orthogonal collocation method. Assume in this example that a
ph method is constructed such that the time interval [−1,+1] is divided into into three
mesh intervals [−1,−1/2], [−1/2,+1/2], and [+1/2,+1] and Lagrange polynomial
approximations of the form of Eq. (4–5) of degree N1, N2, and N3, respectively, are
used in each mesh interval. Furthermore, suppose N1, N2, and N3 are allowed to
vary. Because the solution y2(τ) is a constant in the first and third mesh intervals, it is
possible to set N1 = N3 = 2 and vary only N2. Figure 4-1E shows the error in y2(τ),
E2ph = max |y2 − Y2| using the aforementioned three interval ph approach. Similar to the
results obtained using the p method when approximating the solution of Eq. (4–1), in this
case the error in the solution of Eq. (4–2) converges exponentially as a function of N2.
Thus, while an h method may outperform a p method on a problem whose solution is
not smooth, it is possible improve the convergence rate by using an ph adaptive method.
The foregoing analysis provides a motivation for the development of the ph method
described in the remainder of this chapter.
4.2 Bolza Optimal Control Problem
Without loss of generality, consider the following general optimal control problem in
Bolza form. Determine the state, y(t) ∈ Rny , the control u(t) ∈ R
nu , the initial time, t0,
and the terminal time, tf , on the time interval t ∈ [t0, tf ] that minimize the cost functional
J = φ(y(t0), t0, y(tf ), tf ) +
∫ tf
t0
g(y(t), u(t), t) dt (4–7)
subject to the dynamic constraints
dy
dt= a(y(t), u(t), t), (4–8)
the inequality path constraints
cmin ≤ c(y(t), u(t), t) ≤ cmax, (4–9)
99
4 8 12 16 24−15
−5
N
log10E1p
0
20
-10
A log10 E1p vs. N using p Radau method.
4 8 12 16 24−15
−5
K
log10E1h
0
20
-10
B log10 E1h vs. K using h Radau method withN = 4.
4 8 12 16 24−3.5
−3
−2.5
−1.5
−1
−0.5
N
log10E2p
0
20
-2
C log10 E2p vs. N using p Radau method.
4 8 12 16 24−3.5
−3
−2.5
−1.5
−1
−0.5
K
log10E2h
0
20
-2
D log10 E2h vs. K using h Radau method withN = 4.
4 8 12 16 24
log10E2ph
N2
0
20
-2
-4
-6
-8
-10
-12
-14
-16
E log10 E2ph vs. N2 using ph Radau method.
Figure 4-1. Base-10 logarithm of absolute errors in solutions of Eqs. (4–1) and (4–2) atlagrange polynomial support points using p, h methods, and ph methods.
100
and the boundary conditions
bmin ≤ b(y(t0), t0, y(tf ), tf ) ≤ bmin. (4–10)
The functions φ, g, a, c and b are defined by the following mappings:
φ : Rny × R× R
ny × R → R,
g : Rny × R
nu × R → R,
a : Rny × R
nu × R → Rny ,
c : Rny × R
nu × R → Rnc ,
b : Rny × R× R
ny × R → Rnb ,
where all vector functions of time are treated as row vectors. In this presentation it
will be useful to modify the Bolza problem given in Eqs. (4–7)–(4–10) as follows. Let
τ ∈ [−1,+1] be a new independent variable such that
t =tf − t02
τ +tf + t02. (4–11)
The Bolza optimal control problem of Eqs. (4–7)–(4–10) is then defined in terms of the
variable τ as follows. Determine the state, y(τ) ∈ Rny , the control u(τ) ∈ R
nu , the initial
time, t0, and the terminal time tf on the time interval τ ∈ [−1,+1] that minimize the cost
functional
J = φ(y(−1), t0, y(+1), tf ) +tf − t02
∫ +1
−1
g(y(τ), u(τ), τ ; t0, tf ) dτ (4–12)
subject to the dynamic constraints
dy
dτ=tf − t02a(y(τ), u(τ), τ ; t0, tf ), (4–13)
the inequality path constraints
cmin ≤ c(y(τ), u(τ), τ ; t0, tf ) ≤ cmax, (4–14)
101
and the boundary conditions
bmin ≤ b(y(−1), t0, y(+1), tf ) ≤ bmin. (4–15)
Suppose now that the time interval τ ∈ [−1,+1] is divided into a mesh consisting
of K mesh intervals Sk = [Tk−1,Tk ], k = 1, ... ,K , where (T0, ... ,TK) are the mesh
points. The mesh intervals Sk , (k = 1, ... ,K) have the properties thatK⋃
k=1
Sk = [−1,+1]
andK⋂
k=1
Sk = ∅, while the mesh points have the property that −1 = T0 < T1 < T2 <
· · · < TK = +1. Let y(k)(τ) and u(k)(τ) be the state and control in Sk . The Bolza optimal
control problem of Eqs. (4–12)–(4–15) can then rewritten as follows. Minimize the cost
functional
J = φ(y(1)(−1), t0, y(K)(+1), tf )
+tf − t02
K∑
k=1
∫ Tk
Tk−1
g(y(k)(τ), u(k)(τ), τ ; t0, tf ) dτ , (k = 1, ... ,K),(4–16)
subject to the dynamic constraints
dy(k)(τ)
dτ=tf − t02a(y(k)(τ), u(k)(τ), τ ; t0, tf ), (k = 1, ... ,K), (4–17)
the path constraints
cmin ≤ c(y(k)(τ), u(k)(τ), τ ; t0, tf ) ≤ cmax, (k = 1, ... ,K), (4–18)
and the boundary conditions
bmin ≤ b(y(1)(−1), t0, y(K)(+1), tf ) ≤ bmax. (4–19)
Because the state must be continuous at each interior mesh point, it is required that the
condition y(T−k ) = y(T
+k ), (k = 1, ... ,K − 1) be satisfied at the interior mesh points
(T1, ... ,TK−1).
102
4.3 Legendre-Gauss-Radau Collocation Method
The ph form of the continuous-time Bolza optimal control problem in Section 4.2 is
discretized using collocation at Legendre-Gauss-Radau (LGR) points [18–20, 27, 29].
In the LGR collocation method, the state of the continuous-time Bolza optimal control
problem is approximated in Sk , k ∈ [1, ... ,K ] as
y(k)(τ) ≈ Y(k)(τ) =Nk+1∑
j=1
Y(k)j ℓ(k)j (τ), ℓ(k)j (τ) =
Nk+1∏
l=1l 6=j
τ − τ (k)l
τ (k)j − τ (k)l, (4–20)
where τ ∈ [−1,+1], ℓ(k)j (τ), j = 1, ... ,Nk + 1, is a basis of Lagrange polynomials,(
τ (k)1 , ... , τ(k)Nk
)
are the Legendre-Gauss-Radau [51] (LGR) collocation points in Sk =
[Tk−1,Tk), and τ (k)Nk+1 = Tk is a noncollocated point. Differentiating Y(k)(τ) in Eq. (4–20)
with respect to τ , we obtain
dY(k)(τ)
dτ=
Nk+1∑
j=1
Y(k)j
dℓ(k)j (τ)
dτ. (4–21)
The cost functional of Eq. (4–16) is then approximated using a multiple-interval LGR
quadrature as
J ≈ φ(Y(1)1 , t0,Y(K)NK+1, tf ) +
K∑
k=1
Nk∑
j=1
tf − t02w(k)j g(Y
(k)j ,U
(k)j , τ
(k)j ; t0, tf ), (4–22)
where w (k)j (j = 1, ... ,Nk) are the LGR quadrature weights [51] in Sk = [Tk−1,Tk ],
k ∈ [1, ... ,K ], U(k)i , i = 1, ... ,Nk , are the approximations of the control at the Nk LGR
points in mesh interval k ∈ [1, ... ,K ], Y(1)1 is the approximation of y(T0), and Y(K)NK+1 is the
approximation of y(TK) (where we recall that T0 = −1 and TK = +1). Collocating the
dynamics of Eq. (4–17) at the Nk LGR points using Eq. (4–21), we have
Nk+1∑
j=1
D(k)ij Y
(k)j − tf − t0
2a(Y
(k)i ,U
(k)i , τ
(k)i ; t0, tf ) = 0, (i = 1, ... ,Nk),
where
D(k)ij =
dℓ(k)j (τ(k)i )
dτ, (i = 1, ... ,Nk , j = 1, ... ,Nk + 1),
103
are the elements of the Nk × (Nk + 1) Legendre-Gauss-Radau differentiation matrix
[18] D(k) associated with Sk , k ∈ [1, ... ,K ]. While the dynamics can be collocated
in differential form, in this chapter we choose to collocate the dynamics using the
equivalent implicit integral form (see Refs. [18–20] for details). The implicit integral form
of the Legendre-Gauss-Radau collocation method is given as
Y(k)i+1 − Y
(k)1 − tf − t0
2
Nk∑
j=1
I(k)ij a(Y
(k)i ,U
(k)i , τ
(k)i ; t0, tf ) = 0, (i = 1, ... ,Nk), (4–23)
where I (k)ij , (i = 1, ... ,Nk , j = 1, ... ,Nk , k = 1, ... ,K) is the Nk × Nk Legendre-Gauss-
Radau integration matrix in mesh interval k ∈ [1, ... ,K ]; it is obtained by inverting a
submatrix of the differentiation matrix formed by columns 2 through Nk + 1:
I(k) =[
D(k)2 · · ·D(k)Nk+1
]−1
,
It is noted for completeness that I(k)D(k)1 = −1, where 1 is a column vector of length Nk
of all ones. Next, the path constraints of Eq. (4–18) in Sk , k ∈ [1, ... ,K ] are enforced at
the Nk LGR points as
cmin ≤ c(Y(k)i ,U(k)i , τ
(k)i ; t0, tf ) ≤ cmax, (i = 1, ... ,Nk). (4–24)
The boundary conditions of Eq. (4–19) are approximated as
bmin ≤ b(Y(1)1 , t0,Y(K)NK+1, tf ) ≤ bmax. (4–25)
It is noted that continuity in the state at the interior mesh points k ∈ [1, ... ,K − 1] is
enforced via the condition
Y(k)Nk+1
= Y(k+1)1 , (k = 1, ... ,K − 1), (4–26)
where the same variable is used for both Y(k)Nk+1 and Y(k+1)1 . Hence, the constraint of
Eq. (4–26) is eliminated from the problem because it is taken into account explicitly. The
104
NLP that arises from the LGR collocation method is then to minimize the cost function of
Eq. (4–22) subject to the algebraic constraints of Eqs. (4–23)–(4–25).
4.4 ph Adaptive Mesh Refinement Method
We now develop a ph adaptive mesh refinement method that using the LGR
collocation method described in Section 4.3. We call our method a ph method since
we first try to adjust the polynomial degree to achieve convergence, and if this fails, we
adjust the mesh spacing. The ph adaptive mesh refinement method developed in this
chapter is divided into two parts. In Section 4.4.1, the method for estimating the error in
the current solution is derived, and in Section 4.4.4, the p then-h strategy is developed
for refining the mesh.
4.4.1 Error Estimate in Each Mesh Interval
In this Section an estimate of the relative error in the solution within a mesh interval
is derived. Because the state is the only quantity in the LGR collocation method for
which a uniquely defined function approximation is available, we develop an error
estimate for the state. The error estimate is obtained by comparing two approximations
to the state, one with higher accuracy. The key idea is that for a problem whose
solution is smooth, an increase in the number of LGR points should yield a state
that more accurately satisfies the dynamics. Hence, the difference between the solution
associated with the original set of LGR points, and the approximation associated with
the increased number of LGR points should yield an estimate for the error in the state.
Assume that the NLP of Eqs. (4–22)–(4–25) corresponding to the discretized
control problem has been solved on a mesh Sk = [Tk−1,Tk ], k = 1, ... ,K , with Nk
LGR points in mesh interval Sk . Suppose that we want to estimate the error in the state
at a set of Mk = Nk + 1 LGR points(
τ (k)1 , ... , τ(k)Mk
)
, where τ (k)1 = τ (k)1 = Tk−1, and
that τ (k)Mk+1 = Tk . Suppose further that the values of the state approximation given in
Eq. (4–20) at the points(
τ (k)1 , ... , τ(k)Mk
)
are denoted(
Y(τ (k)1 ), ... ,Y(τ(k)Mk))
. Next, let the
105
control be approximated in Sk using the Lagrange interpolating polynomial
U(k)(τ) =Nk∑
j=1
U(k)j ℓ(k)j (τ), ℓ(k)j (τ) =
Nk∏
l=1l 6=j
τ − τ (k)l
τ (k)j − τ (k)l, (4–27)
and let the control approximation at τ (k)i be denoted U(τ (k)i ), 1 ≤ i ≤ Mk . We use the
value of the dynamics at (Y(τ (k)i ),U(τ(k)i ), τ
(k)i ) to construct an improved approximation
to the state. Let Y(k) be a polynomial of degree at most Mk that is defined on the interval
Sk . If the derivative of Y(k) matches the dynamics at each of the Radau quadrature
points τ (k)i , 1 ≤ i ≤ Mk , then we have
Y(k)(τ(k)j) = Y(k)(τk−1) +
tf − t02
Mk∑
l=1
I(k)jla(
Y(k)(τ(k)l),U(k)(τ (k)
l), τ(k)l
)
, j = 2, ... ,Mk + 1,
(4–28)
where I (k)jl , j , l = 1, ... ,Mk , is the Mk × Mk LGR integration matrix corresponding
to the LGR points defined by(
τ (k)1 , ... , τ(k)Mk
)
. Using the values Y(τ (k)l ) and Y(τ (k)l ),
l = 1, ... ,Mk + 1, the absolute and relative errors in the i th component of the state at
(τ (k)1 , ... , τ(k)Mk+1) are then defined, respectively, as
E(k)i (τ
(k)l ) =
∣
∣
∣Y(k)i (τ
(k)l )− Y
(k)i (τ
(k)l )∣
∣
∣,
e(k)i (τ
(k)l ) =
E(k)i (τ
(k)l )
1 + maxj∈[1,...,Mk+1]
∣
∣
∣Y(k)i (τ
(k)j )∣
∣
∣
,
l = 1, ... ,Mk + 1,
i = 1, ... , ny ,
. (4–29)
The maximum relative error in Sk is then defined as
e(k)max = maxi∈[1,...,ny ]
l∈[1,...,Mk+1]
e(k)i (τ
(k)l ). (4–30)
4.4.2 Rationale for Error Estimate
The error estimate derived in Section 4.4.1 is similar to the error estimate obtained
using the modified Euler Runge-Kutta scheme to numerically solve a differential
106
equation y(t) = f (y(t)). The first-order Euler method is given as
yj+1 = yj + hf (yj), (4–31)
where h is the step-size and yj is the approximation to y(t) at t = tj = jh. In the
second-order modified Euler Runge-Kutta method, the first stage generates the following
approximation y to y(tj+1/2):
y = yj +12hf (yj).
The second stage then uses the dynamics evaluated at y to obtain an improved
estimate yj+1 of y(tj+1):
yj+1 = yj + hf (y). (4–32)
The original Euler scheme starts at yj and generates yj+1. The first-stage variable y is
the interpolant of the line (first degree polynomial) connecting (tj , yj) and (tj+1, yj+1)
evaluated at the new point tj+1/2. The second-stage given Eq. (4–32) uses the dynamics
at the interpolant y to obtain an improved approximation to y(tj+1). Because yj+1 is a
second-order approximation to y(tj+1) and yj+1 is a first-order approximation to yj+1, the
absolute difference |yj+1 − yj+1| is an estimate of the error in yj+1 in a manner similar to
the absolute error estimate E (k)i (τ(k)l ) (l = 1, ... ,Mk + 1) derived in Eq. (4–29).
The effectiveness of the derived error estimate derived in Section 4.4.1 can be
seen by revisiting the motivating examples of Section 4.1. Figures 4-2A and 4-2B
show the p and h error estimates, respectively, E1p and E1h, in the solution to Eq. (4–1),
Figures. 4-2C and 4-2D show the p and h error estimates, respectively, E2p and E2h, in
the solution to Eq. (4–2), and Fig. 4-2E shows the ph error estimates, E2ph in the solution
to Eq. (4–2). It is seen that the error estimates are nearly identical to the actual error.
The relative error estimate given in Eq. (4–30) is used in the next section as the basis for
modifying an existing mesh.
107
4 8 12 16 24−15
−5
EstimateExact
N
log10E1p
0
20
-10
A log10 e1p vs. N using p Radau method.
4 8 12 16 24−15
−5
EstimateExact
K
log10E1h
0
20
-10
B log10 e1h vs. K Using h Radau method withN = 4.
4 8 12 16 24−3.5
−3
−2.5
−1.5
−1
−0.5
EstimateExact
N
log10E2p
0
20
-2
C log10 e2p vs. N Using p Radau method.
4 8 12 16 24−3.5
−3
−2.5
−1.5
−1
−0.5
EstimateExact
K
log10E2h
0
20
-2
D log10 e2h vs. K Using h Radau method withN = 4.
4 8 12 16 24
EstimateExact
log10E2ph
N2
0
20
-2
-4
-6
-8
-10
-12
-14
-16
E log10 e2ph vs. N2 Using ph Radau method.
Figure 4-2. Base-10 logarithm of absolute error estimates in solutions of Eqs. (4–1) and(4–2) at points (τ2, ... , τMk ) using p, h methods, and ph methods.
108
4.4.3 Estimation of Required Polynomial Degree within a Mes h Interval
Suppose again the LGR collocation NLP of Eqs. (4–22)–(4–25) has been solved
on a mesh Sk , k = 1, ... ,K . Suppose further that it is desired to meet a relative error
accuracy tolerance ǫ in each mesh interval Sk , k = 1, ... ,K . If the tolerance ǫ is not
met in at least one mesh interval, then the next step is to refine the current mesh, either
by dividing the mesh interval or increasing the degree of the approximating polynomial
within the mesh interval.
Consider a mesh interval Sq, q ∈ [1, ... ,K ] where Nq LGR points were used
to solve the NLP of Eqs. (4–22)–(4–25), and again let ǫ be the desired relative error
accuracy tolerance. Suppose further that the estimated maximum relative error, e(q)max,
has been computed as described in Section 4.4.1 and that e(q)max > ǫ (that is, the accuracy
tolerance ǫ is not satisfied in the existing mesh interval). Finally, let Nmin and Nmax be
user-specified minimum and maximum bounds on the number of LGR points within any
mesh interval. According to the convergence theory summarized in [54], the error in a
global collocation scheme behaves like O(N2.5−k) where N is the number of collocation
points within a mesh interval and k is the number of continuous derivatives in the
solution [30, 31]. If the solution is smooth, then we could take k = N . Hence, if N was
replace by N + P , then the error bound decreases by at least the factor N−P .
Based on these considerations, suppose that interval Sq employs Nq collocation
points and has relative error estimate e(q)max which is larger than the desired relative error
tolerance ǫ; to reach the desired error tolerance, the error should be multiplied by the
factor ǫ/e(q)max. This reduction is achieved by increasing Nq by Pq where Pq is chosen so
that N−Pqq = ǫ/e(q)max, or equivalently,
NPqq =e(q)max
ǫ.
This implies that
Pq = logNq
(
e(q)max
ǫ
)
. (4–33)
109
0
2
2
4
5
6
8
8
10
11
12
14
14
16
18
N
P=
⌈logN(emax/ǫ)⌉
log10(emax/ǫ) = 5
log10(emax/ǫ) = 4
log10(emax/ǫ) = 3
log10(emax/ǫ) = 2
log10(emax/ǫ) = 1
log10(emax/ǫ) = 0
A P = ⌈logN(emax/ǫ)⌉ vs. N for fixed valuesof log10(emax/ǫ).
00
N = 2
N = 5
N = 8
N = 11
N = 14
1
2
23
4
45
6
8
10
12
14
16
18
log10(emax/ǫ)
P=
⌈logN(emax/ǫ)⌉
B P = ⌈logN(emax/ǫ)⌉ vs. log10(emax/ǫ) forfixed values of N.
Figure 4-3. Function that relates the increase in the degree of the approximatingpolynomial to the ratio emax/ǫ and the current polynomial degree, N .
Since the expression on the right side of (4–33) may not be an integer, we round up to
obtain
Pq =
⌈
logNq
(
e(q)max
ǫ
)⌉
. (4–34)
Note that Pq ≥ 0 since we only use (4–34) when e(q)max is greater than the prescribed error
tolerance ǫ. The dependence of Pq on Nq is shown in Fig. 4-3.
4.4.4 p Then h Strategy for Mesh Refinement
Using Eq. (4–34), the predicted number of LGR points required in mesh interval
Sq on the ensuing mesh is Nq = Nq + Pq, assuming e(q)max has not reach the specified
error tolerance ǫ. The only possibilities are that Nq ≤ Nmax (that is, N does not exceed
the maximum allowable polynomial degree) or that Nq > Nmax (that is, N exceeds the
maximum allowable polynomial degree). If Nq ≤ Nmax, then Nq is increased to Nq on the
ensuing mesh. If, on the other hand, Nq > Nmax, then Nq exceeds the upper limit and the
mesh interval Sq must be divided into sub-intervals.
Our strategy for mesh interval division uses the following approach. First, whenever
a mesh interval is divided, the sum of the number of collocation points in the newly
created mesh intervals should equal the predicted polynomial degree for the next mesh.
110
Second, each newly created sub-interval should contain the minimum allowable number
of collocation points. In other words, if a mesh interval Sq is divided into Bq sub-intervals,
then each newly created sub-interval will contain Nmin collocation points and the sum of
the collocation points in these newly created sub-intervals should be BqNmin. Using this
strategy, the number of sub-intervals, Bq , into which Sq is divided is computed as
Bq = max
(⌈
Nq
Nmin
⌉
, 2
)
, (4–35)
where it is seen in Eq. (4–35) that 2 ≤ Bq ≤ ⌈Nq/Nmin⌉. It is seen this strategy for
mesh interval division ensures that the sum of the LGR (collocation) points in the
newly created sub-intervals on the ensuing mesh equals the number of LGR points
that would be used in the mesh interval on the ensuing mesh if the value Nq was
accepted. Second, because the number of LGR points in a newly created mesh interval
is started at Nmin, the method uses the full range of allowable values of N . Because of
the hierarchy, the ph method of this chapter can be thought of more precisely as a “p
then-h” method where p refinement is exhausted prior to performing any h refinement.
In other words, the polynomial degree within a mesh interval is increased until the upper
limit Nmax is exceeded. The h refinement (mesh interval division) is then performed after
which the p refinement is restarted.
It is important to note that the ph method developed in this chapter can be employed
as a fixed-order h method simply by setting Nmin = Nmax. The h version of the method
of this chapter is similar to an adaptive step-size fixed-order integration method, such
as an adaptive step-size Runge-Kutta method, in the following respect: In both cases,
the mesh is refined, often by step-halving or step-doubling [55], when the specified error
tolerance is not met.
A summary of our adaptive mesh refinement algorithm appears below. Here
M denotes the mesh number, and in each loop of the algorithm, the mesh number
111
increases by 1. The algorithm terminates in Step 4 when the error tolerance is satisfied
or when M reaches a prescribed maximum Mmax.
ph Adaptive Mesh Refinement Method
Step 1: Set M = 0 and supply initial mesh, S =K⋃
k
Sk = [−1,+1], whereK⋂
k
Sk = ∅.
Step 2: Solve Radau collocation NLP of Eqs. (4–22)–(4–25) on current mesh S.
Step 3: Compute scaled error e(k)max in Sk , k = 1, ... ,K , using method ofSection 4.4.1.
Step 4: If e(k)max ≤ ǫ for all k ∈ [1, ... ,K ] or M > Mmax, then quit. Otherwise, proceed tostep 5.
Step 5: Using the method of Section 4.4.4, modify all mesh intervals Sk for whiche(k)max > ǫ.
Step 6: Set M→= M + 1, and return to step 2.
4.5 Examples
In this Section the ph adaptive Legendre-Gauss-Radau (LGR) method described
in Section 4.4 is applied to three examples from the open literature. The first example
is a variation of the hyper-sensitive optimal control problem originally described in
Ref. [56], where the effectiveness of the error estimate derived in Section 4.4.1 is
demonstrated and the improved efficiency of the ph method over various h methods
is shown. The second example is a tumor anti-angiogenesis optimal control problem
originally described in Ref. [57], where it is seen that the ph method of this chapter
accurately and efficiently captures a discontinuity in a problem whose optimal control
is discontinuous. The third example is the reusable launch vehicle entry problem from
Ref. [10], where it is seen that using the ph method of this chapter leads to a significantly
smaller mesh than would be obtained using an h method. This third example also shows
that allowing Nmin to be too small can reduce the effectiveness of the ph method.
When using a ph adaptive method, the terminology ph-(Nmin,Nmax) refers to the ph
adaptive method of this chapter where the polynomial degree can vary between Nmin
112
and Nmax, respectively, while an h-N method refers to an h method with a polynomial
of fixed degree N . For example, a ph-(2, 8) method is a ph adaptive method where
Nmin = 2 and Nmax = 8, while an h-2 method is an h method where N = 2. All results
were obtained using the open-source optimal control software GPOPS-II running with
the NLP solver IPOPT [58] in second derivative mode with the multifrontal massively
parallel sparse direct solver MUMPS, [59] default NLP solver tolerances, and a mesh
refinement accuracy tolerance ǫ = 10−6. The initial mesh for a ph-(Nmin,Nmax) or h-Nmin
method consisted of ten uniformly-spaced mesh intervals with Nmin LGR points in each
interval, while the initial guess was a straight line between the known initial conditions
and known terminal conditions for the problem under consideration with the guess on
all other variables being a constant. The required first and second derivatives required
by IPOPT were computed using the built-in sparse first and second finite-differencing
method in GPOPS-II that uses the method of Ref. [29]. Finally, all computations were
performed on a 2.5 GHz Intel Core i7 MacBook Pro running Mac OS-X Version 10.7.5
(Lion) 16 GB of 1333 MHz DDR3 RAM and MATLAB Version R2012b. The central
processing unit (CPU) times reported in this chapter are ten-run averages of the
execution time.
4.5.1 Hyper-Sensitive Problem
Consider the following variation of the hyper-sensitive optimal control problem [56].
Minimize the cost functional
J = 12
∫ tf
0
(x2 + u2)dt (4–36)
subject to the dynamic constraint
x = −x + u (4–37)
and the boundary conditions
x(0) = 1.5 , x(tf ) = 1, (4–38)
113
where tf is fixed. It is known that for sufficiently large values of tf that the solution to the
hyper-sensitive problem exhibits a so called “take-off”, “cruise”, and “landing” structure
where all of the interesting behavior occurs near the “take-off” and “landing” segments
while the solution is essentially constant in the “cruise” segment. Furthermore, the
“cruise” segment becomes and increasingly large percentage of the total trajectory time
as tf increases, while “take-off” and “landing” segments have rapid exponential decay
and growth, respectively. The analytic optimal state and control for this problem are
given as
x∗(t) = c1 exp(t√2) + c2 exp(−t
√2),
u∗(t) = x∗(t) + x∗(t),(4–39)
where
c1
c2
=
1
exp(−tf√2)− exp(tf
√2)
1.5 exp(−tf√2)− 1
1− 1.5 exp(tf√2)
. (4–40)
Figures 4-4A and 4-4B shows the exact state and control for the hyper-sensitive problem
with tf = 10000 and highlight the “take-off”, “cruise”, and “landing” feature of the optimal
solution. Given the structure of the optimal solution, it should be the case that a mesh
refinement method place many more collocation and mesh points near the ends of the
time interval when tf is large. Figures 4-4C shows the evolution of the mesh points
Tk while Figure 4-4D shows the evolution collocation (LGR) points τ (k)j on each mesh
refinement iteration using the ph-(3, 14) scheme. Two key related features are seen in
the mesh refinement. First, Figure. 4-4C shows that mesh intervals are added on each
refinement iteration only in the regions near t = 0 and t = tf , while mesh intervals
are not added in the interior region t ∈ [1000, 9000]. Second, Figure. 4-4D shows that
after the first mesh refinement iteration LGR points are also added only in the regions
regions near t = 0 and t = tf and are not added in the interior region t ∈ [1000, 9000].
This behavior of the ph adaptive method shows that error reduction is achieved by
added mesh and collocation points in regions of t ∈ [0, tf ] where points are needed
114
to capture the changes in the solution. Finally, for comparison with the ph adaptive
method, Figures. 4-4E and 4-4F show the solution obtained using an h-2 method. Unlike
the ph-(3, 14) method, where mesh points are added only where needed to meet the
accuracy tolerance, the h-2 method places many more mesh points over much larger
segments at the start and end of the overall time interval. Specifically, it is seen that the
mesh is quite dense over time intervals t ∈ [0, 3000] and t ∈ [7000, 10000] whereas
for the ph-(3, 14) method, the mesh remains dense over the smaller intervals [0, 1000]
and [9000, 10000]. Admittedly, the ph-(3, 14) does add LGR points in the regions
t ∈ [1000, 3000] and t ∈ [7000, 9000] whereas the h-2 method adds more mesh intervals,
but the mesh obtained using the ph-(3, 14) is much smaller (273 collocation points)
than the mesh obtained using the h-2 method (672 collocation points). Thus the ph
method exploits the solution smoothness on the intervals [1000, 3000] and [7000, 9000]
to achieve more rapid convergence by increasing the degree of the approximating
polynomials instead of increasing the number of mesh intervals.
Next, we analyze the quality of the error estimate of Section 4.4.1 by examining
more closely the numerical solution near t = 0 and t = tf . Figures 4-5A and 4-5B
show the state and control in the regions t ∈ [0, 15] and t ∈ [9985, 10000] on each
mesh refinement iteration alongside the exact solution using the ph-(3, 14) method,
while Table 4-1 shows the estimated and exact relative errors in the state and the
exact relative error in the control for each mesh refinement iteration. First, it is seen
in Table 4-1 that the state and control relative error on the final mesh is quite small at
≈ 10−9 for the state and ≈ 10−8 for the control. In addition, it is seen from Figs. 4-5A
and 4-5B that the state and control approximations improve with each mesh refinement
iteration. Moreover, the error estimate shown in Table 4-1 agrees qualitatively with
the solutions on the corresponding mesh as shown in Figs. 4-5A and 4-5B. It is also
interesting to see that the state relative error estimate is approximately the same on
each mesh iteration as the exact relative error. The consistency in the relative error
115
Table 4-1. Estimated relative state error, emaxx , exact relative state error, emaxx,exact, and exactrelative control error, emaxu,exact, for the hyper-sensitive problem with tf = 10000Using a ph-(3, 14) with an accuracy tolerance ǫ = 10−6. where M is the meshnumber.
M emaxx emaxx ,exact emaxu,exact1 3.377× 100 5.708× 10−3 1.280× 1002 6.436× 10−1 4.009× 10−2 1.127× 1003 9.648× 10−2 7.462× 10−2 3.369× 10−14 8.315× 10−10 1.016× 10−9 1.329× 10−8
approximation and the exact relative error demonstrates the accuracy of the error
estimate derived in Section 4.4.1. Thus, the error estimate derived in this chapter
reflects correctly the locations where the solution error is large and ph adaptive method
constructs new meshes that reduce the error without making the mesh overly dense.
Finally, we provide a comparison of the computational efficiency and mesh sizes
obtained by solving the Hyper-Sensitive Problem using the various ph adaptive and h
methods described Section 4.4. Table 4-2 shows the CPU times and mesh sizes, where
it is seen for this example that the ph-(3, 14) and h-2 methods result in the smallest
overall CPU times (with the ph-(3, 14) being slightly more computationally efficient
than the h-2 method). Interestingly, while the ph-(3, 14) and h-2 methods have nearly
the same computational efficiency, the ph-(3, 14) produces a significantly smaller
mesh (N = 293 LGR points, nearly the smallest amongst all of the methods) while
the h-2 mesh produced a much larger mesh (N = 672 LGR points, by far the largest
amongst all of the different methods). In fact Table 4-2 shows for this example that,
for any fixed value Nmin, the ph-(Nmin,Nmax) methods produced smaller mesh sizes
than the corresponding h-Nmin method. Thus, while an h method may perform well on
this example due to the structure of the optimal solution, the ph method produces the
solution in the most computationally efficient manner while simultaneously producing a
significantly smaller mesh.
116
6000 8000t
x(t)
00
1
10000
0.5
1.5
2000 4000
A x(t) vs. t for tf = 10000.
-16000 8000
t
u(t)
0
0
1
2
10000
-0.5
0.5
1.5
2.5
2000 4000
B u(t) vs. t.
Mes
hR
efine
men
tIte
ratio
n
6000 8000t
00
1
2
3
4
100002000 4000
C Mesh point history using ph-(3, 14).
Mes
hR
efine
men
tIte
ratio
n
6000 8000t
00
1
2
3
4
100002000 4000
D Collocation point history using ph-(3, 14).
Mes
hR
efine
men
tIte
ratio
n
6000 8000t
00
1
2
3
4
5
100002000 4000
E Mesh point history using h-2.
Mes
hR
efine
men
tIte
ratio
n
6000 8000t
00
1
2
3
4
5
100002000 4000
F Collocation point history using h-2.
Figure 4-4. Exact solution to the hyper-sensitive problem with tf = 10000 and meshrefinement history when using the ph-(3, 14) and h-2 methods with anaccuracy tolerance ǫ = 10−6.
117
Mesh Refinement Iteration 1Mesh Refinement Iteration 2Mesh Refinement Iteration 3Mesh Refinement Iteration 4
Exact Solution
t
x(t)
0
0
1
5 10 15-0.2
0.2
0.4
0.6
1.2
1.4
1.6
1.8
A x(t) vs. t near t = 0 for tf = 10000.
Mesh Refinement Iteration 1Mesh Refinement Iteration 2Mesh Refinement Iteration 3Mesh Refinement Iteration 4
Exact Solution
t
x(t)
0
1
9985 9990 9995 10000-0.2
0.2
0.4
0.6
1.2
1.4
1.6
1.8
B x(t) vs. t near t = tf for tf = 10000.
Mesh Refinement Iteration 1Mesh Refinement Iteration 2Mesh Refinement Iteration 3Mesh Refinement Iteration 4
Exact Solution-1
t
u(t)
0
0 5 10 15
-0.5
0.5
C x(t) vs. t near t = 0 for tf = 10000.
Mesh Refinement Iteration 1Mesh Refinement Iteration 2Mesh Refinement Iteration 3Mesh Refinement Iteration 4
Exact Solution
-1
-2t
u(t)
0
1
2
3
4
5
9985 9990 9995 10000
D x(t) vs. t near t = tf for tf = 10000.
Figure 4-5. Solution near endpoints of t ∈ [0, tf ] for the hyper-sensitive problem withtf = 10000 using the ph-(3, 14) and an accuracy tolerance ǫ = 10−6.
Table 4-2. Mesh refinement results for the hyper-sensitive problem using various phadaptive and h methods.
Initial Mesh Mesh Refinement Total ConstraintNmin Nmax CPU Time (s) CPU Time (s) CPU Time (s) N K M Jacobian Density (%)2 2 0.34 3.10 3.44 672 336 5 0.6292 8 0.33 6.93 7.26 633 222 5 0.9082 10 0.33 6.77 7.10 624 210 5 0.9712 12 0.33 6.12 6.45 583 170 6 1.2712 14 0.33 5.17 5.50 520 140 5 1.6722 16 0.33 6.33 6.66 519 126 4 1.8393 3 0.33 3.28 3.61 417 139 6 1.2293 8 0.32 3.89 4.22 369 96 6 1.7483 10 0.32 3.43 3.75 347 79 5 2.1653 12 0.33 3.79 4.12 343 64 5 2.6063 14 0.33 3.05 3.38 293 40 4 3.8473 16 0.33 3.49 3.81 290 41 5 3.8254 4 0.34 3.86 4.20 384 96 7 1.5804 8 0.33 3.65 3.98 324 66 6 2.2694 10 0.33 3.37 3.70 311 56 6 2.6374 12 0.33 3.69 4.02 291 43 5 3.4544 14 0.33 4.31 4.64 306 39 7 3.5994 16 0.33 4.95 5.29 320 44 7 3.413
118
4.5.2 Tumor Anti-Angiogenesis Problem
Consider the following tumor anti-angiogenesis optimal control problem taken from
Ref. [57]. The objective is to minimize
J = y1(tf ) (4–41)
subject to the dynamic constraints
y1(t) = −ξy1(t) ln(
y1(t)y2(t)
)
,
y2(t) = q(t)[
b − µ− dy 2/31 (t)− Gu(t)]
,(4–42)
with the initial conditions
y1(0) = [(b − µ)/d ]3/2 /2,
y2(0) = [(b − µ)/d ]3/2 /4,(4–43)
the control constraint
0 ≤ u ≤ umax, (4–44)
and the integral constraint∫ tf
0
u(τ)dτ ≤ A, (4–45)
where G = 0.15, b = 5.85, d = 0.00873, µ = 0.02, umax = 75, A = 15, and tf is free. A
solution to this optimal control problem is shown using the ph-(3, 10) method is shown in
Figs. 4-6A and 4-6B
Upon closer examination, it is seen that a key feature in the optimal solution is the
fact that optimal control is discontinuous at t ≈ 0.2. In order to improve the accuracy of
the solution in the vicinity of this discontinuity, it is necessary that an increased number
of collocation and mesh points are placed near t = 0.2. Figure 4-6B shows the control
obtained on the final mesh by the ph-(3, 10) method. Interestingly, it is seen that the
ph-(3, 10) method concentrates the collocation and mesh points near t = 0.2. Examining
the evolution of the mesh refinement, it is seen in Figs. 4-6C and 4-6D that the mesh
density increases on each successive mesh iteration, but remains unchanged in regions
119
distant from t ≈ 0.2. The reason that the mesh is modified near t = 0.2 is because the
accuracy of the state is lowest in the region near the discontinuity in the control. In order
to improve solution accuracy, additional collocation and mesh points are required near
t = 0.2. Thus, the ph method performs properly when solving this problem as it leaves
the mesh untouched in regions where few collocation and mesh points are needed, and
it increases the density of the mesh where additional points are required.
Next, Table 4-3 summarizes the CPU times and mesh sizes that were obtained
by solving the Tumor Anti-Angiogenesis Problem using the various ph and h methods
described Section 4.4. While for this example the CPU times are quite small, it is still
seen that computational efficiency is gained by choosing a ph method over an h method.
Specifically, it is seen that the ph-(3, 10) method produces the lowest CPU time with an
h-3 method being slightly less efficient than the ph-(3, 10) method. More importantly,
Table 4-3 shows the significant reduction in mesh size when using a ph method. For
example, using a ph-(3,Nmax) or ph-(4,Nmax), the maximum number of LGR points
is N = 99 whereas the lowest number of LGR points using either an h-2, h-3, or h-4
method is N = 116. Moreover, while the ph-(3, 14) and h-2 methods have nearly the
same computational efficiency, the ph-(3, 14) produces a significantly smaller mesh
(N = 293 LGR points, nearly the smallest amongst all of the methods) while the h-2
mesh produced a much larger mesh (N = 672 LGR points, by far the largest amongst
all of the different methods). Thus, while an h method may perform well on this example
due to the structure of the optimal solution, the ph method produces the solution in the
most computationally efficient manner while simultaneously producing the smallest
mesh.
4.5.3 Reusable Launch Vehicle Entry
Consider the following optimal control problem from Ref. [10] of maximizing the
crossrange during the atmospheric entry of a reusable launch vehicle. Minimize the cost
120
t
y1(t)y2(t)
(y1(t),y2(t))
0.2 0.4 0.6 0.8 1.2 1.400 1
1000
2000
3000
4000
5000
6000
7000
8000
9000
A (p(t), q(t)) vs. t.
t
u(t)
0.2 0.4 0.6 0.8 1.2 1.4
10
20
30
40
50
60
70
80
00 1
B u(t) vs. t.
t
Mes
hR
efine
men
tIte
ratio
n
0.2 0.4 0.6 0.8
2
3
4
1.2 1.400
1
1
C Mesh point history.
t
Mes
hR
efine
men
tIte
ratio
n
0.2 0.4 0.6 0.8
2
3
4
1.2 1.400
1
1
D Collocation (LGR) point history.
Figure 4-6. Solution and mesh refinement history for the tumor anti-angiogenesisproblem using the ph-(3, 10) method with an accuracy tolerance of 10−6.
functional
J = −φ(tf ) (4–46)
subject to the dynamic constraints
r = v sin γ , θ =v cos γ sinψ
r cos φ,
φ =v cos γ cosψ
r, v = −D
m− g sin γ,
γ =L cos σ
mv−(g
v− vr
)
cos γ , ψ =L sinσ
mv cos γ+v cos γ sinψ tanφ
r,
(4–47)
121
Table 4-3. Mesh refinement results for the tumor anti-agiogenesis problem using variousph adaptive and h methods.
Initial Mesh Mesh Refinement Total ConstraintNmin Nmax CPU Time (s) CPU Time (s) CPU Time (s) N K M Jacobian Density (%)2 2 0.11 0.72 0.83 270 135 3 0.9792 8 0.10 0.88 0.98 245 84 4 1.5692 10 0.10 1.02 1.12 237 65 5 2.0882 12 0.10 0.75 0.84 204 40 4 3.3542 14 0.10 0.74 0.84 204 40 4 3.3542 16 0.10 0.69 0.78 213 26 4 4.0413 3 0.17 0.55 0.72 123 41 4 2.7463 8 0.17 0.71 0.88 104 27 6 4.1143 10 0.17 0.50 0.67 95 19 4 6.0403 12 0.17 0.86 1.03 99 18 7 6.3103 14 0.17 0.62 0.80 89 15 6 7.5273 16 0.17 1.56 1.73 99 15 13 7.9554 4 0.16 0.90 1.05 116 29 6 3.5874 8 0.16 0.70 0.85 87 18 6 5.8984 10 0.16 0.96 1.12 85 16 9 6.7024 12 0.16 0.88 1.04 82 16 10 6.9294 14 0.16 1.11 1.27 83 16 13 7.0474 16 0.16 1.01 1.16 87 14 10 8.401
and the boundary conditions
h(0) = 79248 km , h(tf ) = 24384 km , θ(0) = 0 deg,
θ(tf ) = Free, , φ(0) = 0 deg , φ(tf ) = Free,
v(0) = 7.803 km/s , v(tf ) = 0.762 km/s , γ(0) = −1 deg,
γ(tf ) = −5 deg , ψ(0) = 90 deg , ψ(tf ) = Free,
(4–48)
where r = h + Re is the geocentric radius, h is the altitude, Re is the polar radius of
the Earth, θ is the longitude angle, φ is the latitude angle, v is the speed, γ is the flight
path angle, ψ is the azimuth angle, and σ is the bank angle (and is the first of the two
controls). The drag and lift are given, respectively, as D = qSCD and L = qSCL, where
q = ρv 2/2 is the dynamic pressure, ρ is the atmospheric density, S is the reference area,
CD is the coefficient of drag, and CL is the coefficient of lift. It is noted that CD and CL are
functions of the angle of attack, α (where α is the second of the two controls). Further
details about this problem and the specific models can be found in Ref. [10]. A typical
solution of this problem is shown in Figs. 4-7A–4-7F using the ph-(4, 14) method.
It is seen that the solution to this example is relatively smooth; although there
seems to be a rapid change in the angle of attack in Fig. 4-7E near t = 2000, the total
122
deflection is at most 1 degree. As a result, one might hypothesize that it is possible
to obtain an accurate solution with a relatively small number of collocation and mesh
points when compared with an h method. This hypothesis is confirmed in Table 4-4
where several interesting trends are observed. First, if we discount the CPU time for
solving the NLP on the initial mesh (as this initial mesh CPU time differs greatly between
the different methods), it is seen that at least one of the ph-(Nmin,Nmax) methods
outperforms the associated h-Nmin method both in terms of CPU time and mesh size.
Second, it is seen that the mesh refinement CPU time for the ph-(4,Nmax) methods is
half that of the CPU time of the ph-(3,Nmax) methods and is almost one quarter the CPU
time of the ph-(2,Nmax) methods.
Turning our attention to mesh size, it is seen that the mesh sizes for the ph-(4,Nmax)
methods are by far the smallest with only 89 LGR points for the ph-(4, 12), ph-(4, 14),
and ph-(4, 16) methods, while the mesh sizes for the ph-(3,Nmax) and ph-(2,Nmax)
methods are much larger (producing anywhere between 98 and 442 LGR points).
Figures 4-8A and 4-8B show the evolution of the meshes for the ph-(4, 14) method,
where it is seen that on each mesh the number of mesh intervals is the same as that
of the initial mesh (namely, ten mesh intervals), while the number of collocation points
increases on each successive mesh. As a result, for this example the largest decrease
in error error is obtained by using a slightly larger value of Nmin and allowing for a
much larger maximum degree (in this case Nmax = 14). The fact that the ph-(4,Nmax)
methods are so much better is consistent with the fact that the solution to this problem
is very smooth, having only relatively small oscillations in the altitude and flight path
angle. Thus, the accuracy tolerance can be achieved by using a small number of mesh
intervals with a relatively high-degree polynomial approximation in each interval.
123
Table 4-4. Mesh refinement results for the reusable launch vehicle entry problem usingvarious ph adaptive and h methods.
Initial Mesh Mesh Refinement Total ConstraintNmin Nmax CPU Time (s) CPU Time (s) CPU Time (s) N K M Jacobian Density (%)2 2 0.76 1.56 2.33 486 243 3 0.3142 8 0.76 1.55 2.30 442 86 3 0.8712 10 0.76 2.22 2.98 404 60 4 1.0612 12 0.75 1.33 2.08 227 30 3 2.2072 14 0.75 0.83 1.58 170 18 2 3.5602 16 0.75 0.83 1.58 170 18 2 3.5603 3 1.31 1.53 2.84 261 87 4 0.7953 8 1.31 1.09 2.41 195 38 3 1.7403 10 1.31 1.16 2.47 114 13 4 4.7623 12 1.31 0.78 2.10 98 10 3 5.9653 14 1.32 0.78 2.10 98 10 3 5.9653 16 1.32 0.78 2.10 98 10 3 5.9654 4 3.19 0.90 4.09 188 47 3 1.3964 8 3.20 0.80 4.00 127 24 3 2.7664 10 3.19 0.68 3.87 97 12 3 5.1344 12 3.20 0.43 3.64 89 10 2 6.0254 14 3.21 0.44 3.65 89 10 2 6.0254 16 3.19 0.43 3.63 89 10 2 6.025
124
t (sec)
h(t)
(km
)
020
30
40
50
60
70
80
500 1500 25001000 2000
A h(t) vs. t.
t (sec)
v(t)
(km·s
−1)
00
1
2
3
4
5
500 1500 2500
6
7
8
1000 2000
B v(t) vs. t.
φ(t)
(deg
)
θ(t) (deg)00
5
15
20
20
25
30
30
35
40 50 60 70 80
10
10
C φ(t) vs. θ(t).
−6
t (sec)
γ(t)
(deg
)0
0
1
500 1500 2500
-1
-2
-3
-4
-5
1000 2000
D γ(t) vs. t.
t (sec)
α(t)
(deg
)
16.5
17
17.5
0 500 1500 25001000 2000
E α(t) vs. t.
t (sec)
σ(t)
(deg
)
-10
-20
-30
-40
-50
-60
-70
-80
0
0 500 1500 25001000 2000
F σ(t) vs. t.
Figure 4-7. Solution to the reusable launch vehicle entry problem using the ph-(4, 14)method with an accuracy tolerance of 10−6.
125
00
t
Mes
hR
efine
men
tIte
ratio
n
500 1000 1500 2000 2500
1
2
A Mesh point history.
00
t
Mes
hR
efine
men
tIte
ratio
n
500 1000 1500 2000 2500
1
2
B Collocation (LGR) point history.
Figure 4-8. Mesh refinement history to the reusable launch vehicle entry problem usingthe ph-(4, 14) method with an accuracy tolerance of 10−6.
126
4.6 Discussion
Each of the examples illustrates different features of the ph adaptive mesh
refinement method developed in Section 4.4. The first example shows how the
computational efficiency of the ph adaptive adaptive mesh refinement scheme is similar
to the computational efficiency of an h method while simultaneously having the ability
to generate a much smaller mesh for given accuracy tolerance than is possible using
an h method. This example also demonstrates the effectiveness of the error estimate
derived in Section 4.4.1. The second example shows how the ph adaptive method can
efficiently capture a discontinuity in the solution by making the mesh more dense near
the discontinuity while simultaneously not placing unnecessary mesh and collocation
points in regions distant from the discontinuity. Furthermore, the second example again
showed the significantly smaller mesh that was possible using the ph adaptive method
over the h method. Finally, the third example demonstrated how the ph adaptive method
can identify that additional mesh intervals are not needed and it is only necessary to
increase the degree of the polynomial approximation to achieve the desired accuracy
tolerance. Thus, the method of this chapter has a potential advantage over an h method
in that it keeps the nonlinear programming problem (NLP) much smaller in size than may
be typically required when using an h method. In applications limited by memory or if
computational efficiency is important, the method developed in this chapter may have
advantages over an h method.
4.7 Conclusions
A ph adaptive Legendre-Gauss-Radau collocation method for solving
continuous-time optimal control problems has been developed. An estimate of the
error was obtained interpolating the current approximation on a finer mesh and then
integrating the dynamics evaluated at the interpolation points to generate a more
accurate approximation to the solution of the state equation. This process is analogous
to the 2-stage modified Euler Runge-Kutta scheme where the first stage yields a
127
first-order approximation to the solution of a differential equation, and the second stage
interpolates this solution at a new point and then integrates the dynamics at this new
point to achieve a second-order approximation to the solution. The difference between
the first and second-order approximation is an estimate for the error in the first-order
scheme. Using this error estimate, a mesh refinement method was developed that
iteratively reduces the error estimate either by increasing the degree of the polynomial
approximation in a mesh interval or by increasing the number of mesh intervals. An
estimate was made of the polynomial degree required within a mesh interval to achieve
a given accuracy tolerance. If the required polynomial degree was estimated to be
less than an allowable maximum allowable polynomial degree, then the degree of the
polynomial approximation was increased on the ensuing mesh. Otherwise, the mesh
interval was divided into sub-intervals and the minimum allowable polynomial degree
was used in each newly created sub-interval on the ensuing mesh. This process was
repeated until a specified relative error accuracy tolerance was met. The method was
applied successfully to three examples that highlight various features of the method and
show the merits of the approach relative to a fixed-order method.
128
CHAPTER 5GPOPS-II: MULTIPLE PHASE OPTIMAL CONTROL SOFTWARE
The objective of this chapter is to provide to researchers a novel efficient
general-purpose optimal control software that is capable of solving a wide variety
of complex constrained continuous-time optimal control problems. In particular,
the software described in this chapter employs an hp-adaptive version of the
Legendre-Gauss-Radau orthogonal collocation method [18–20, 29] employed in
both differential and integral form. The Legendre-Gauss-Radau orthogonal collocation
method is chosen as the basis of the software because it provides highly accurate
primal (state and control) and dual (costate) approximations while maintaining a
relatively low-dimensional approximation of the continuous-time problem. While the
software described in this chapter is written in MATLAB, the approach can be adapted
for use in any modern programming language such as C, C++, or FORTRAN. After
describing the key components of the algorithm and the corresponding software,
four examples that have been previously studied in the open literature are provided
to demonstrate the flexibility, utility, and efficiency of the software. In order to see
the improvement over previously developed optimal control software, the software is
compared with the software Sparse Optimization Suite (SOS) [60].
5.1 General Multiple Phase Optimal Control Problems
The general multiple-phase optimal control problem that can be solved by GPOPS-II
is given as follows. First, let p ∈ [1, ... ,P] be the phase number where P as the total
number of phases. The optimal control problem is to determine the state, y(p)(t) ∈ Rn(p)y ,
control, u(p)(t) ∈ Rn(p)u , integrals, q(p) ∈ R
n(p)q , start times, t(p)0 ∈ R, phase terminus
times, t(p)f ∈ R, in all phases p ∈ [1, ... ,P], along with the static parameters s ∈ Rns , that
minimize the objective functional
J = φ([
y(1)(t(1)0 ), t
(1)0 , y
(1)(t(1)f ), t
(1)f , q
(1)]
, ... ,[
y(P)(t(P)0 ), t
(P)0 , y
(P)(t(P)f ), t
(P)f , q
(P)]
, s)
,
(5–1)
129
subject to the dynamic constraints
y(p) = a(p)(y(p), u(p), t(p), s), (p = 1, ... ,P), (5–2)
the event constraints
bmin ≤ b([
y(1)(t(1)0 ), t
(1)0 , y
(1)(t(1)f ), t
(1)f ,q
(1)]
, ... ,[
y(P)(t(P)0 ), t
(P)0 , y
(P)(t(P)f ), t
(P)f ,q
(P)]
, s)
≤ bmax, (5–3)
the inequality path constraints
c(p)min ≤ c(p)(y(p), u(p), t(p), s) ≤ c(p)max, (p = 1, ... ,P), (5–4)
the static parameter constraints
smin ≤ s ≤ smax, (5–5)
and the integral constraints
q(p)min ≤ q(p) ≤ q(p)max, (p = 1, ... ,P), (5–6)
where the integrals are defined as
q(p)i =
∫ t(p)f
t(p)0
g(p)i (y
(p), u(p), t(p), s)dt, (i = 1, ... n(p)q ), (p = 1, ... ,P). (5–7)
It is important to note that the event constraints of Eq. (5–3) can contain any functions
that relate information at the start and/or terminus of any phase (including relationships
that include both static parameters and integrals) and that the phases themselves need
not be sequential. It is noted that the approach to linking phases is based on well-known
formulations in the literature such as those given in Ref. [61] and [10]. A schematic of
how phases can potentially be linked is given in Fig. 5-1.
5.2 Legendre-Gauss-Radau Collocation Method
In this section we describe the variable-order Legendre-Gauss-Radau orthogonal
collocation method [18–20, 29] that forms the basis for GPOPS-II. In order to effectively
describe the Legendre-Gauss-Radau orthogonal collocation method, in this section we
consider only a one-phase optimal control problem. After formulating the one-phase
130
Phase 1 Phase 2 Phase 3
Phase 5
Phase 4
Tra
ject
ory
time
Phases 1 and 2 Connected
Phases 2 and 3 ConnectedPhases 2 and 5 Connected
Phases 3 and 4 Connected
Figure 5-1. Schematic of linkages for multiple-phase optimal control problem. Theexample shown in the picture consists of five phases where the ends ofphases 1, 2, and 3 are linked to the starts of phases 2, 3, and 4,respectively, while the end of phase 2 is linked to the start of phase 5.
optimal control problem we develop the Legendre-Gauss-Radau orthogonal collocation
method itself.
5.2.1 Single-Phase Optimal Control Problem
In order to describe the hp Legendre-Gauss-Radau orthogonal collocation method
that is implemented in the software, it will be useful to simplify the general optimal
control problem given in Eqs. (5–1)–(5–7) to a one-phase problem as follows. Determine
the state, y(t) ∈ Rny , the control, u(t) ∈ R
nu , the integrals, q ∈ Rnq , the initial time, t0,
and the terminal time tf on the time interval t ∈ [t0, tf ] that minimize the cost functional
J = φ(y(t0), t0, y(tf ), tf , q) (5–8)
subject to the dynamic constraints
dy
dt= a(y(t), u(t), t), (5–9)
131
the inequality path constraints
cmin ≤ c(y(t), u(t), t) ≤ cmax, (5–10)
the integral constraints
qi =
∫ tf
t0
gi(y(t), u(t), t) dt, (i = 1, ... , nq), (5–11)
and the event constraints
bmin ≤ b(y(t0), t0, y(tf ), tf , q) ≤ bmin. (5–12)
The functions φ, q, a, c and b are defined by the following mappings:
φ : Rny × R× R
ny × R× Rnq → R,
g : Rny × R
nu × R → Rnq ,
a : Rny × R
nu × R → Rny ,
c : Rny × R
nu × R → Rnc ,
b : Rny × R× R
ny × R× Rnq → R
nb ,
where we remind the reader that all vector functions of time are treated as row vectors.
At this point, it will be useful to modify the optimal control problem given in
Eqs. (5–8)–(5–12) as follows. Let τ ∈ [−1,+1] be a new independent variable. The
variable t is then defined in terms of τ as
t =tf − t02
τ +tf + t02. (5–13)
The optimal control problem of Eqs. (5–8)–(5–12) is then defined in terms of the variable
τ as follows. Determine the state, y(τ) ∈ Rny , the control u(τ) ∈ R
nu , the integral q ∈ Rnq ,
the initial time, t0, and the terminal time tf on the time interval τ ∈ [−1,+1] that minimize
the cost functional
J = φ(y(−1), t0, y(+1), tf , q) (5–14)
132
subject to the dynamic constraints
dy
dτ=tf − t02a(y(τ), u(τ), τ ; t0, tf ), (5–15)
the inequality path constraints
cmin ≤ c(y(τ), u(τ), τ ; t0, tf ) ≤ cmax, (5–16)
the integral constraints
qi =tf − t02
∫ +1
−1
gi(y(τ), u(τ), τ ; t0, tf ) dτ , (i = 1, ... , nq), (5–17)
and the event constraints
bmin ≤ b(y(−1), t0, y(+1), tf , q) ≤ bmin. (5–18)
Suppose now that the interval τ ∈ [−1,+1] is divided into a mesh consisting of K mesh
intervals [Tk−1,Tk ], k = 1, ... ,K , where (T0, ... ,TK) are the mesh points. The mesh
points have the property that −1 = T0 < T1 < T2 < · · · < TK = Tf = +1. Next,
let y(k)(τ) and u(k)(τ) be the state and control in mesh interval k . The optimal control
problem of Eqs. (5–14)–(5–18) can then written as follows. First, the cost functional of
Eq. (5–14) can be written as
J = φ(y(1)(−1), t0, y(K)(+1), tf , q), (5–19)
Next, the dynamic constraints of Eq. (5–15) in mesh interval k can be written as
dy(k)(τ (k))
dτ (k)=tf − t02a(y(k)(τ (k)), u(k)(τ (k)), τ (k); t0, tf ), (k = 1, ... ,K). (5–20)
Furthermore, the path constraints of (5–16) in mesh interval k are given as
cmin ≤ c(y(k)(τ (k)), u(k)(τ (k)), τ (k); t0, tf ) ≤ cmax, (k = 1, ... ,K). (5–21)
133
the integral constraints of (5–17) are given as
qj =tf − t02
K∑
k=1
∫ Tk
Tk−1
gj(y(k)(τ (k)), u(k)(τ (k)), τ (k); t0, tf ) dτ , (j = 1, ... , nq, k = 1 ... ,K).
(5–22)
Finally, the event constraints of Eq. (5–18) are given as
bmin ≤ b(y(1)(−1), t0, y(K)(+1), tf , q) ≤ bmax. (5–23)
Because the state must be continuous at each interior mesh point, it is required that the
condition y(k)(Tk) = y(k+1)(Tk) be satisfied at the interior mesh points (T1, ... ,TK−1).
5.2.2 Variable-Order Legendre-Gauss-Radau Collocation M ethod
The method utilized in the software is an implementation of the previously
developed multiple-interval Legendre-Gauss-Radau orthogonal collocation method
[18–20, 29]. In the Legendre-Gauss-Radau orthogonal collocation method, the state
of the continuous-time optimal control problem is approximated in each mesh interval
k ∈ [1, ... ,K ] as
y(k)(τ) ≈ Y(k)(τ) =Nk+1∑
j=1
Y(k)j ℓ(k)j (τ), ℓ(k)j (τ) =
Nk+1∏
l=1l 6=j
τ − τ (k)l
τ (k)j − τ (k)l, (5–24)
where τ ∈ [−1,+1], ℓ(k)j (τ), j = 1, ... ,Nk + 1, is a basis of Lagrange polynomials,
(τ (k)1 , ... , τ(k)Nk) are the Legendre-Gauss-Radau [51] (LGR) collocation points in mesh
interval k defined on the subinterval τ (k) ∈ [Tk−1,Tk), and τ (k)Nk+1 = Tk is a noncollocated
point. Differentiating Y(k)(τ) in Eq. (5–24) with respect to τ , we obtain
dY(k)(τ)
dτ=
Nk+1∑
j=1
Y(k)j
dℓ(k)j (τ)
dτ. (5–25)
The cost functional of Eq. (5–19) is then shown as
J = φ(Y(1)1 , t0,Y(K)NK+1, tf , q), (5–26)
134
where Y(1)1 is the approximation of y(T0 = −1), and Y(K)NK+1 is the approximation of
y(TK = +1). Collocating the dynamics of Eq. (5–20) at the Nk LGR points using
Eq. (5–25), we have
Nk+1∑
j=1
D(k)ij Y
(k)j − tf − t0
2a(Y
(k)i ,U
(k)i , τ
(k)i ; t0, tf ) = 0, (i = 1, ... ,Nk). (5–27)
where U(k)i , i = 1, ... ,Nk , are the approximations of the control at the Nk LGR points in
mesh interval k ∈ [1, ... ,K ], and t(k)i are obtained from τ (k)k using Eq. (5–13) and
D(k)ij =
[
dℓ(k)j (τ)
dτ
]
τ(k)i
, (i = 1, ... ,Nk , j = 1, ... ,Nk + 1, k = 1, ... ,K), (5–28)
is the Nk × (Nk + 1) Legendre-Gauss-Radau differentiation matrix [18] in mesh
interval k ∈ [1, ... ,K ]. While the dynamics can be collocated in differential form, an
alternative approach to collocate the dynamics using the equivalent integral form of
the Legendre-Gauss-Radau orthogonal collocation method as described in [18–20].
Collocating the dynamics using the integral form of the Legendre-Gauss-Radau
orthogonal collocation method we have
Y(k)i+1 −Y
(k)1 − tf − t0
2
Nk∑
j=1
I(k)ij a(Y
(k)i ,U
(k)i , τ
(k)i ; t0, tf ) = 0, (i = 1, ... ,Nk), (5–29)
where I (k)ij , (i = 1, ... ,Nk , j = 1, ... ,Nk , k = 1, ... ,K) is the Nk × Nk Legendre-Gauss-
Radau integration matrix in mesh interval k ∈ [1, ... ,K ], and is obtained from the
differentiation matrix as
I(k) ≡[
D(k)2:Nk+1
]−1
,
Finally, it is noted for completeness that I(k)D(k)1 = −1, where 1 is a column vector
of length Nk of all ones. It is noted that Eqs. (5–27) and (5–29) can be be evaluated
over all intervals simultaneously using the composite Legendre-Gauss-Radau
differentiation matrix D, and the composite Legendre-Gauss-Radau integration matrix
I respectively. Furthermore, the structure of the composite Legendre-Gauss-Radau
135
differentiation matrix D can be seen in Fig. 5-2, and the structure of the composite
Legendre-Gauss-Radau integration matrix I can be seen in Fig. 5-3. Next, the path
constraints of Eq. (5–21) in mesh interval k ∈ [1, ... ,K ] are enforced at the Nk LGR
points as
cmin ≤ c(Y(k)i ,U(k)i , τ
(k)i ; t0, tf ) ≤ cmax, (i = 1, ... ,Nk), (5–30)
the integral constraints of Eq. (5–22) is then approximated as
qj ≈K∑
k=1
Nk∑
i=1
tf − t02w(k)i gj(Y
(k)i ,U
(k)i , τ
(k)i ; t0, tf ), (i = 1, ... ,Nk, j = 1, ... , nq), (5–31)
where w (k)j , j = 1, ... ,Nk are the LGR quadrature weights [51] in mesh interval
k ∈ [1, ... ,K ] defined on the interval τ ∈ [τk−1, τk). Furthermore, the event constraints of
Eq. (5–23) are approximated as
bmin ≤ b(Y(1)1 , t0,Y(K)NK+1, tf , q) ≤ bmax. (5–32)
It is noted that continuity in the state at the interior mesh points k ∈ [1, ... ,K − 1] is
enforced via the condition
Y(k)Nk+1
= Y(k+1)1 , (k = 1, ... ,K − 1), (5–33)
where we note that the same variable is used for both Y(k)Nk+1 and Y(k+1)1 . Hence, the
constraint of Eq. (5–33) is eliminated from the problem because it is taken into account
explicitly. The NLP that arises from the Legendre-Gauss-Radau orthogonal collocation
method is then to minimize the cost function of Eq. (5–26) subject to the algebraic
constraints of Eqs. (5–27)–(5–32).
5.3 Major Components of GPOPS-II
In this section we describe the major components of the MATLAB software GPOPS-
II that implements the aforementioned Legendre-Gauss-Radau orthogonal collocation
method. In Section 5.3.1 we describe the large sparse nonlinear programming problem
(NLP) associated with the Legendre-Gauss-Radau orthogonal collocation method. In
136
Block 1
Block 2
Block 3
Block K
(2) Zeros Except in Blocks
(1) Block k is of Size Nk by Nk+1
(3) Total Size N by N+1
Figure 5-2. Structure of single-phase composite Legendre-Gauss-Radau differentiationmatrix where the mesh consists of K mesh intervals.
Block 1
Block 2
Block 3
Block K
(2) Zeros Except in Blocks
(1) Block k is of Size Nk by Nk
(3) Total Size N by N
Figure 5-3. Structure of single-phase composite Legendre-Gauss-Radau integrationmatrix where the mesh consists of K mesh intervals.
Section 5.3.2 we show the structure of the NLP described in Section 5.3.1. In Section
5.3.3 we describe the method for scaling the NLP via scaling of the optimal control
problem. In Section 5.3.4 we describe the approach for estimating the derivatives
required by the NLP solver. In Section 5.3.5 we describe the method for determining
the dependencies of each optimal control function in order to provide the most sparse
NLP to the NLP solver. In Section 5.3.6 we describe the hp-adaptive mesh refinement
methods that are included in the software in order to iterative determine a mesh that
meets a user-specified accuracy tolerance. Finally, in Section 5.3.7 we provide a high
level description of the algorithmic flow of GPOPS-II.
137
5.3.1 NLP Structure
The nonlinear programming problem (NLP) associated with the hp
Legendre-Gauss-Radau orthogonal collocation method is given as follows. Determine
the decision vector Z that minimizes the objective function
Φ(Z) (5–34)
subject to the constraints
Fmin ≤ F(Z) ≤ Fmax. (5–35)
and the variable bounds
Zmin ≤ Z ≤ Zmax. (5–36)
It is noted that the size of the NLP arising from the hp Legendre-Gauss-Radau
orthogonal collocation method changes depending upon the number of mesh intervals
and LGR points used in each phase to discretize the continuous-time optimal control
problem, but the structure of the NLP is the same regardless of the number of mesh
intervals used in the discretization.
5.3.1.1 NLP variables
The NLP decision vector Z is given as
Z =
z(1)
...
z(P)
s1
...
sns
, (5–37)
where z(p) contains all the variables of phase p = 1 ...P , and si (i = 1, ... , ns) are
the static parameters in the problem. The phase-dependent variables of Eq. (5–37)
138
z(p) (p = 1, ... ,P), are given as
z(p) =
V(p)1
...
V(p)
n(p)y
W(p)1
...
W(p)
n(p)u
q(p)
t(p)0
t(p)f
, (p = 1, ... ,P), (5–38)
where V(p)i ∈ R(N(p)+1) (i = 1, ... , n
(p)y ) is the i th column of the matrix
V(p) =
Y(p)1
...
Y(p)
N(p)+1
∈ R(N(p)+1)×n(p)y , (5–39)
W(p)i ∈ R
N(p) (i = 1, ... , n(p)u ) is the i th column of the matrix,
W(p) =
U(p)1...
U(p)N(p)+1
∈ RN(p)×n
(p)u , (5–40)
q(p) is a column vector containing the n(p)q integral constraint variables, and t(p)0 ∈ R
and t(p)f ∈ R are scalars corresponding to the initial and terminal times in phase
p ∈ [1, ... ,P]. We remind the reader again that because the state and control are being
treated as row vectors, the i th row in the matrices of Eqs. (5–39) and (5–39) corresponds
to the value of the discretized state and control at the time t(p)i . Finally, the bounds Zmin
and Zmax are defined from the optimal control variable bounds as supplied by the user.
139
5.3.1.2 NLP objective and constraint functions
The NLP objective function Φ(Z) is defined as follows
Φ(Z) = φ (5–41)
where φ is the optimal control objective function evaluated at the discrete variables
defined in function of Eq. (5–1). The NLP constraint function vector F(Z) is then
assembled as
F =
f(1)
...
f(P)
b
, (5–42)
where f(p) are the constraints in phase p ∈ [1, ... ,P] and b is the vector of n(p)b event
constraints evaluated at the discrete variables defined in function of Eq. (5–3). The
phase-dependent constraints of Eq. (5–42) f(p) (p ∈ [1, ... ,P] have the structure
f(p) =
∆(p)1
...
∆(p)
n(p)y
C(p)1
...
C(p)
n(p)c
ρ(p)
, (p = 1, ... ,P), (5–43)
where ∆(p)i ∈ RN(p) (i = 1, ... , n
(p)y ) is the i th column in the defect constraint matrix
that results from either the differential or integral form of the Legendre-Gauss-Radau
orthogonal collocation method. The defect matrix that results from the differential form is
defined as
∆(p) = D(p)Y(p) − t(p)f − t(p)02
A(p) ∈ RN(p)×n
(p)y . (5–44)
140
The defect matrix that results from the integral form is defined as
∆(p) = E(p)Y(p) − t(p)f − t(p)02
I(p)A(p) ∈ RN(p)×n
(p)y , (5–45)
where the matrix A is the right hand side of the dynamics evaluated at each collocation
point
A(p) =
a(Y(p)1 ,U
(p)1 , t
(p)1 , s)
...
a(Y(p)
N(p),U(p)N(p), t(p)
N(p), s)
∈ RN(p)×n
(p)y , (5–46)
E(p) is an N(p)× (N(p)+1) matrix that is used to compute the difference Y(p,k)i+1 −Y(p,k)1 for
each interval k = 1, ... ,K (p), and each phase p = 1, ... ,P and has the structure shown in
Fig. 5-4, C(p)i ∈ RN(p), (i = 1, ... , n
(p)c ), is the i th column of the path constraint matrix
C(p) =
c(Y(p)1 ,U
(p)1 , t
(p)1 , s)
...
c(Y(p)
N(p),U(p)N(p), t(p)
N(p), s)
∈ RN(p)×n
(p)c , (5–47)
ρ(p) is a vector of length n(p)q(p)
where the i th element of ρ(p) is given as
ρ(p)i = q(p)i − t
(p)f − t(p)02
[
w(p)]TG(p)i , (i = 1, ... , n
(p)q ), (5–48)
where G(p)i ∈ RN(p) (i = 1, ... , n
(p)q ) is the i th column of the integrand matrix
G(p) =
g(Y(p)1 ,U
(p)1 , t
(p)1 , s)
...
g(Y(p)
N(p),U(p)N(p), t(p)
N(p), s)
∈ RN(p)×n
(p)q . (5–49)
It is noted that the defect and integral constraints are all equality constraints of the form
∆(p) = 0,
ρ(p) = 0,(5–50)
141
Block 1
Block 2
Block 3
Block K
(3) Zeros Except in Blocks
(1) Block k is of Size Nk by Nk+1
(4) Total Size N by N+1
-1
-1
-1
-1
-1
1
1
1
1
1
-1
-1
-1
-1
-1
1
1
1
1
1
-1
-1
-1
1
1
1
-1
-1
-1
-1
1
1
1
1
Figure 5-4. Matrix E of the defect constraints of Eq. (5–45) for one phase of a P-phaseoptimal control problem discretized using the Legendre-Gauss-Radauorthogonal collocation method.
while the discretized path constraints and boundary conditions are inequality constraints
of the form
C(p)min ≤ C(p) ≤ C
(p)max,
bmin ≤ b ≤ bmax.(5–51)
5.3.2 Sparse Structure of NLP Derivative Functions
The structure of the NLP created by the Legendre-Gauss-Radau orthogonal
collocation method has been described in detail in [29] and [50]. Specifically, [29]
and [50] describe, respectively, the sparse structure of the NLP for the differential
and integral forms of the Legendre-Gauss-Radau orthogonal collocation method.
Figures 5-5 and 5-6 show the structure of the NLP constraint Jacobian and Lagrangian
Hessian for a single-phase optimal control problem using the differential and
integral forms of the Legendre-Gauss-Radau orthogonal collocation method. For a
multiple-phase optimal control problem the constraint Jacobian structure in either
the differential or integral form is a combination of a block-diagonal version of the
single-phase NLP constraint Jacobian, where each block has the structure as seen in
either Fig. 5-5A or 5-6A with rows added to the bottom of the Jacobian matrix to account
for derivatives of the event constraints. Similarly, for a multiple-phase optimal control
problem the NLP Lagrangian Hessian using either the differential or integral form of the
142
Legendre-Gauss-Radau orthogonal collocation method consists of a block-diagonal
version of the single-phase NLP Lagrangian Hessian where each block has the structure
seen in either Fig. 5-5B or 5-6B, with the additional points from the second derivatives
of the event constraints, b, and the objective function, φ. For more details details on the
sparse structure of the NLP arising from the multiple-phase Legendre-Gauss-Radau
orthogonal collocation method, please see [29] and [50].
5.3.3 Optimal Control Problem Scaling for NLP
The NLP described in Section 5.3.1 must be well scaled in order for the NLP
solver to obtain a solution. GPOPS-II includes the option for the NLP to be scaled
automatically by scaling the continuous-time optimal control problem. The approach to
automatic scaling is to scale the variables and the first derivatives of the optimal control
functions to be ≈ O(1). First, the optimal control variables are scaled to lie on the unit
interval [−1/2, 1/2] and is accomplished as follows. Suppose it is desired to scale an
arbitrary variable x ∈ [a, b] to x such that x ∈ [−1/2, 1/2]. This variable scaling is
accomplished via the affine transformation
x = vxx + rx , (5–52)
where vx and rx are the variable scale and shift, respectively, defined as
vx =1
b − a ,
rx =1
2− b
b − a .(5–53)
Every variable in the continuous-time optimal control problem is scaled using
Eqs. (5–52) and (5–53). Next, the Jacobian of the NLP constraints can be made ≈ O(1)
by scaling the derivatives of the optimal control functions to be approximately unity. First,
using the approach derived in [10], in GPOPS-II the defect constraints are scaled using
the same scale factors as was used to scale the state. Next, the objective function, event
constraint, and path constraint scale factors are obtained by sampling the gradient of
143
Def
ect
1
State 1 State 2 State ny
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Zeros or Diagonal
Block+D-M
atrix Zeros or D
iagonal
Block+D-M
atrix
D
efec
t 2
Def
ect
ny
Control 1 Control nu
Pat
h 1
Either Zeros or
Diagonal Block
Pat
h n
c
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Zeros or Diagonal
Block+D-M
atrixEither Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
t0 tf
q1 qnq
ρ1
Identity
All Zeros
All Zeros
ρn
q
A One-phase NLP Jacobian.
Control nu
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
t0 tf
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Control 1 State ny State 1
q1 qnq
All Zeros
All Zeros
All Zeros
All Zeros All Zeros
B One-phase NLP Lagrangian Hessian.
Figure 5-5. One-phase Legendre-Gauss-Radau orthogonal collocation methoddifferential scheme NLP constraint Jacobian and Lagrangian Hessian.
144
Def
ect
1
State 1 State 2 State ny
D
efec
t 2
Def
ect
ny
Control 1 Control nu
Pat
h 1
Either Zeros or
Diagonal Block
Pat
h n
c
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
t0 tf
q1 qnq
ρn
qρ
1
Identity
All Zeros
All Zeros
Zeros or Integration
Block+E-Matrix
Zeros or Integration
Block+E-Matrix
Zeros or Integration
Block+E-Matrix
Either Zeros or
Integration Block
Either Zeros or
Integration Block
Either Zeros or
Integration Block
Either Zeros or
Integration Block
Either Zeros or
Integration Block
Either Zeros or
Integration Block
Either Zeros or
Integration Block
Either Zeros or
Integration Block
Either Zeros or
Integration Block
Either Zeros or
Integration Block
A One-phase NLP Jacobian.
Control nu
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
t0 tf
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Either Zeros or
Diagonal Block
Control 1 State ny State 1
q1 qnq
All Zeros
All Zeros
All Zeros
All Zeros All Zeros
B One-phase NLP Lagrangian Hessian.
Figure 5-6. One-phase Legendre-Gauss-Radau orthogonal collocation method integralscheme NLP constraint Jacobian and Lagrangian Hessian.
145
each constraint at a variety of sample points within the bounds of the unscaled optimal
control problem and taking the average norm of each gradient across all sample points.
5.3.4 Computation of Derivatives Required by the NLP Solver
The optimal control problem derivative functions are obtained by exploiting the
sparse structure of the NLP arising from the hp Legendre-Gauss-Radau orthogonal
collocation method. Specifically, in [29] and [50] it has been shown that using either the
derivative or integral form of the Legendre-Gauss-Radau orthogonal collocation method
the NLP derivatives can be obtained by computing the derivatives of the optimal control
problem functions at the LGR points and inserting these derivatives into the appropriate
locations in the NLP derivative functions. In GPOPS-II the optimal control derivative
functions are approximated using sparse forward, central, or backward finite-differencing
of the optimal control problem functions. To see how this sparse finite differencing works
in practice, consider the function f(x), where f : Rn −→ Rm is one of the optimal control
functions (that is, n and m are, respectively, the size of an optimal control variable and
an optimal control function). Then ∂f/∂x is approximated using a forward finite difference
as∂f
∂xi≈ f(x+ hi)− f(x)
hi, (5–54)
where hi arises from perturbing the i th component of x. The vector hi is computed as
hi = hiei (5–55)
where ei is the i th row of the n × n identity matrix and hi is the perturbation size
associated with xi . The perturbation hi is computed using the equation
hi = h(1 + |xi |), (5–56)
where the base perturbation size h is chosen to be the optimal step size for a
function whose input and output are ≈ O(1) as described in [62]. Second derivative
approximations are computed in a manner similar to that used for first derivative
146
approximations with the key difference being that perturbations in two variables are
performed. For example, ∂2f/∂xi∂xj can be approximated using a second forward
difference approximation as
∂2f
∂xi∂xj≈ f(x+ hi + hj) + f(x)− f(x+ hi)− f(x+ hj)
hihj, (5–57)
where hi , hj , hi , and hj are as defined in Eqs. (5–55) and (5–56). The base perturbation
size is chosen to minimize round-off error in the finite difference approximation.
Furthermore, it is noted that hi −→ h as |xi | −→ 0.
5.3.5 Determining the Optimal Control Function Dependenci es
It can be seen from Section 5.3.2 that the NLP associated with the
Legendre-Gauss-Radau orthogonal collocation method has a sparse structure where
the blocks of the constraint Jacobian and Lagrangian Hessian are dependent upon
whether a particular NLP function depends upon a particular NLP variable as was
shown in [29]. The method for determining the optimal control function dependencies
in GPOPS-II utilizes the IEEE arithmetic representation of “not-a-number” (NaN)
in MATLAB. Specifically, MATLAB has the feature that any function evaluated at
NaN will produce an output of NaN if the function depends upon the variable. For
example, suppose that f(x) is a function where f : Rn −→ Rm and x =
[
x1 ... xn
]
.
Suppose further that we set xi = NaN. If any of the components of f(x) is a function
of xi , then those components of f(x) that depend on xi will each be NaN. In this
way, the dependence of the optimal control problem functions on a particular input
component can be determined by evaluating the functions with that component of
the input set to NaN using a single function evaluation. Furthermore, the complete
dependencies of the optimal control problem functions are found by repeating this
process for each component of the input. These dependencies then provide a map as
to which finite differences need to be taken when computing the first derivatives of the
optimal control functions for determining the NLP derivative functions as described in
147
Section 5.3.4. Furthermore, it is assumed in GPOPS-II that the second derivative of
any optimal control function will be nonzero if the first derivative with respect to that
same variable is nonzero. For example, if it is found that the right-hand side of the
dynamics depends upon a particular component of the state, then it is assumed that
the second derivative also depends upon this same component of the state. While this
approach may lead to a slight over-estimate of the second derivative dependencies,
it will generally be the case that this over-estimate will not be significantly larger than
the ideal dependencies been obtained. Moreover, the computational cost for obtaining
the second derivative dependencies in the manner described is essentially zero while
the added computational effort required to solve the NLP assuming that some of these
dependencies are nonzero (when in fact they may be zero) is minimal.
5.3.6 Adaptive Mesh Refinement
In the past few years, the subject of variable-order mesh refinement has been of
considerable study in the efficient implementation of Gaussian quadrature collocation
methods. The work on variable-order Gaussian quadrature mesh refinement has led
to several articles in the literature including those found in [21, 22, 46, 63]. GPOPS-II
employs the two latest variable-order mesh refinement methods as described in [22, 63].
The mesh refinement methods of [22] and [63] are referred to as the hp and the ph
methods, respectively. In either the hp and the ph mesh refinement methods the number
of mesh intervals, width of each mesh interval, and the degree of the approximating
polynomial can be varied until a user-specified accuracy tolerance has been achieved.
When using either of the methods in GPOPS-II, the terminology hp − (Nmin,Nmax) or
ph− (Nmin,Nmax) refers to a method whose minimum and maximum allowable polynomial
degrees within a mesh interval are Nmin and Nmax, respectively. Each method estimates
the solution error using a relative difference between the state estimate and the integral
of the dynamics at a modified set of LGR points. The key difference between the hp and
the ph methods lies in the manner in which the decision is made to either increase the
148
number of collocation points in a mesh interval or to refine the mesh. In [22] the degree
of the approximating polynomial is increased if the ratio of the maximum curvature over
the mean curvature of the state in a particular mesh interval. On the other hand, [63]
uses the exponential convergence property of the Legendre-Gauss-Radau orthogonal
collocation method and increases the polynomial degree within a mesh interval if the
estimate of the required polynomial degree is less than a user-specified upper limit.
If the estimate of the polynomial degree exceeds the allowed upper limit, the mesh
interval is divided into more mesh intervals. In GPOPS-II and the user can choose
between these two mesh refinement methods. Finally, it is noted that GPOPS-II has
been designed in a modular way making it possible to add a new mesh refinement
method in a relatively straightforward way if it is so desired.
5.3.7 Algorithmic Flow of GPOPS-II
In this section we describe the operational flow of GPOPS-II with the aid of Fig. 5-7.
First, the user provides a description of the optimal control problem that is to be solved.
The properties of the optimal control problem are then determined from the user
description from which the state, control, time, and parameter dependencies of the
optimal control problem functions are determined. Subsequently, assuming that the
user has specified that the optimal control problem be scaled automatically, the optimal
control problem scaling algorithm is called and these scale factors are used to scale
the NLP. The optimal control problem is then transcribed to a large sparse NLP and the
NLP is solved on the initial mesh, where the initial mesh is either user-supplied or is
determined by the defaults set in GPOPS-II. Once the NLP is solved, it is untranscribed
to a discrete approximation of the optimal control problem and the error in the discrete
approximation for the current mesh is estimated. If the user-specified accuracy tolerance
is met, the software terminates and outputs the solution. Otherwise, a new mesh is
determined using one of the supplied mesh refinement algorithms and the resulting NLP
is solved on the new mesh.
149
INPUT:Initial Setup for Optimal
Control Problem
Find Properties ofOptimal Control Problem
from the User-Provided Setup
Find Derivative Dependenciesof the Optimal Control
Problem Functions
Find Optimal ControlProblem Variable and
Function Scaling
Optimal Control ProblemTranscribed to NonlinearProgramming Problem
on Current Mesh
Is Estimated Error <Desired Error Tolerance?
Determine New Mesh for theOptimal Contol Problem
Set Initial Guess of theOptimal Control Problem
to the Current Solution
Estimate the Errorof the Optimal Control
Problem Solution
False
True OUTPUT:Solution to Optimal
Control Problem
Figure 5-7. Flowchart of the GPOPS-II algorithm.
5.4 Examples
GPOPS-II is now demonstrated on five examples taken from the open literature.
The first example is the hyper-sensitive optimal control problem from Ref. [56] and
demonstrates the ability of GPOPS-II to efficiently solve problems that have rapid
changes in dynamics in particular regions of the solution. The second example is
the reusable launch vehicle entry problem taken from Ref. [10] and demonstrates the
efficiency of GPOPS-II on a more realistic problem. The third example is the space
station attitude optimal control problem taken from [64] and [10] and demonstrates
the efficiency of GPOPS-II on a problem whose solution is highly non-intuitive. The
fourth example is a kinetic batch reactor problem taken from [10] and demonstrates
the ability of GPOPS-II to solve an extremely badly scaled multiple-phase optimal
control problem. The fifth example is a multiple-stage launch vehicle ascent problem
taken from [10, 17, 23] and demonstrates the ability of GPOPS-II to solve a problem
150
with multiple-phases. The first four examples were solved using the open-source NLP
solver IPOPT [58] in second derivative (full Newton) mode with the publicly available
multifrontal massively parallel sparse direct linear solver MUMPS [59], while the fifth
example was solved using the NLP solver SNOPT [41]. All results were obtained using
the integral form of the Legendre-Gauss-Radau orthogonal collocation method and
various forms of the aforementioned ph mesh refinement method using default NLP
solver settings and the automatic scaling routine in GPOPS-II.
5.4.1 Hyper-Sensitive Problem
Consider the following hyper-sensitive optimal control problem taken from [56]:
minimize 12
∫ tf
0
(x2 + u2)dt subject to
x = −x3 + u,
x(0) = 1,
x(tf ) = 1.5,
(5–58)
where tf = 10000. It is known for a sufficiently large value of tf the interesting behavior
in the solution occurs near t = 0 and t = tf (see Ref. [56] for details), while the vast
majority of the solution is a constant. Given the structure of the solution, a majority of
collocation points need to be placed near t = 0 and t = tf .
The hyper-sensitive optimal control problem was solved using GPOPS-II with
the ph − (3, 10) method an an initial mesh of ten evenly spaced mesh interval with
three LGR points per mesh interval. The solution obtained using GPOPS-II is shown
in Fig. 5-8 alongside the solution obtained with the software Sparse Optimization Suite
(SOS) [60]. It is seen that the GPOPS-II and SOS solutions are in excellent agreement.
Moreover, the optimal cost obtained using GPOPS-II and SOS are extremely close, with
values 3.3620563 and 3.3620608, respectively. In order to demonstrate how GPOPS-II is
capable of capturing the interesting features of the optimal solution, Figure. 5-9 shows
the solution on the intervals t ∈ [0, 15] (near the initial time) and t ∈ [9985, 10000]
(near the final time), while Fig. 5-10 shows the mesh refinement history. It is seen that
GPOPS-II accurately captures the rapid decay from x(0) = 1 and the rapid growth to
151
meet the terminal condition x(tf ) = 1.5, and the density of the mesh points near t = 0
and t = tf increases as the mesh refinement progresses. Finally, Table 5-1 shows the
estimated error on each mesh, where it is seen that the solution error decreases steadily
with each mesh refinement iteration, finally terminating on the eighth mesh (that is, the
seventh mesh refinement).
GPOPS-IISOS
t
x(t)
0
0
1
10000-0.2
0.2
0.4
0.6
1.2
1.4
1.6
1.8
2000 4000 6000 8000
A x(t) vs. t.
GPOPS-IISOS
t
u(t)
0
0
1
2
3
4
5
6
7
8
10000-1
2000 4000 6000 8000
B u(t) vs. t.
Figure 5-8. GPOPS-II and Sparse Optimization Suite solutions to hyper-sensitiveoptimal control problem.
152
GPOPS-IISOS
t
x(t)
0
0
1
5 10 20 2515-0.2
0.2
0.4
0.6
1.2
1.4
1.6
1.8
A x(t) vs. t near t = 0.
GPOPS-IISOS
t
x(t)
0
1
9985 9990 9995 100009975 9980-0.2
0.2
0.4
0.6
1.2
1.4
1.6
1.8
B x(t) vs. t near t = tf .
GPOPS-IISOS
t
u(t)
0
0
1
5 10 20 25
-0.8
-0.6
-0.4
15
-0.2
-1
0.2
0.4
0.6
1.8
C u(t) vs. t near t = 0.
GPOPS-IISOS
t
u(t)
0
1
2
3
4
5
6
7
8
9985 9990 9995 100009975 9980-1
D u(t) vs. t near t = tf .
Figure 5-9. GPOPS-II and Sparse Optimization Suite solutions to hyper-sensitiveoptimal control problem near t = 0 and t = tf .
Mes
hR
efine
men
tIte
ratio
n
Mesh Point Locations0
1
2
3
4
5
6
7
8
100002000 4000 6000 8000
Figure 5-10. Mesh refinement history for hyper-sensitive problem using GPOPS-II.
153
Table 5-1. Mesh refinement history for hyper-sensitive problem.Mesh Relative Error Estimate
1 2.827× 1012 2.823× 1003 7.169× 10−14 1.799× 10−15 7.092× 10−26 8.481× 10−37 1.296× 10−38 5.676× 10−7
5.4.2 Reusable Launch Vehicle Entry
Consider the following optimal control problem of maximizing the crossrange during
the atmospheric entry of a reusable launch vehicle and taken from [10] where the
numerical values in [10] are converted from English units to SI units. Maximize the cost
functional
J = φ(tf ) (5–59)
subject to the dynamic constraints
r = v sin γ , θ =v cos γ sinψ
r cos φ,
φ =v cos γ cosψ
r, v = −D
m− g sin γ,
γ =L cos σ
mv−(g
v− vr
)
cos γ , ψ =L sinσ
mv cos γ+v cos γ sinψ tanφ
r,
(5–60)
and the boundary conditions
h(0) = 79248 km , h(tf ) = 24384 km , θ(0) = 0 deg,
θ(tf ) = Free, , φ(0) = 0 deg , φ(tf ) = Free,
v(0) = 7.803 km/s , v(tf ) = 0.762 km/s , γ(0) = −1 deg,
γ(tf ) = −5 deg , ψ(0) = 90 deg , ψ(tf ) = Free,
(5–61)
where r = h + Re is the geocentric radius, h is the altitude, Re is the polar radius of
the Earth, θ is the longitude, φ is the latitude, v is the speed, γ is the flight path angle,
and ψ is the azimuth angle. Furthermore, the aerodynamic and gravitational forces are
154
computed as
D = ρv 2SCD/2 , L = ρv 2SCL/2 , g = µ/r2, (5–62)
where ρ = ρ0 exp(−h/H) is the atmospheric density, ρ0 is the density at sea level, H is
the density scale height, S is the vehicle reference area, CD is the coefficient of drag, CL
is the coefficient of lift, and µ is the gravitational parameter.
The reusable launch vehicle entry optimal control problem was solved with GPOPS-
II using the ph − (4, 10) mesh refinement method and an initial mesh consisting of
ten evenly spaced mesh intervals with four LGR points per mesh interval and a mesh
refinement accuracy tolerance of 10−7. The initial guess of the state was a straight line
over the duration t ∈ [0, 1000] between the known initial and final components of the
state or a constant at the initial values of the components of the state whose terminal
values are not specified, while the initial guess of both controls was zero. The solution
obtained using GPOPS-II is shown in Figs. 5-11A–5-11F alongside the solution obtained
using the software Sparse Optimization Suite (SOS) [10], where it is seen that the
two solutions obtained are virtually indistinguishable. It is noted that the optimal cost
obtained by GPOPS-II and SOS are also nearly identical at 0.59627639 and 0.59587608,
respectively. Table 5-2 shows the performance of both GPOPS-II and SOS on this
example. It is interesting to see that GPOPS-II meets the accuracy tolerance of 10−7 in
only four mesh iterations (three mesh refinements) while SOS requires a total of eight
meshes (seven mesh refinements). Finally, the number of collocation points used by
GPOPS-II is approximately one half the number of collocation points required by SOS to
achieve the same level of accuracy.
155
SOSGPOPS-II
t (s)
h(t)
(km
)
020
30
40
50
60
70
80
500 1500 25001000 2000
A h(t) vs. t.
SOSGPOPS-II
t (s)
v(t)
(km
/s)
00
1
2
3
4
5
500 1500 2500
6
7
8
1000 2000
B v(t) vs. t.
SOSGPOPS-II
t (s)
φ(t)
(deg
)
00
5
15
20
25
30
35
500 1500 2500
10
1000 2000
C φ(t) vs. t.
SOSGPOPS-II
t (s)
γ(t)
(deg
)0
0
1
500 1500 2500-6
-5
-4
-3
-2
-1
1000 2000
D γ(t) vs. t.
SOSGPOPS-II
t (s)
α(t)
(deg
)
16.5
17
17.5
0 500 1500 25001000 2000
E α(t) vs. t.
SOSGPOPS-II
t (s)
σ(t)
(deg
)
-10
-20
-30
-40
-50
-60
-70
-80
0
0 500 1500 2500
10
1000 2000
F σ(t) vs. t.
Figure 5-11. Solution to reusable launch vehicle entry problem using GPOPS-II.
156
Table 5-2. Performance of GPOPS-II on the reusable launch vehicle entry optimalcontrol problem.
Mesh Estimated Number of Estimated Number ofIteration Error (GPOPS-II) Collocation Points Error (SOS) Collocation Points1 2.463× 10−3 41 1.137× 10−2 512 2.946× 10−4 103 1.326× 10−3 1013 1.202× 10−5 132 3.382× 10−5 1014 8.704× 10−8 175 1.314× 10−6 1015 – – 2.364× 10−7 2016 – – 2.364× 10−7 2327 – – 1.006× 10−7 3488 – – 9.933× 10−8 353
5.4.3 Space Station Attitude Control
Consider the following space station attitude control optimal control problem taken
from [64] and [10]. Minimize the cost functional
J = 12
∫ tf
t0
uTudt (5–63)
subject to the dynamic constraints
ω = J−1 τ gg(r)− ω⊗ [Jω + h]− u ,
r = 12
[
rrT + I+ r]
[ω − ω(r)] ,
h = u,
(5–64)
the inequality path constraint
‖h‖ ≤ hmax, (5–65)
157
and the boundary conditions
t0 = 0,
tf = 1800,
ω(0) = ω0,
r(0) = r0,
h(0) = h0,
0 = J−1 τ gg(r(tf ))− ω⊗(tf ) [Jω(tf ) + h(tf )] ,
0 = 12
[
r(tf )rT(tf ) + I+ r(tf )
]
[ω(tf )− ω0(r(tf ))] ,
(5–66)
where (ω, r, h) is the state and u is the control. In this formulation ω is the angular
velocity, r is the Euler-Rodrigues parameter vector, h is the angular momentum, and u is
the input moment (and is the control).
ω0(r) = −ωorbC2,
τ gg = 3ω2orbC⊗3 JC3,
(5–67)
and C2 and C3 are the second and third column, respectively, of the matrix
C = I+2
1 + rTr
(
r⊗r⊗ − r⊗)
. (5–68)
In this example the matrix J is given as
J =
2.80701911616 × 107 4.822509936 × 105 −1.71675094448 × 107
4.822509936 × 105 9.5144639344 × 107 6.02604448 × 104
−1.71675094448 × 107 6.02604448 × 104 7.6594401336 × 107
, (5–69)
158
while the initial conditions ω0, r0, and h0 are
ω0 =
−9.5380685844896 × 10−6
−1.1363312657036 × 10−3
+5.3472801108427 × 10−6
,
r0 =
2.9963689649816 × 10−3
1.5334477761054 × 10−1
3.8359805613992 × 10−3
,
h0 =
5000
5000
5000
.
(5–70)
A more detailed description of this problem, including all of the constants J, ω0, r0, and
h0, can be found in [64] or [10].
The space station attitude control example was solved with GPOPS-II using the ph−
(4, 10) mesh refinement method with an initial mesh consisting of ten uniformly spaced
mesh intervals and four LGR points per mesh interval. In addition, a finite-difference
perturbation step size of 10−5 was used. Finally, the initial guess was a constant over
the time interval t ∈ [0, 1800], where the constant was (ω0, r0, h0) for the state and zero
for the control. The state and control solutions obtained using GPOPS-II are shown,
respectively, in Fig. 5-12 and 5-13 alongside the solution obtained using the optimal
control software Sparse Optimization Suite (SOS) [60]. It is seen that the GPOPS-II
solution is in close agreement with the SOS solution. It is noted for this example that
the mesh refinement accuracy tolerance of 10−6 was satisfied on the second mesh (that
is, one mesh refinement iteration was performed) using a total of 46 collocation (LGR)
points (that is, 47 total points when including the final time point).
159
SOSGPOPS-II
t (s)
ω1(t)×10−4
-8
-6
-4
-2
0
0
2
500 1500
6
4
1000 2000
A ω1(t) vs. t.
SOSGPOPS-II
t (s)
ω2(t)×10−4
-11.6
-11.5
-11.4
-11.3
-11.2
-11.1
-11
-10.9
0 500 15001000 2000
B ω2(t) vs. t.
SOSGPOPS-II
t (s)
ω3(t)×10−4
-3
-2
-1
0
0
1
2
3
5
500 1500
4
1000 2000
C ω3(t) vs. t.
SOSGPOPS-II
t (s)
r 1(t)
0
0 500 15001000 2000
0.035
-0.05
0.05
0.1
0.15
D r1(t) vs. t.
SOSGPOPS-II
t (s)
r 2(t)
0 500 15000.144
0.146
0.148
0.152
0.154
0.156
0.158
1000 2000
0.15
E r2(t) vs. t.
SOSGPOPS-II
t (s)
r 3(t)
00 500 15001000 2000
0.005
0.01
0.015
0.02
0.025
0.03
0.035
0.04
F r3(t) vs. t.
SOSGPOPS-II
t (s)
h1(t)
-5
-10
0
0
5
500 1500
10
1000 2000
G h1(t) vs. t.
SOSGPOPS-II
t (s)
h2(t)
-4
-2
0
0
2
500 1500
6
8
4
1000 2000
H h2(t) vs. t.
SOSGPOPS-II
t (s)
h3(t)
-6
-4
-2
0
0
2
500 1500
6
4
1000 2000
I h3(t) vs. t.
Figure 5-12. State solution to space station attitude control problem using GPOPS-IIwith the NLP solver IPOPT and a mesh refinement tolerance of 10−6
alongside solution obtained using optimal control software SparseOptimization Suite.
5.4.4 Kinetic Batch Reactor
Consider the following three-phase kinetic batch reactor optimal control problem
that originally appears in the work of [65] and later appears in [10]. Minimize the cost
functional
J = γ1t(3)f + γ2p (5–71)
160
SOSGPOPS-II
t (s)
u1(t)
-150
-100
-50
0
0
50
100
500 15001000 2000
A u1(t) vs. t.
SOSGPOPS-II
t (s)
u2(t)
-5
-15
-10
0
0
5
15
20
25
500 1500
10
1000 2000
B u2(t) vs. t.
SOSGPOPS-II
t (s)
u3(t) -10
-20
-30
-40
-50
0
0
20
500 1500
10
1000 2000
C u3(t) vs. t.
Figure 5-13. Control solution to space station attitude control problem using GPOPS-IIwith the NLP solver IPOPT and a mesh refinement tolerance of 10−6
alongside solution obtained using optimal control software SparseOptimization Suite.
subject to the dynamic constraints
(5–72)
y(k)1 = −k2y (k)2 u(k)2 ,
y(k)2 = −k1y (k)2 y (k)6 + k−1u(k)4 − k2y (k)2 u(k)4 ,
y(k)3 = k2y
(k)2 u
(k)2 + k3y
(k)4 y
(k)6 − k−3u(k)3 ,
y(k)4 = −k3y (k)4 y (k)6 + k−3u(k)3 ,
y(k)5 = k1y
(k)2 y
(k)6 − k−1u(k)4 ,
y(k)6 = −k1y (k)2 y (k)6 + k−1u(k)4 − k3y (k)4 y (k)6 + k−3u(k)3 ,
, (k = 1, 2, 3), (5–73)
161
the equality path constraints
p − y (k)6 + 10−u(k)1 − u(k)2 − u(k)3 − u(k)4 = 0,
u(k)2 − K2y (k)1 /(K2 + 10
−u(k)1 ) = 0,
u(k)3 − K3y (k)3 /(K3 + 10
−u(k)1 ) = 0,
u(k)4 − K4y5/(K1 + 10−u
(k)1 ) = 0,
, (k = 1, 2, 3), (5–74)
the control inequality path constraint
293.15 ≤ u(k)5 ≤ 393.15, (k = 1, 2, 3), (5–75)
the inequality path constraint in phases 1 and 2
y(k)4 ≤ a
[
t(k)]2, (k = 1, 2), (5–76)
the interior point constraints
t(1)f = 0.01,
t(2)f = t
(3)f /4,
y(k)i = y
(k+1)i , (i = 1, ... , 6, k = 1, 2, 3),
(5–77)
and the boundary conditions
y(1)1 (0) = 1.5776, y
(1)2 (0) = 8.32, y
(1)3 (0) = 0,
y(1)4 (0) = 0, y
(1)5 (0) = 0, y
(1)6 (0)− p = 0,
y(3)4 (t
(3)f ) ≤ 1,
(5–78)
162
where
k1 = k1 exp(−β1/u(k)5 ),
k−1 = k−1 exp(−β−1/u(k)5 ),
k2 = k2 exp(−β2/u(k)5 ),
k3 = k1,
k−3 =12k−1,
, (k = 1, 2, 3), (5–79)
and the values for the parameters kj , βj , and Kj are given as
k1 = 1.3708 × 1012 , β1 = 9.2984 × 103 , K1 = 2.575× 10−16,
k−1 = 1.6215 × 1020 , β−1 = 1.3108 × 104 , K2 = 4.876× 10−14,
k2 = 5.2282 × 1012 , β2 = 9.599× 103 , K3 = 1.7884 × 10−16.
(5–80)
The kinetic batch reactor optimal control problem was solved using GPOPS-II
using the ph − (3, 6) mesh refinement method with an initial mesh in each phase
consisting of ten uniformly spaced mesh intervals with three LGR points per mesh
interval. In addition, a base derivative perturbation step size of 10−5 was used. Finally, a
straight line initial guess was used in phase 1 while a constant initial guess was used in
phases 2 and 3. The state and control solutions obtained using GPOPS-II are shown in
Figs. 5-14–5-17, respectively, alongside the solution obtained using the software Sparse
Optimization Suite (SOS) [60]. It is seen that in the complete three-phase problem the
GPOPS-II and SOS solutions have the same trend, the key difference being that the
GPOPS-II solution is shorter in duration than the SOS solution. A closer examination,
however, of the solution in phase 1 reveals that the two solutions are actually quite
different at the start of the problem. The GPOPS-II solution moves away from the initial
condition much more quickly than the SOS solution. Thus, the SOS solution exhibits
stiff behavior at the start of the solution while the GPOPS-II solution does not exhibit
this stiffness. While the solutions are significantly different in phase 1, the optimal cost
obtained using GPOPS-II is 3.1650187 while the optimal cost obtained using SOS
163
is 3.1646696, leading to absolute and relative differences of only 3.4910 × 10−4 and
1.1031×10−4, respectively. Thus, while the solutions obtained by each software program
differ in the first (transient) phase, the overall performance of GPOPS-II is similar to that
obtained using SOS (particularly given the computational challenge of this example).
164
SOS (Phase 1)
SOS (Phase 2)
SOS (Phase 3)
GPOPS-II (Phase 1)
GPOPS-II (Phase 2)
GPOPS-II (Phase 3)
t (hr)
y1(t)
00
1
1 2
0.2
0.4
0.5
0.6
1.2
1.4
1.5
1.6
1.8
A y1(t) vs. t.
SOS (Phase 1)
SOS (Phase 2)
SOS (Phase 3)
GPOPS-II (Phase 1)
GPOPS-II (Phase 2)
GPOPS-II (Phase 3)
t (hr)
y2(t)
0 1 2
6
7
8
0.5 1.55.5
6.5
7.5
8.5
B y2(t) vs. t.
0.3
SOS (Phase 1)
SOS (Phase 2)
SOS (Phase 3)
GPOPS-II (Phase 1)
GPOPS-II (Phase 2)
GPOPS-II (Phase 3)
t (hr)
y3(t)
00 1 2
0.2
0.4
0.5
0.5
0.6
0.7
1.5
0.1
C y3(t) vs. t.
SOS (Phase 1)
SOS (Phase 2)
SOS (Phase 3)
GPOPS-II (Phase 1)
GPOPS-II (Phase 2)
GPOPS-II (Phase 3)
t (hr)
y4(t)
0
0
1
1 2-0.2
0.2
0.4
0.5
0.6
1.2
1.5
1.8
D y4(t) vs. t.
SOS (Phase 1)
SOS (Phase 2)
SOS (Phase 3)
GPOPS-II (Phase 1)
GPOPS-II (Phase 2)
GPOPS-II (Phase 3)
t (hr)
y5(t)
00
1
1 2
0.2
0.4
0.5
0.6
1.2
1.4
1.5
1.8
E y5(t) vs. t.
SOS (Phase 1)
SOS (Phase 2)
SOS (Phase 3)
GPOPS-II (Phase 1)
GPOPS-II (Phase 2)
GPOPS-II (Phase 3)
t (hr)
y6(t)
00 1 20.5 1.5
0.005
0.01
0.015
F y6(t) vs. t.
Figure 5-14. State solution to kinetic batch reactor optimal control problem usingGPOPS-II alongside solution obtained using optimal control softwareSparse Optimization Suite.
165
SOS (Phase 1)
SOS (Phase 2)
SOS (Phase 3)
GPOPS-II (Phase 1)
GPOPS-II (Phase 2)
GPOPS-II (Phase 3)
t (hr)
u1(t)
0 1 2
7
8
9
10
11
0.5 1.56.5
7.5
8.5
9.5
10.5
11.5
A u1(t) vs. t.
SOS (Phase 1)
SOS (Phase 2)
SOS (Phase 3)
GPOPS-II (Phase 1)
GPOPS-II (Phase 2)
GPOPS-II (Phase 3)
t (hr)
u1(t)
0 1 2
7
8
9
10
11
0.5 1.56.5
7.5
8.5
9.5
10.5
11.5
B u1(t) vs. t.
SOS (Phase 1)
SOS (Phase 2)
SOS (Phase 3)
GPOPS-II (Phase 1)
GPOPS-II (Phase 2)
GPOPS-II (Phase 3)
t (hr)
u3(t)
00
1
1 2
0.2
0.4
0.5
0.6
1.2
1.4
1.5
1.6
1.8
C u3(t) vs. t.
SOS (Phase 1)
SOS (Phase 2)
SOS (Phase 3)
GPOPS-II (Phase 1)
GPOPS-II (Phase 2)
GPOPS-II (Phase 3)
t (hr)
u4(t)
00
1
1 2
0.2
0.4
0.5
0.6
1.2
1.4
1.5
1.8
D u4(t) vs. t.
SOS (Phase 1)
SOS (Phase 2)
SOS (Phase 3)
GPOPS-II (Phase 1)
GPOPS-II (Phase 2)
GPOPS-II (Phase 3)
t (hr)
u5(t)
0 1 20.5 1.5280
300
320
340
360
380
400
E u5(t) vs. t.
Figure 5-15. Control solution to kinetic batch reactor optimal control problem usingGPOPS-II alongside solution obtained using optimal control softwareSparse Optimization Suite.
166
SOS (Phase 1)
GPOPS-II (Phase 1)
t (hr)
y1(t)
01.540
1.545
1.550
1.555
1.560
1.565
1.570
1.575
1.580
1.585
0.002 0.004 0.006 0.008 0.01
A y1(t) vs. t.
SOS (Phase 1)
GPOPS-II (Phase 1)
t (hr)
y2(t)
0 0.002 0.004 0.006 0.008 0.018.26
8.27
8.28
8.29
8.30
8.31
8.32
B y2(t) vs. t.
SOS (Phase 1)
GPOPS-II (Phase 1)
t (hr)
y3(t)
00 0.002 0.004
0.005
0.006 0.008
0.01
0.01
0.015
0.02
0.025
0.03
0.035
C y3(t) vs. t.
SOS (Phase 1)
GPOPS-II (Phase 1)
t (hr)
y4(t)×10−4
0
0
1
2
-0.5
0.5
1.5
2.5
0.002 0.004 0.006 0.008 0.01
D y4(t) vs. t.
0.012
0.014
SOS (Phase 1)
GPOPS-II (Phase 1)
t (hr)
y5(t)
00
0.002
0.002
0.004
0.004
0.006
0.006
0.008
0.008
0.01
0.01
E y5(t) vs. t.
SOS (Phase 1)
GPOPS-II (Phase 1)
t (hr)
y6(t)
00 0.002 0.004
0.005
0.006 0.008
0.01
0.01
0.015
F y6(t) vs. t.
Figure 5-16. Phase 1 state solution to kinetic batch reactor optimal control problemusing GPOPS-II alongside solution obtained using optimal control softwareSparse Optimization Suite.
167
SOS (Phase 1)
GPOPS-II (Phase 1)
t (hr)
u1(t)
0
7
8
9
10
11
6.5
7.5
8.5
9.5
10.5
11.5
0.002 0.004 0.006 0.008 0.01
A u1(t) vs. t.
SOS (Phase 1)
GPOPS-II (Phase 1)
t (hr)
u2(t)
00
2
4
6
8
10
12
14
0.002 0.004 0.006 0.008 0.01
B u2(t) vs. t.
SOS (Phase 1)
GPOPS-II (Phase 1)
t (hr)
u3(t)
00 0.002 0.004 0.006 0.008
0.01
0.01
0.02
0.03
0.04
0.06
0.07
0.08
0.09
0.05
0.1
C u3(t) vs. t.
SOS (Phase 1)
GPOPS-II (Phase 1)
t (hr)
u4(t)
00 0.002 0.004 0.006 0.008
0.01
0.01
0.02
0.03
0.04
0.06
0.05
D u4(t) vs. t.
SOS (Phase 1)
GPOPS-II (Phase 1)
t (hr)
u5(t)
0280
300
320
340
360
380
400
0.002 0.004 0.006 0.008 0.01
E u5(t) vs. t.
Figure 5-17. Phase 1 control solution to kinetic batch reactor optimal control problemusing GPOPS-II alongside solution obtained using optimal control softwareSparse Optimization Suite.
168
5.4.5 Multiple-Stage Launch Vehicle Ascent Problem
The problem considered in this section is the ascent of a multiple-stage launch
vehicle. The objective is to maneuver the launch vehicle from the ground to the target
orbit while maximizing the remaining fuel in the upper stage. It is noted that this example
is is found verbatim in [23], [17], and [10]. The problem is modeled using four phases
where the objective is to maximize the mass at the end of the fourth phase, that is
maximize
J = m(t(4)f ) (5–81)
subject to the dynamic constraints
r(p) = v(p),
v(p) = − µ
‖r(p)‖3 r(p) +
T (p)
m(p)u(p) +
D(p)
m(p),
m(p) = −T(p)
g0Isp,
(p = 1, ... , 4), (5–82)
the initial conditions
r(t0) = r0 = (5605.2, 0, 3043.4) × 103 m,
v(t0) = v0 = (0, 0.4076, 0) × 103 m/s,
m(t0) = m0 = 301454 kg.
(5–83)
the interior point constraints
r(p)(t(p)f )− r(p+1)(t
(p+10 ) = 0,
v(p)(t(p)f )− v(p+1)(t
(p+1)0 ) = 0, (p = 1, ... , 3)
m(p)(t(p)f )−m(p)dry −m(p+1)(t(p+1)0 ) = 0,
(5–84)
169
the terminal constraints (corresponding to a geosynchronous transfer orbit),
a(t(4)f ) = af = 24361.14 km , e(t
(4)f ) = ef = 0.7308,
i(t(4)f ) = if = 28.5 deg , θ(t(4)f ) = θf = 269.8 deg,
φ(t(4)f ) = φf = 130.5 deg,
(5–85)
and the path constraints
|r(p)|2 ≥ Re,
‖u(p)‖22 = 1,(p = 1, ... , 4). (5–86)
In each phase r(t) = (x(t), y(t), z(t)) is the position relative to the center of the Earth
expressed in ECI coordinates, v = (vx(t), vy(t), vz(t)) is the inertial velocity expressed
in ECI coordinates, µ is the gravitational parameter, T is the vacuum thrust, m is the
mass, g0 is the acceleration due to gravity at sea level, Isp is the specific impulse of
the engine, u = (ux , uy , uz) is the thrust direction expressed in ECI coordinates, and
D = (Dx ,Dy ,Dz) is the drag force expressed ECI coordinates. The drag force is defined
as
D = −12CDSρ‖vrel‖vrel (5–87)
where CD is the drag coefficient, S is the vehicle reference area, ρ = ρ0 exp(−h/H)
is the atmospheric density, ρ0 is the sea level density, h = r − Re is the altitude,
r = ‖r‖2 =√x2 + y 2 + z2 is the geocentric radius, Re is the equatorial radius of the
Earth, H is the density scale height, and vrel = v − ω × r is the velocity as viewed
by an observer fixed to the Earth expressed in ECI coordinates, and ω = (0, 0,Ω)
is the angular velocity of the Earth as viewed by an observer in the inertial reference
frame expressed in ECI coordinates. Furthermore, mdry is the dry mass of phases 1, 2,
and 3 and is defined mdry = mtot − mprop, where mtot and mprop are, respectively, the
total mass and dry mass of phases 1, 2, and 3. Finally, the quantities a, e, i , θ, and φ
are, respectively, the semi-major axis, eccentricity, inclination, longitude of ascending
170
node, and argument of periapsis, respectively. The vehicle data for this problem and
the he numerical values for the physical constants can be found in Tables 5-3. and 5-4,
respectively.
Table 5-3. Vehicle properties for multiple-stage launch vehicle ascent problem.Quantity Solid Boosters Stage 1 Stage 2mtot (kg) 19290 104380 19300mprop (kg) 17010 95550 16820T (N) 628500 1083100 110094Isp (s) 283.3 301.7 467.2
Number of Engines 9 1 1Burn Time (s) 75.2 261 700
Table 5-4. Constants used in the launch vehicle ascent optimal control problem.Constant Value
Payload Mass 4164 kgS 4π m2
CD 0.5ρ0 1.225 kg/m3
H 7200 mt1 75.2 st2 150.4 st3 261 sRe 6378145 mΩ 7.29211585× 10−5 rad/sµ 3.986012× 1014 m3/s2
g0 9.80665m/s2
The multiple-stage launch vehicle ascent optimal control problem was solved using
GPOPS-II with the NLP solver SNOPT and an initial mesh in each phase consisting of
ten uniformly spaced mesh intervals with four LGR points per mesh interval. The initial
guess of the solution was constructed such that the initial guess of the position and the
velocity in phases 1 and 2 was constant at (r(0), v(0)) as given in Eq. (5–83) while in
phases 3 and 4 the initial guess of the position and velocity was constant at (r, v), where
(r, v) are obtained via a transformation from orbital elements to ECI coordinates using
the five known orbital elements of Eq. (5–85) and a true anomaly of zero. Furthermore,
in all phases the initial guess of the mass was a straight line between the initial and
final mass, m(t(p)0 ) and m(t(p)f ) (p ∈ [1, ... , 4]). Finally, in all phases the guess of the
control was constant at u = (0, 1, 0). The GPOPS-II solution is shown in Fig. 5-18.
171
In this example the mesh refinement accuracy tolerance of 10−6 is satisfied on the
initial mesh and, thus, no mesh refinement is performed. The solution obtained using
GPOPS-II matches closely with the solution obtained using the software SOCS [10],
where it is noted that the optimal objective values obtained using GPOPS-II and SOCS
are −7529.71229 and −7529.712412, respectively.
5.5 Discussion
The five examples provide in Section 5.4 highlight different capabilities of GPOPS-
II. First, it is seen that GPOPS-II is capable of solving a wide range of problems and
the solutions are in excellent agreement with established optimal control software.
Furthermore, it is seen that the mesh refinement methods employed in GPOPS-II
provide accurate solutions while placing mesh points in regions of the interesting
features in the solution. In addition, from the variety of examples studied it is seen
that GPOPS-II has been designed to allow for great flexibility in the formulation of an
optimal control problem. The fact that GPOPS-II is capable of solving the challenging
benchmark optimal control problems shown in this chapter shows the general utility of
the software on problems that may arise in different application areas.
5.6 Limitations of GPOPS-II
Like all software, GPOPS-II has limitations. First, it is assumed in the
implementation that all functions have continuous first and second derivatives. In
some applications, however, the functions themselves may be continuous while the
derivatives may be discontinuous. In such problems GPOPS-II may struggle because
the NLP solver is not being provided with accurate approximations to the derivative
functions. Furthermore, the ability of any given NLP solver to obtain a solution is always
problem dependent. As a result, for some examples it may be the case that IPOPT will
perform better than SNOPT, but in some cases SNOPT it may be the exact opposite
in that SNOPT may significantly outperform IPOPT (the launch vehicle ascent problem
is an example where SNOPT outperforms IPOPT with GPOPS-II). Also, problems
172
Phase 1Phase 2Phase 3Phase 4
t (s)
h(t)
(km
)
50
100
150
00
200
200
250
400 600 800 1000
A h(t) vs. t.
Phase 1Phase 2Phase 3Phase 4
t (s)
v(t)
(m/s
)
00 200 400 600 800 1000
2000
4000
6000
8000
10000
12000
B v(t) vs. t.
Phase 1Phase 2Phase 3Phase 4
t (s)
m(t)×1000
(kg)
50
100
150
00
200
200
250
300
350
400 600 800 1000
C m(t) vs. t.
Phase 1Phase 2Phase 3Phase 4
t (s)
u1(t)
-0.8
-0.6
-0.4
-0.2
0.2
0.4
0.6
0.8
0
0
1
200 400 600 800 1000
D u1(t) vs. t.
Phase 1Phase 2Phase 3Phase 4
t (s)
u2(t)
0.4
0.5
0.6
0.7
0.8
0.9
0
1
200 400 600 800 1000
E u2(t) vs. t.
Phase 1Phase 2Phase 3Phase 4
t (s)
u3(t)
-0.4
-0.3
-0.2
-0.1
0.1
0.2
0.3
0.4
0.5
0
0 200 400 600 800 1000
F u3(t) vs. t.
Figure 5-18. Solution of multiple-stage launch vehicle ascent problem using GPOPS-II.
with high-index path constraints may result in the constraint qualification conditions
not being satisfied on fine meshes. In such cases, unique NLP Lagrange multipliers
may not exist. In some cases, these Lagrange multipliers may become unbounded.
Finally, as is true for many optimal control software programs, applications whose
173
solutions lie on a singular arc can create problems due to the inability to determine the
optimal control along the singular arc. In such cases highly inaccurate solution may be
obtained in the region near the singular arc, and mesh refinement may only exacerbate
these inaccuracies. The approach for problems whose solutions lie on a singular arc
is to modify the problem by including the conditions that define the singular arc (thus
removing the singularity).
5.7 Conclusions
A general-purpose MATLAB software program called GPOPS-II has been described
for solving multiple-phase optimal control problems using variable-order orthogonal
collocation methods. In particular, the software employs the Legendre-Gauss-Radau
orthogonal collocation method, where the continuous-time control problem is transcribed
to a large sparse nonlinear programming problem. The software implements two
previously developed adaptive mesh refinement methods that allow for flexibility in the
number and placement of the collocation and mesh points in order to achieve a specified
accuracy. In addition, the software is designed to compute all derivatives required by
the NLP solver using sparse finite-differencing of the optimal control functions. The key
components of the software have been described in detail and the utility of the software
is demonstrated on five benchmark optimal control problems. The software described in
this chapter provides researchers a useful platform upon which to solve a wide variety of
complex constrained optimal control problems.
174
REFERENCES
[1] Kirk, D. E., Optimal Control Theory: An Introduction, Dover Publications, Mineola,New York, 2004.
[2] Pontryagin, L. S., Mathematical Theory of Optimal Processes, John Wiley & Sons,New York, 1962.
[3] von Stryk, O. and Bulirsch, R., “Direct and Indirect Methods for TrajectoryOptimization,” Annals of Operations Research, Vol. 37, 1992, pp. 357–373.
[4] Betts, J. T., “Survey of Numerical Methods for Trajectory Optimization,” Journal ofGuidnance, Control, and Dynamics, Vol. 21, No. 2, March–April 1998, pp. 193–207.
[5] Babuska, I. and Rheinboldt, W. C., “A Survey of a Posteriori Error Estimators andAdaptive Approaches in the Finite Element Method,” Proc. of the China-FranceSymp. on Finite Element Methods (Beijing, 1982), Science Press, 1983, pp. 1–56.
[6] Babuska, I., Zienkiewicz, O. C., Gago, J., and de A. Oliveira, E. R., AccuracyEstimates and Adaptive Refinements in Finite Element Computations, John Wiley &Sons, Chichester, 1986.
[7] Babuska, I. and Rheinboldt, W. C., “Computational Error Estimates and AdaptiveProcesses for Some nonlinear Structural Problems,” Computer Methods in AppliedMechanics and Engineering, Vol. 34, No. 1–3, 1982, pp. 895–937.
[8] Babuska, I. and Rheinboldt, W. C., “Reliable Error Estimation and Mesh Adaptationfor the Finite Element Method,” Proc. Second Intl. Conf. Computational Methods inNonlinear Mechanics (Univ. Texas Austin), North-Holland, Amsterdam-New York,1979, pp. 67–108.
[9] Babuska, I. and Rheinboldt, W. C., “A Posteriori Error Analysis of Finite ElementSolutions for One-Dimensional Problems,” SIAM Journal on Numerical Analysis,Vol. 18, 1981, pp. 565–589.
[10] Betts, J. T., Practical Methods for Optimal Control and Estimation Using NonlinearProgramming, SIAM Press, Philadelphia, 2010.
[11] Jain, D. and Tsiotras, P., “Trajectory Optimization Using Multiresolution Techniques,”Journal of Guidance, Control, and Dynamics, Vol. 31, No. 5, September-October2008, pp. 1424–1436.
[12] Zhao, Y. J., “Optimal Pattern of Glider Dynamic Soaring,” Optimal Control Applica-tions and Methods, Vol. 25, 2004, pp. 67–89.
[13] Elnagar, G., Kazemi, M., and Razzaghi, M., “The Pseudospectral Legendre Methodfor Discretizing Optimal Control Problems,” IEEE Transactions on AutomaticControl , Vol. 40, No. 10, 1995, pp. 1793–1796.
175
[14] Elnagar, G. and Razzaghi, M., “A Collocation-Type Method for Linear QuadraticOptimal Control Problems,” Optimal Control Applications and Methods, Vol. 18,No. 3, 1998, pp. 227–235.
[15] Benson, D. A., Huntington, G. T., Thorvaldsen, T. P., and Rao, A. V., “DirectTrajectory Optimization and Costate Estimation via an Orthogonal CollocationMethod,” Journal of Guidance, Control, and Dynamics, Vol. 29, No. 6,November-December 2006, pp. 1435–1440.
[16] Huntington, G. T., Advancement and Analysis of a Gauss Pseudospectral Tran-scription for Optimal Control , Ph.D. thesis, Massachusetts Institute of Technology,Cambridge, Massachusetts, 2007.
[17] Rao, A. V., Benson, D. A., Christopher Darby, M. A. P., Francolin, C., Sanders, I.,and Huntington, G. T., “Algorithm 902: GPOPS, A MATLAB Software for SolvingMultiple-Phase Optimal Control Problems Using the Gauss PseudospectralMethod,” ACM Transactions on Mathematical Software, Vol. 37, No. 2, April–June2010, pp. 22:1–22:39.
[18] Garg, D., Patterson, M., Hager, W. W., Rao, A. V., Benson, D. A., and Huntington,G. T., “A Unified Framework for the Numerical Solution of Optimal Control ProblemsUsing Pseudospectral Methods,” Automatica, Vol. 46, No. 11, November 2010,pp. 1843–1851.
[19] Garg, D., Hager, W. W., and Rao, A. V., “Pseudospectral Methods for SolvingInfinite-Horizon Optimal Control Problems,” Automatica, Vol. 47, No. 4, April 2011,pp. 829–837.
[20] Garg, D., Patterson, M., Francolin, C., Darby, C., Huntington, G., Hager, W. W., andRao, A. V., “Direct Trajectory Optimization and Costate Estimation of Finite-horizonand Infinite-Horizon Optimal Control Problems using a Radau PseudospectralMethod,” Computational Optimization and Applications, Vol. 49, No. 2, June 2011,pp. 335–358.
[21] Darby, C. L., Hager, W. W., and Rao, A. V., “Direct Trajectory Optimization Using aVariable Low-Order Adaptive Pseudospectral Method,” Journal of Spacecraft andRockets, Vol. 48, No. 3, May–June 2011, pp. 433–445.
[22] Darby, C. L., Hager, W. W., and Rao, A. V., “An hp-Adaptive Pseudospectral Methodfor Solving Optimal Control Problems,” Optimal Control Applications and Methods,Vol. 32, No. 4, July–August 2011, pp. 476–502.
[23] Benson, D. A., A Gauss Pseudospectral Transcription for Optimal Control , Ph.D.thesis, Department of Aeronautics and Astronautics, Massachusetts Institute ofTechnology, Cambridge, Massachusetts, 2004.
176
[24] Huntington, G. T., Benson, D. A., and Rao, A. V., “Optimal Configuration ofTetrahedral Spacecraft Formations,” The Journal of the Astronautical Sciences,Vol. 55, No. 2, April-June 2007, pp. 141–169.
[25] Huntington, G. T. and Rao, A. V., “Optimal Reconfiguration of SpacecraftFormations Using the Gauss Pseudospectral Method,” Journal of Guidance,Control, and Dynamics, Vol. 31, No. 3, May-June 2008, pp. 689–698.
[26] Gong, Q., Ross, I. M., Kang, W., and Fahroo, F., “Connections Between theCovector Mapping Theorem and Convergence of Pseudospectral Methods,”Computational Optimization and Applications, Vol. 41, No. 3, December 2008,pp. 307–335.
[27] Kameswaran, S. and Biegler, L. T., “Convergence Rates for Direct Transcriptionof Optimal Control Problems Using Collocation at Radau Points,” ComputationalOptimization and Applications, Vol. 41, No. 1, 2008, pp. 81–126.
[28] Darby, C. L., Garg, D., and Rao, A. V., “Costate Estimation Using Multiple-IntervalPseudospectral Methods,” Journal of Spacecraft and Rockets, Vol. 48, No. 5,September-October 2011, pp. 856–866.
[29] Patterson, M. A. and Rao, A. V., “Exploiting Sparsity in Direct CollocationPseudospectral Methods for Solving Optimal Control Problems,” Journal of Space-craft and Rockets, Vol. 49, No. 2, March–April 2012, pp. 364–377.
[30] Canuto, C., Hussaini, M. Y., Quarteroni, A., and Zang, T. A., Spectral Methods inFluid Dynamics, Spinger-Verlag, Heidelberg, Germany, 1988.
[31] Fornberg, B., A Practical Guide to Pseudospectral Methods, Cambridge UniversityPress, 1998.
[32] Trefethen, L. N., Spectral Methods Using MATLAB, SIAM Press, Philadelphia,2000.
[33] Broyden, C. G., “The Convergence of a Class of Double-Rank MinimizationAlgorithms,” Journal of the Institute of Mathematics and Its Applications, Vol. 6,No. 1, 1970, pp. 76–90.
[34] Fletcher, R., “A New Approach to Variable Metric Algorithms,” Computer Journal ,Vol. 13, No. 3, 1970, pp. 317–322.
[35] Goldfarb, D., “A Family of Variable Metric Updates Derived by Variational Means,”Mathematics of Computation, Vol. 24, No. 3, 1970, pp. 23–26.
[36] Shanno, D. F., “Conditioning of Quasi-Newton Methods for Function Minimization,”Mathematics of Computation, Vol. 24, 1970, pp. 647–656.
[37] Davidon, W. C., “Variable metric method for minimization,” SIAM Journal onOptimization, Vol. 1, No. 1, 1991, pp. 1–17.
177
[38] Fletcher, R., Practical Methods of Optimization, John Wiley and Sons, New York,1985.
[39] Fletcher, R. and Powell, M. J. D., “A Rapidly Convergent Descent Method forMinimization,” Computer Journal , Vol. 6, No. 2, 1963, pp. 163–168.
[40] Gill, P. E., Murray, W., Saunders, M. A., and Wright, M. H., User’s Guide for NPSOL(Version 4.0): A FORTRAN Package for Nonlinear Programming, Department ofOperations Research, Stanford University, January 1986.
[41] Gill, P. E., Murray, W., and Saunders, M. A., “SNOPT: An SQP Algorithm forLarge-Scale Constrained Optimization,” SIAM Review , Vol. 47, No. 1, January2002, pp. 99–131.
[42] Gill, P. E., Murray, W., and Saunders, M. A., User’s Guide for SNOPT Version 7:Software for Large Scale Nonlinear Programming, February 2006.
[43] Biegler, L. T. and Zavala, V. M., “Large-Scale Nonlinear Programming Using IPOPT:An Integrating Framework for Enterprise-Wide Optimization,” Computers andChemical Engineering, Vol. 33, No. 3, March 2008, pp. 575–582.
[44] Byrd, R. H., Nocedal, J., and Waltz, R. A., “KNITRO: An Integrated Package forNonlinear Optimization,” Large Scale Nonlinear Optimization, Springer Verlag,2006, pp. 35–59.
[45] Betts, J. T. and Huffman, W. P., “Exploiting Sparsity in the Direct TranscriptionMethod for Optimal Control,” Computational Optimization and Applications, Vol. 14,1999, pp. 179–201, 10.1023/A:1008739131724.
[46] Gong, Q., Fahroo, F., and Ross, I. M., “Spectral Algorithm for PseudospectralMethods in Optimal Control,” Journal of Guidance, Control and Dynamics, Vol. 31,No. 3, May–June 2008, pp. 460–471.
[47] Zhao, Y. and Tsiotras, P., “Density Functions for Mesh Refinement in NumericalOptimal Control,” Journal of Guidance, Control, and Dynamics, Vol. 34, No. 1,January–February 2011, pp. 271–277.
[48] Bryson, A. E. and Ho, Y.-C., Applied Optimal Control , Hemisphere Publishing, NewYork, 1975.
[49] Lewis, F. L. and Syrmos, V. L., Optimal Control , John Wiley and Sons, New York,2nd ed., 1995.
[50] Patterson, M. A. and Rao, A. V., “Exploiting Sparsity of Pseudospectral ImplicitIntegral Schemes for Solving Optimal Control Problems,” 2013 AIAA Guidance,Navigation, and Control Conference, Boston, Massachusetts, Submitted forPublication, 19-22 August 2013.
178
[51] Abramowitz, M. and Stegun, I., Handbook of Mathematical Functions with Formu-las, Graphs, and Mathematical Tables, Dover Publications, New York, 1965.
[52] Rump, S. M., “INTLAB – INTerval LABoratory,” Developments in Reliable Com-puting, edited by T. Csendes, Kluwer Academic Publishers, Dordrecht, 1999, pp.77–104.
[53] Duff, I. S., “MA57—a Code for the Solution of Sparse Symmetric Definite andIndefinite Systems,” ACM Transactions on Mathematical Software, Vol. 30, No. 2,2004, pp. 118–144.
[54] Hou, H., Hager, W. W., and Rao, A. V., “Convergence of a Gauss PseudospectralTranscription for Optimal Control,” 2012 AIAA Guidance, Navigation, and ControlConference, AIAA Paper 2012-4452, Minneapolis, MN, August 13-16 2012.
[55] Press, W. H., Teukolsky, S. A., Vetterling, W. T., and Flannery, B. P., NumericalRecipes: The Art of Scientific Computing, Cambridge University Press, Cambridge,UK, 3rd ed., 2007.
[56] Rao, A. V. and Mease, K. D., “Eigenvector Approximate Dichotomic Basis Methodfor solving Hyper-Sensitive optimal Control Problems,” Optimal Control Applicationsand Methods, Vol. 21, No. 1, January–February 2000, pp. 1–19.
[57] Ledzewicz, U. and Schattler, H., “Analysis of Optimal Controls for a MathematicalModel of Tumour Anti-Angiogenesis,” Optimal Control Applications and Methods,Vol. 29, No. 1, January–February 2008, pp. 41–57.
[58] Biegler, L. T., Ghattas, O., Heinkenschloss, M., and van Bloemen Waanders,B., editors, Large-Scale PDE Constrained Optimization, Lecture Notes inComputational Science and Engineering, Vol. 30, Springer-Verlag, Berlin, 2003.
[59] Multifrontal Massively Parallel Solver (MUMPS 4.10.0) User’s Guide, May 2011.
[60] Betts, J. T. and Gablonsky, J. M., “A Comparison of Interior Point and SQPMethods on Optimal Control Problems,” Tech. Rep. M&CT-TECH-02-004, BoeingMathematics and Computing Technology, Seattle, Washington, March 2002.
[61] Betts, J. T., “Sparse Jacobian Updates in the Collocation Method for OptimalControl Problems,” Journal of Guidance, Control, and Dynamics, Vol. 13, No. 3,May–June 1990, pp. 409–415.
[62] Gill, P. E., Murray, W., and Wright, M. H., Practical Optimization, Academic Press,London, 1981.
[63] Rao, A. V., Patterson, M. A., and Hager, W. W., “A ph Collocation Scheme forOptimal Control,” Automatica, January 2013, pp. Submitted for Publication.
179
[64] Pietz, J. A., Pseudospectral Collocation Methods for the Direct Transcription ofOptimal Control Problems, Master’s thesis, Rice University, Houston, Texas, April2003.
[65] Leineweber, D. B., Efficient Reduced SQP Methods for the Optimization of Chem-ical Processes Described by Large Space DAE Models, Ph.D. thesis, UniversitatHeidelberg, Interdisziplinares Zentrum fur Wissenschaftliches Rechnen (IWR),1998.
180
BIOGRAPHICAL SKETCH
Michael Patterson was born in Westminster, Maryland. He grew up in the Florida
Keys and graduated Coral Shores High School in Tavernier, Florida. He earned
his Bachelor of Science degree in mechanical engineering in 2006 from Florida
International University, his Master of Science degree in mechanical engineering in
2010 from the University of Florida, and his Ph.D. from the University of Florida in 2013.
181