autogenu-jupyter
An automatic code generator and the continuation/GMRES (C/GMRES) based numerical solvers for nonlinear MPC
|
Zero-horizon OCP solver to initialize the solution of the MPC solvers. More...
#include <zero_horizon_ocp_solver.hpp>
Public Types | |
using | ZeroHorizonNLP_ = detail::ZeroHorizonNLP< OCP > |
using | NewtonGMRES_ = detail::NewtonGMRES< ZeroHorizonNLP_ > |
using | MatrixFreeGMRES_ = detail::MatrixFreeGMRES< NewtonGMRES_, kmax > |
Public Member Functions | |
ZeroHorizonOCPSolver (const OCP &ocp, const SolverSettings &settings) | |
Constructs the zero-horizon OCP solver. More... | |
ZeroHorizonOCPSolver ()=default | |
Default constructor. More... | |
~ZeroHorizonOCPSolver ()=default | |
Default destructor. More... | |
template<typename VectorType > | |
void | set_u (const VectorType &u) |
Sets the control input vector. More... | |
template<typename VectorType > | |
void | set_uc (const VectorType &uc) |
Sets the control input vector and Lagrange multiplier with respect to the equality constraints. More... | |
template<typename VectorType > | |
void | set_dummy (const MatrixBase< VectorType > &dummy) |
Sets the dummy input vector with respect to the control input bounds constraint. More... | |
template<typename VectorType > | |
void | set_mu (const MatrixBase< VectorType > &mu) |
Sets the Lagrange multiplier with respect to the control input bounds constraint. More... | |
void | init_dummy_mu () |
Initializes the dummy input vectors and Lagrange multipliers with respect to the control input bounds constraint. More... | |
const Vector< nu > & | uopt () const |
Getter of the optimal solution. More... | |
const Vector< nuc > & | ucopt () const |
Getter of the optimal solution. More... | |
const Vector< nub > & | dummyopt () const |
Getter of the optimal solution. More... | |
const Vector< nub > & | muopt () const |
Getter of the optimal solution. More... | |
const Vector< nx > & | lmdopt () const |
Getter of the optimal solution. More... | |
Scalar | optError () const |
Gets the l2-norm of the current optimality errors. More... | |
template<typename VectorType > | |
Scalar | optError (const Scalar t, const MatrixBase< VectorType > &x) |
Computes and gets the l2-norm of the current optimality errors. More... | |
template<typename VectorType > | |
void | solve (const Scalar t, const MatrixBase< VectorType > &x) |
Solves the zero-horizon optimal control problem by Newton-GMRES method. More... | |
TimingProfile | getProfile () const |
Get timing result as TimingProfile. More... | |
void | disp (std::ostream &os) const |
Static Public Attributes | |
static constexpr int | nx = OCP::nx |
Dimension of the state. More... | |
static constexpr int | nu = OCP::nu |
Dimension of the control input. More... | |
static constexpr int | nc = OCP::nc |
Dimension of the equality constraints. More... | |
static constexpr int | nuc = nu + nc |
Dimension of the concatenation of the control input and equality constraints. More... | |
static constexpr int | nub = OCP::nub |
Dimension of the bound constraints on the control input. More... | |
static constexpr int | dim = nuc + 2 * nub |
Dimension of the linear problem solved by the GMRES solver. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const ZeroHorizonOCPSolver &solver) |
Zero-horizon OCP solver to initialize the solution of the MPC solvers.
OCP | A definition of the optimal control problem (OCP). |
kmax | Maximum number of the GMRES iterations. Must be positive. |
using cgmres::ZeroHorizonOCPSolver< OCP, kmax >::MatrixFreeGMRES_ = detail::MatrixFreeGMRES<NewtonGMRES_, kmax> |
using cgmres::ZeroHorizonOCPSolver< OCP, kmax >::NewtonGMRES_ = detail::NewtonGMRES<ZeroHorizonNLP_> |
using cgmres::ZeroHorizonOCPSolver< OCP, kmax >::ZeroHorizonNLP_ = detail::ZeroHorizonNLP<OCP> |
|
inline |
Constructs the zero-horizon OCP solver.
[in] | ocp | A definition of the optimal control problem (OCP). |
[in] | settings | Solver settings. |
|
default |
Default constructor.
|
default |
Default destructor.
|
inline |
|
inline |
Getter of the optimal solution.
|
inline |
Get timing result as TimingProfile.
|
inline |
Initializes the dummy input vectors and Lagrange multipliers with respect to the control input bounds constraint.
|
inline |
Getter of the optimal solution.
|
inline |
Getter of the optimal solution.
|
inline |
Gets the l2-norm of the current optimality errors.
|
inline |
Computes and gets the l2-norm of the current optimality errors.
[in] | t | Time. |
[in] | x | State. Size must be ZeroHorizonOCPSolver::nx. |
|
inline |
Sets the dummy input vector with respect to the control input bounds constraint.
[in] | dummy | The dummy input vector. Size must be ZeroHorizonOCPSolver::nub. |
|
inline |
Sets the Lagrange multiplier with respect to the control input bounds constraint.
[in] | mu | The Lagrange multiplier. Size must be ZeroHorizonOCPSolver::nub. |
|
inline |
Sets the control input vector.
[in] | u | The control input vector. Size must be ZeroHorizonOCPSolver::nu. |
|
inline |
Sets the control input vector and Lagrange multiplier with respect to the equality constraints.
[in] | uc | Concatenatin of the control input vector and Lagrange multiplier with respect to the equality constraints. Size must be ZeroHorizonOCPSolver::nuc. |
|
inline |
Solves the zero-horizon optimal control problem by Newton-GMRES method.
[in] | t | Time. |
[in] | x | State. Size must be ZeroHorizonOCPSolver::nx. |
|
inline |
Getter of the optimal solution.
|
inline |
Getter of the optimal solution.
|
friend |
|
staticconstexpr |
Dimension of the linear problem solved by the GMRES solver.
|
staticconstexpr |
Dimension of the equality constraints.
|
staticconstexpr |
Dimension of the control input.
|
staticconstexpr |
Dimension of the bound constraints on the control input.
|
staticconstexpr |
Dimension of the concatenation of the control input and equality constraints.
|
staticconstexpr |
Dimension of the state.