- 3.0.2 optimal control module.
|
An abstract base class which serves as a container for all the discrete constraints used in the NLP. More...
#include <DiscreteConstraintContainerBase.h>
Public Types | |
using | VectorXs = Eigen::Matrix< SCALAR, Eigen::Dynamic, 1 > |
using | VectorXi = Eigen::Matrix< int, Eigen::Dynamic, 1 > |
using | MapVecXs = Eigen::Map< VectorXs > |
using | MapVecXi = Eigen::Map< VectorXi > |
Public Member Functions | |
DiscreteConstraintContainerBase ()=default | |
Default constructor. More... | |
virtual | ~DiscreteConstraintContainerBase ()=default |
Destructor. More... | |
virtual void | prepareEvaluation ()=0 |
Gets called before the constraint evaluation. This method should contain all the calculations needed to evaluate the constraints. More... | |
virtual void | prepareJacobianEvaluation ()=0 |
Gets called before the constraint jacobian evaluation. This method should contain all the calculations needed to evaluate the constraint jacobian. More... | |
void | evalConstraints (MapVecXs &c_nlp) |
Writes the constraint evaluations into the large constraint optimization vector. More... | |
void | evalConstraints (VectorXs &c_nlp) |
void | evalSparseJacobian (MapVecXs &jac_nlp, const int nzz_jac_g) |
Evaluates the jacobian of the constraints and writes them into the nlp vector. More... | |
void | getSparsityPattern (Eigen::Map< Eigen::VectorXi > &iRow_nlp, Eigen::Map< Eigen::VectorXi > &jCol_nlp, const int nnz_jac_g) |
Retrieves the sparsity pattern of the constraint Jacobian and writes them into the nlp vectors. More... | |
size_t | getConstraintsCount () const |
Returns the number of constraints in the NLP. More... | |
size_t | getNonZerosJacobianCount () const |
Returns the number of non zeros in the constraint jacobian. More... | |
void | getSparsityPatternHessian (Eigen::VectorXi &iRow, Eigen::VectorXi &jCol, size_t numOptVar) |
creates the combined hessian sparsity pattern from a number of constraint terms More... | |
Eigen::VectorXd | sparseHessianValues (const Eigen::VectorXd &optVec, const Eigen::VectorXd &lambda) |
Evaluates the constraint Hessian. More... | |
void | getBounds (MapVecXs &lowerBound, MapVecXs &upperBound) |
Retrieves the constraint bounds and writes them into the vectors used in the NLP. More... | |
Protected Attributes | |
std::vector< std::shared_ptr< DiscreteConstraintBase< SCALAR > > > | constraints_ |
Container which holds all the constraints of the NLP. More... | |
std::vector< int > | iRowHessianStdVec_ |
std::vector< int > | jColHessianStdVec_ |
An abstract base class which serves as a container for all the discrete constraints used in the NLP.
using ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::VectorXs = Eigen::Matrix<SCALAR, Eigen::Dynamic, 1> |
using ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::VectorXi = Eigen::Matrix<int, Eigen::Dynamic, 1> |
using ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::MapVecXs = Eigen::Map<VectorXs> |
using ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::MapVecXi = Eigen::Map<VectorXi> |
|
default |
Default constructor.
|
virtualdefault |
Destructor.
|
pure virtual |
Gets called before the constraint evaluation. This method should contain all the calculations needed to evaluate the constraints.
Implemented in ExampleConstraintsContainer< SCALAR >, ExampleConstraintsContainer< SCALAR >, and ct::optcon::ConstraintsContainerDms< STATE_DIM, CONTROL_DIM, SCALAR >.
Referenced by ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::evalConstraints().
|
pure virtual |
Gets called before the constraint jacobian evaluation. This method should contain all the calculations needed to evaluate the constraint jacobian.
Implemented in ExampleConstraintsContainer< SCALAR >, ExampleConstraintsContainer< SCALAR >, and ct::optcon::ConstraintsContainerDms< STATE_DIM, CONTROL_DIM, SCALAR >.
Referenced by ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::evalSparseJacobian().
|
inline |
Writes the constraint evaluations into the large constraint optimization vector.
[out] | c_nlp | The constraint vector used in the NLP |
References ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::constraints_, and ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::prepareEvaluation().
|
inline |
|
inline |
Evaluates the jacobian of the constraints and writes them into the nlp vector.
[out] | jac_nlp | The constraint jacobian vector used in NLP |
[in] | nzz_jac_g | The number of non zero elements in the jacobian |
References ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::constraints_, and ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::prepareJacobianEvaluation().
|
inline |
Retrieves the sparsity pattern of the constraint Jacobian and writes them into the nlp vectors.
[out] | iRow_nlp | The vector containing the row indices of the non zero entries of the constraint jacobian |
[out] | jCol_nlp | The vector containing the column indices of the non zero entries of the constraint jacobian |
[in] | nnz_jac_g | The number of non zero elements in the constraint jacobian |
References ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::constraints_.
|
inline |
Returns the number of constraints in the NLP.
References ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::constraints_.
|
inline |
Returns the number of non zeros in the constraint jacobian.
References ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::constraints_.
|
inline |
creates the combined hessian sparsity pattern from a number of constraint terms
References ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::constraints_, i, ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::iRowHessianStdVec_, and ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::jColHessianStdVec_.
|
inline |
Evaluates the constraint Hessian.
[in] | optVec | The optimization variables |
[in] | lambda | multipliers for Hessian matrix |
[out] | hes | The cost Hessian matrix coefficients |
References ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::constraints_, i, and ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::jColHessianStdVec_.
|
inline |
Retrieves the constraint bounds and writes them into the vectors used in the NLP.
[out] | lowerBound | The lower constraint bound |
[out] | upperBound | The lower constraint bound |
References ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::constraints_.
|
protected |
Container which holds all the constraints of the NLP.
Referenced by ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::evalConstraints(), ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::evalSparseJacobian(), ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::getBounds(), ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::getConstraintsCount(), ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::getNonZerosJacobianCount(), ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::getSparsityPattern(), ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::getSparsityPatternHessian(), and ct::optcon::tpl::DiscreteConstraintContainerBase< SCALAR >::sparseHessianValues().
|
protected |
|
protected |