# GPOPS-II

GPOPS-II (pronounced "GPOPS 2") is a general-purpose MATLAB software for solving continuous optimal control problems using hp-adaptive Gaussian quadrature collocation and sparse nonlinear programming. The acronym GPOPS stands for "General Purpose OPtimal Control Software", and the Roman numeral "II" refers to the fact that GPOPS-II is the second software of its type (that employs Gaussian quadrature integration).

## Problem Formulation

GPOPS-II is designed to solve multiple-phase optimal control problems of the following mathematical form (where $P$ is the number of phases):
          $\min J=\phi (\mathbf {e} ^{(1)},\ldots ,\mathbf {e} ^{(P)})$
    subject to the dynamic constraints
          ${\dot {\mathbf {y} }}^{(p)}(t)=\mathbf {a} ^{(p)}(\mathbf {y} ^{(p)}(t),\mathbf {u} ^{(p)}(t),t,\mathbf {s} ),\quad (p=1,\ldots ,P),$
    the event constraints
          $\mathbf {b} _{\min }\leq \mathbf {b} (\mathbf {e} ^{(1)},\ldots ,\mathbf {e} ^{(P)},\mathbf {s} )\leq \mathbf {b} _{\max },$
    the inequality path constraints
          $\mathbf {c} _{\min }^{(p)}\leq \mathbf {c} (\mathbf {y} ^{(p)}(t),\mathbf {u} ^{(p)}(t),t,\mathbf {s} )\leq \mathbf {c} _{\max }^{(p)},\quad (p=1,\ldots ,P),$
    the static parameter constraints
          $\mathbf {s} _{\min }\leq \mathbf {s} \leq \mathbf {s} _{\max },$
    and the integral constraints
          $\mathbf {q} _{\min }^{(p)}\leq \mathbf {q} ^{(p)}\leq \mathbf {q} _{\max }^{(p)},\quad (p=1,\ldots ,P),$
    where
          $\mathbf {e} ^{(p)}=\left[\mathbf {y} ^{(p)}(t_{0}^{(p)}),t_{0}^{(p)},\mathbf {y} ^{(p)}(t_{f}^{(p)}),t_{f}^{(p)},\mathbf {q} ^{(p)}\right],\quad (p=1,\ldots ,P),$
    and the integrals in each phase are defined as
          $q_{i}^{(p)}=\int _{t_{0}^{(p)}}^{t_{f}^{(p)}}g_{i}^{(p)}(\mathbf {y} ^{(p)}(t),\mathbf {u} ^{(p)}(t),t,\mathbf {s} )dt,\quad (i=1,\ldots ,n_{q}^{(p)},\;p=1,\ldots ,P).$
It is important to note that the event constraints 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.

## Method Employed by GPOPS-II

GPOPS-II uses a class of methods referred to as $hp$-adaptive Gaussian quadrature collocation where the collocation points are the nodes of a Gauss quadrature (in this case, the Legendre-Gauss-Radau [LGR] points). The mesh consists of intervals into which the total time interval $t^{(p)}\in [t_{0}^{(p)},t_{f}^{(p)}]$ in each phase is divided, and LGR collocation is performed in each interval. Because the mesh can be adapted such that both the degree of the polynomial used to approximate the state $\mathbf {y} ^{(p)}(t)$ and the width of each mesh interval can be different from interval to interval, the method is referred to as an $hp$-adaptive method (where "$h$" refers to the width of each mesh interval, while "$p$" refers to the polynomial degree in each mesh interval). The LGR collocation method has been developed rigorously in Refs., while $hp$-adaptive mesh refinement methods based on the LGR collocation method can be found in Refs., .

## Development

The development of GPOPS-II began in 2007. The code development name for the software was OptimalPrime, but was changed to GPOPS-II in late 2012 in order to keep with the lineage of the original version of GPOPS which implemented global collocation using the Gauss pseudospectral method. The development of GPOPS-II continues today, with improvements that include the open-source algorithmic differentiation package ADiGator and continued development of $hp$-adaptive mesh refinement methods for optimal control.

## Applications of GPOPS-II

GPOPS-II has been used extensively throughout the world both in academia and industry. Published academic research where GPOPS-II has been used includes Refs. where the software has been used in applications such as performance optimization of Formula One race cars, Ref. where the software has been used for minimum-time optimization of low-thrust orbital transfers, Ref. where the software has been used for human performance in cycling, Ref. where the software has been used for soft lunar landing, and Ref. where the software has been used to optimize the motion of a bipedal robot.