- 3.0.2 optimal control module.
ExampleConstraints< SCALAR > Class Template Referencefinal

This class sets up the constraints and its first order derivatives described previously. More...

Inheritance diagram for ExampleConstraints< SCALAR >:
ct::optcon::tpl::DiscreteConstraintBase< SCALAR > ct::optcon::tpl::DiscreteConstraintBase< SCALAR >

Public Types

using VectorXs = Eigen::Matrix< SCALAR, Eigen::Dynamic, 1 >
 
using VectorXs = Eigen::Matrix< SCALAR, Eigen::Dynamic, 1 >
 
- Public Types inherited from ct::optcon::tpl::DiscreteConstraintBase< SCALAR >
using VectorXs = Eigen::Matrix< SCALAR, Eigen::Dynamic, 1 >
 

Public Member Functions

 ExampleConstraints (std::shared_ptr< tpl::OptVector< SCALAR >> optVector)
 
 ~ExampleConstraints () override=default
 
VectorXs getLowerBound () override
 Returns the lower bound of the constraint. More...
 
VectorXs getUpperBound () override
 Returns the upper bound of the constraint. More...
 
VectorXs eval () override
 Evaluates the constraint violation. More...
 
VectorXs evalSparseJacobian () override
 Returns the non zero elements of the eval method with respect to the optimization variables. More...
 
size_t getConstraintSize () override
 Returns size of the constraint vector. More...
 
size_t getNumNonZerosJacobian () override
 Returns the number of non zero elements of the jacobian. More...
 
void genSparsityPattern (Eigen::VectorXi &iRow_vec, Eigen::VectorXi &jCol_vec) override
 Returns the sparsity structure of the constraint jacobian. More...
 
void sparseHessianValues (const Eigen::VectorXd &optVec, const Eigen::VectorXd &lambda, Eigen::VectorXd &sparseHes) override
 Returns the non zero elements (values) of the Hessian matrix of this constraint. More...
 
void genSparsityPatternHessian (Eigen::VectorXi &iRow_vec, Eigen::VectorXi &jCol_vec) override
 Returns the sparsity structure of the constraint hessian. More...
 
 ExampleConstraints (std::shared_ptr< tpl::OptVector< SCALAR >> optVector)
 
 ~ExampleConstraints () override=default
 
VectorXs getLowerBound () override
 Returns the lower bound of the constraint. More...
 
VectorXs getUpperBound () override
 Returns the upper bound of the constraint. More...
 
VectorXs eval () override
 Evaluates the constraint violation. More...
 
size_t getConstraintSize () override
 Returns size of the constraint vector. More...
 
size_t getNumNonZerosJacobian () override
 Returns the number of non zero elements of the jacobian. More...
 
void genSparsityPattern (Eigen::VectorXi &iRow_vec, Eigen::VectorXi &jCol_vec) override
 Returns the sparsity structure of the constraint jacobian. More...
 
VectorXs evalSparseJacobian () override
 Returns the non zero elements of the eval method with respect to the optimization variables. More...
 
void genSparsityPatternHessian (Eigen::VectorXi &iRow_vec, Eigen::VectorXi &jCol_vec) override
 
void sparseHessianValues (const Eigen::VectorXd &optVec, const Eigen::VectorXd &lambda, Eigen::VectorXd &sparseHes) override
 
- Public Member Functions inherited from ct::optcon::tpl::DiscreteConstraintBase< SCALAR >
 DiscreteConstraintBase ()=default
 Default constructor. More...
 
virtual ~DiscreteConstraintBase ()=default
 Destructor. More...
 
Eigen::VectorXi & iRowHessian ()
 
Eigen::VectorXi & jColHessian ()
 

Static Public Attributes

static const size_t dimConstraints = 2
 
static const size_t nnzJac = 6
 
static const size_t nnzHes = 3
 

Additional Inherited Members

- Protected Member Functions inherited from ct::optcon::tpl::DiscreteConstraintBase< SCALAR >
size_t genDiagonalIndices (const size_t col_start, const size_t num_elements, Eigen::VectorXi &iRow_vec, Eigen::VectorXi &jCol_vec, const size_t indexNumber)
 This method generates Row and Column vectors which indicate the sparsity pattern of the constraint jacobian for a quadratic matrix block containing diagonal entries only. More...
 
size_t genBlockIndices (const size_t col_start, const size_t num_rows, const size_t num_cols, Eigen::VectorXi &iRow_vec, Eigen::VectorXi &jCol_vec, const size_t indexNumber)
 This method generates Row and Column vectors which indicate the sparsity pattern of the constraint jacobian for an arbitrary dense matrix block. More...
 
- Protected Attributes inherited from ct::optcon::tpl::DiscreteConstraintBase< SCALAR >
Eigen::VectorXi iRowHessian_
 
Eigen::VectorXi jColHessian_
 

Detailed Description

template<typename SCALAR>
class ExampleConstraints< SCALAR >

This class sets up the constraints and its first order derivatives described previously.

Template Parameters
SCALARScalar type

Member Typedef Documentation

◆ VectorXs [1/2]

template<typename SCALAR >
using ExampleConstraints< SCALAR >::VectorXs = Eigen::Matrix<SCALAR, Eigen::Dynamic, 1>

◆ VectorXs [2/2]

template<typename SCALAR >
using ExampleConstraints< SCALAR >::VectorXs = Eigen::Matrix<SCALAR, Eigen::Dynamic, 1>

Constructor & Destructor Documentation

◆ ExampleConstraints() [1/2]

template<typename SCALAR >
ExampleConstraints< SCALAR >::ExampleConstraints ( std::shared_ptr< tpl::OptVector< SCALAR >>  optVector)
inline

◆ ~ExampleConstraints() [1/2]

template<typename SCALAR >
ExampleConstraints< SCALAR >::~ExampleConstraints ( )
overridedefault

◆ ExampleConstraints() [2/2]

template<typename SCALAR >
ExampleConstraints< SCALAR >::ExampleConstraints ( std::shared_ptr< tpl::OptVector< SCALAR >>  optVector)
inline

◆ ~ExampleConstraints() [2/2]

template<typename SCALAR >
ExampleConstraints< SCALAR >::~ExampleConstraints ( )
overridedefault

Member Function Documentation

◆ getLowerBound() [1/2]

template<typename SCALAR >
VectorXs ExampleConstraints< SCALAR >::getLowerBound ( )
inlineoverridevirtual

Returns the lower bound of the constraint.

Returns
The lower constraint bound

Implements ct::optcon::tpl::DiscreteConstraintBase< SCALAR >.

◆ getUpperBound() [1/2]

template<typename SCALAR >
VectorXs ExampleConstraints< SCALAR >::getUpperBound ( )
inlineoverridevirtual

Returns the upper bound of the constraint.

Returns
The upper constraint bound

Implements ct::optcon::tpl::DiscreteConstraintBase< SCALAR >.

◆ eval() [1/2]

template<typename SCALAR >
VectorXs ExampleConstraints< SCALAR >::eval ( )
inlineoverridevirtual

Evaluates the constraint violation.

Returns
A vector of the evaluated constraint violation

Implements ct::optcon::tpl::DiscreteConstraintBase< SCALAR >.

◆ evalSparseJacobian() [1/2]

template<typename SCALAR >
VectorXs ExampleConstraints< SCALAR >::evalSparseJacobian ( )
inlineoverridevirtual

Returns the non zero elements of the eval method with respect to the optimization variables.

Returns
A vector of the non zero elements of the constraint jacobian

Implements ct::optcon::tpl::DiscreteConstraintBase< SCALAR >.

◆ getConstraintSize() [1/2]

template<typename SCALAR >
size_t ExampleConstraints< SCALAR >::getConstraintSize ( )
inlineoverridevirtual

Returns size of the constraint vector.

Returns
The size of the constraint vector (should be equal to the size of the return value of the eval method)

Implements ct::optcon::tpl::DiscreteConstraintBase< SCALAR >.

◆ getNumNonZerosJacobian() [1/2]

template<typename SCALAR >
size_t ExampleConstraints< SCALAR >::getNumNonZerosJacobian ( )
inlineoverridevirtual

Returns the number of non zero elements of the jacobian.

Returns
The number of non zero elements of the jacobian (which should be equal to the return value of evalSparseJacobian)

Implements ct::optcon::tpl::DiscreteConstraintBase< SCALAR >.

◆ genSparsityPattern() [1/2]

template<typename SCALAR >
void ExampleConstraints< SCALAR >::genSparsityPattern ( Eigen::VectorXi &  iRow_vec,
Eigen::VectorXi &  jCol_vec 
)
inlineoverridevirtual

Returns the sparsity structure of the constraint jacobian.

Parameters
[out]iRow_vecA vector containing the row indices of the non zero elements of the constraint jacobian
[out]jCol_vecA vector containing the column indices of the non zero elements of the constraint jacobian

Implements ct::optcon::tpl::DiscreteConstraintBase< SCALAR >.

◆ sparseHessianValues() [1/2]

template<typename SCALAR >
void ExampleConstraints< SCALAR >::sparseHessianValues ( const Eigen::VectorXd &  optVec,
const Eigen::VectorXd &  lambda,
Eigen::VectorXd &  sparseHes 
)
inlineoverridevirtual

Returns the non zero elements (values) of the Hessian matrix of this constraint.

Parameters
[in]optVecA vector holding the current optimization variable vector
[in]lambdaA vector holding the current constraint multipliers (one scalar for each row of constraints)
[out]sparseHesThe sparse hessian values

Reimplemented from ct::optcon::tpl::DiscreteConstraintBase< SCALAR >.

◆ genSparsityPatternHessian() [1/2]

template<typename SCALAR >
void ExampleConstraints< SCALAR >::genSparsityPatternHessian ( Eigen::VectorXi &  iRow_vec,
Eigen::VectorXi &  jCol_vec 
)
inlineoverridevirtual

Returns the sparsity structure of the constraint hessian.

Parameters
[out]iRow_vecA vector containing the row indices of the non zero elements of the constraint hessian
[out]jCol_vecA vector containing the column indices of the non zero elements of the constraint hessian

Reimplemented from ct::optcon::tpl::DiscreteConstraintBase< SCALAR >.

◆ getLowerBound() [2/2]

template<typename SCALAR >
VectorXs ExampleConstraints< SCALAR >::getLowerBound ( )
inlineoverridevirtual

Returns the lower bound of the constraint.

Returns
The lower constraint bound

Implements ct::optcon::tpl::DiscreteConstraintBase< SCALAR >.

◆ getUpperBound() [2/2]

template<typename SCALAR >
VectorXs ExampleConstraints< SCALAR >::getUpperBound ( )
inlineoverridevirtual

Returns the upper bound of the constraint.

Returns
The upper constraint bound

Implements ct::optcon::tpl::DiscreteConstraintBase< SCALAR >.

◆ eval() [2/2]

template<typename SCALAR >
VectorXs ExampleConstraints< SCALAR >::eval ( )
inlineoverridevirtual

Evaluates the constraint violation.

Returns
A vector of the evaluated constraint violation

Implements ct::optcon::tpl::DiscreteConstraintBase< SCALAR >.

◆ getConstraintSize() [2/2]

template<typename SCALAR >
size_t ExampleConstraints< SCALAR >::getConstraintSize ( )
inlineoverridevirtual

Returns size of the constraint vector.

Returns
The size of the constraint vector (should be equal to the size of the return value of the eval method)

Implements ct::optcon::tpl::DiscreteConstraintBase< SCALAR >.

◆ getNumNonZerosJacobian() [2/2]

template<typename SCALAR >
size_t ExampleConstraints< SCALAR >::getNumNonZerosJacobian ( )
inlineoverridevirtual

Returns the number of non zero elements of the jacobian.

Returns
The number of non zero elements of the jacobian (which should be equal to the return value of evalSparseJacobian)

Implements ct::optcon::tpl::DiscreteConstraintBase< SCALAR >.

◆ genSparsityPattern() [2/2]

template<typename SCALAR >
void ExampleConstraints< SCALAR >::genSparsityPattern ( Eigen::VectorXi &  iRow_vec,
Eigen::VectorXi &  jCol_vec 
)
inlineoverridevirtual

Returns the sparsity structure of the constraint jacobian.

Parameters
[out]iRow_vecA vector containing the row indices of the non zero elements of the constraint jacobian
[out]jCol_vecA vector containing the column indices of the non zero elements of the constraint jacobian

Implements ct::optcon::tpl::DiscreteConstraintBase< SCALAR >.

◆ evalSparseJacobian() [2/2]

template<typename SCALAR >
VectorXs ExampleConstraints< SCALAR >::evalSparseJacobian ( )
inlineoverridevirtual

Returns the non zero elements of the eval method with respect to the optimization variables.

Returns
A vector of the non zero elements of the constraint jacobian

Implements ct::optcon::tpl::DiscreteConstraintBase< SCALAR >.

◆ genSparsityPatternHessian() [2/2]

template<typename SCALAR >
void ExampleConstraints< SCALAR >::genSparsityPatternHessian ( Eigen::VectorXi &  iRow_vec,
Eigen::VectorXi &  jCol_vec 
)
inlineoverridevirtual

generate block-diagonal sparsity pattern for Hessian

Note
this function implementation is only required for the exact-Hessian solver case

Reimplemented from ct::optcon::tpl::DiscreteConstraintBase< SCALAR >.

◆ sparseHessianValues() [2/2]

template<typename SCALAR >
void ExampleConstraints< SCALAR >::sparseHessianValues ( const Eigen::VectorXd &  optVec,
const Eigen::VectorXd &  lambda,
Eigen::VectorXd &  sparseHes 
)
inlineoverridevirtual
Note
this function implementation is only required for the exact-Hessian solver case

Reimplemented from ct::optcon::tpl::DiscreteConstraintBase< SCALAR >.

Member Data Documentation

◆ dimConstraints

template<typename SCALAR >
const size_t ExampleConstraints< SCALAR >::dimConstraints = 2
static

◆ nnzJac

template<typename SCALAR >
const size_t ExampleConstraints< SCALAR >::nnzJac = 6
static

◆ nnzHes

template<typename SCALAR >
const size_t ExampleConstraints< SCALAR >::nnzHes = 3
static

The documentation for this class was generated from the following files: