- 3.0.2 optimal control module.
ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR > Class Template Referenceabstract

Base class for the constraints used in this toolbox. More...

#include <ConstraintBase.h>

Inheritance diagram for ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >:
ct::optcon::BoxConstraintBase< CONTROL_DIM, STATE_DIM, CONTROL_DIM, SCALAR > ct::optcon::BoxConstraintBase< STATE_DIM, STATE_DIM, CONTROL_DIM, SCALAR > ct::optcon::BoxConstraintBase< DERIVED_DIM, STATE_DIM, CONTROL_DIM, SCALAR > ct::optcon::example::ConstraintTerm1D< STATE_DIM, CONTROL_DIM, SCALAR > ct::optcon::example::ConstraintTerm2D< STATE_DIM, CONTROL_DIM, SCALAR > ct::optcon::example::PureStateConstraint_Example< STATE_DIM, CONTROL_DIM, SCALAR > ct::optcon::example::StateInputConstraint_Example< STATE_DIM, CONTROL_DIM, SCALAR > ct::optcon::ObstacleConstraint< STATE_DIM, CONTROL_DIM, SCALAR > ct::optcon::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >

Public Types

typedef core::StateVector< STATE_DIM, SCALARstate_vector_t
 
typedef core::ControlVector< CONTROL_DIM, SCALARcontrol_vector_t
 
typedef Eigen::Matrix< SCALAR, Eigen::Dynamic, 1 > VectorXs
 
typedef Eigen::Matrix< SCALAR, Eigen::Dynamic, Eigen::Dynamic > MatrixXs
 

Public Member Functions

 ConstraintBase (std::string name="Unnamed")
 Custom constructor. More...
 
 ConstraintBase (const ConstraintBase &arg)
 Copy constructor. More...
 
virtual ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR > * clone () const =0
 Creates a new instance of the object with same properties than original. More...
 
virtual ~ConstraintBase ()
 Destructor. More...
 
virtual VectorXs evaluate (const state_vector_t &x, const control_vector_t &u, const SCALAR t)=0
 The evaluation of the constraint violation. Note this method is SCALAR typed. More...
 
virtual size_t getConstraintSize () const =0
 The evaluate method used for jit compilation in constraint container ad. More...
 
virtual MatrixXs jacobianState (const state_vector_t &x, const control_vector_t &u, const SCALAR t)
 Returns the constraint jacobian wrt state. More...
 
virtual MatrixXs jacobianInput (const state_vector_t &x, const control_vector_t &u, const SCALAR t)
 Returns the constraint jacobian wrt input. More...
 
virtual VectorXs getLowerBound () const
 Returns the lower constraint bound. More...
 
virtual VectorXs getUpperBound () const
 Returns the upper constraint bound. More...
 
void getName (std::string &constraintName) const
 Returns the constraint name. More...
 
void setName (const std::string constraintName)
 Sets the constraint name. More...
 
virtual size_t getNumNonZerosJacobianState () const
 Returns the number of nonzeros in the jacobian wrt state. The default implementation assumes a dense matrix with only nonzero elements. More...
 
virtual size_t getNumNonZerosJacobianInput () const
 Returns the number of nonzeros in the jacobian wrt control input. The default implementation assumes a dense matrix with only nonzero elements. More...
 
virtual VectorXs jacobianStateSparse (const state_vector_t &x, const control_vector_t &u, const SCALAR t)
 Returns the constraint jacobian wrt state in sparse structure. The default implementation maps the JacobianState matrix to a vector. More...
 
virtual VectorXs jacobianInputSparse (const state_vector_t &x, const control_vector_t &u, const SCALAR t)
 Returns the constraint jacobian wrt control input in sparse structure. The default implementation maps the JacobianState matrix to a vector. More...
 
virtual void sparsityPatternState (Eigen::VectorXi &rows, Eigen::VectorXi &cols)
 Generates the sparsity pattern of the jacobian wrt state. The default implementation returns a vector of ones corresponding to the dense jacobianState. More...
 
virtual void sparsityPatternInput (Eigen::VectorXi &rows, Eigen::VectorXi &cols)
 Generates the sparsity pattern of the jacobian wrt control input. The default implementation returns a vector of ones corresponding to the dense jacobianInput. More...
 

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef ct::core::tpl::TraitSelector< SCALAR >::Trait Trait
 

Static Protected Member Functions

static void genDiagonalIndices (const size_t num_elements, Eigen::VectorXi &iRow_vec, Eigen::VectorXi &jCol_vec)
 upper bound on the constraints More...
 
static void genSparseDiagonalIndices (const Eigen::VectorXi &diag_sparsity, Eigen::VectorXi &iRow_vec, Eigen::VectorXi &jCol_vec)
 Generates indices of a sparse diagonal square matrix. More...
 
static void genBlockIndices (const size_t num_rows, const size_t num_cols, Eigen::VectorXi &iRow_vec, Eigen::VectorXi &jCol_vec)
 Generates indices of a full matrix. More...
 

Protected Attributes

VectorXs lb_
 
VectorXs ub_
 lower bound on the constraints More...
 

Detailed Description

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
class ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >

Base class for the constraints used in this toolbox.

Template Parameters
STATE_DIMThe state dimension
CONTROL_DIMThe control dimension
SCALARThe Scalar type
Examples:
ConstraintComparison.h, ConstraintTest.h, and NLOC_generalConstrained.cpp.

Member Typedef Documentation

◆ state_vector_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
typedef core::StateVector<STATE_DIM, SCALAR> ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::state_vector_t

◆ control_vector_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
typedef core::ControlVector<CONTROL_DIM, SCALAR> ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::control_vector_t

◆ VectorXs

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
typedef Eigen::Matrix<SCALAR, Eigen::Dynamic, 1> ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::VectorXs

◆ MatrixXs

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
typedef Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::MatrixXs

Constructor & Destructor Documentation

◆ ConstraintBase() [1/2]

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::ConstraintBase ( std::string  name = "Unnamed")

Custom constructor.

Parameters
[in]nameThe name of the constraint

◆ ConstraintBase() [2/2]

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::ConstraintBase ( const ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR > &  arg)

Copy constructor.

Parameters
[in]argThe object to be copied

◆ ~ConstraintBase()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::~ConstraintBase ( )
virtual

Destructor.

Member Function Documentation

◆ clone()

◆ evaluate()

◆ getConstraintSize()

◆ jacobianState()

◆ jacobianInput()

◆ getLowerBound()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::VectorXs ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::getLowerBound ( ) const
virtual

Returns the lower constraint bound.

Returns
The lower constraint bound

◆ getUpperBound()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::VectorXs ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::getUpperBound ( ) const
virtual

Returns the upper constraint bound.

Returns
The upper constraint bound

◆ getName()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
void ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::getName ( std::string &  constraintName) const

Returns the constraint name.

Parameters
[out]constraintNameThe constraint name

◆ setName()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
void ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::setName ( const std::string  constraintName)

Sets the constraint name.

Parameters
[in]constraintNameThe constraint name

◆ getNumNonZerosJacobianState()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
size_t ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::getNumNonZerosJacobianState ( ) const
virtual

◆ getNumNonZerosJacobianInput()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
size_t ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::getNumNonZerosJacobianInput ( ) const
virtual

◆ jacobianStateSparse()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::VectorXs ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::jacobianStateSparse ( const state_vector_t x,
const control_vector_t u,
const SCALAR  t 
)
virtual

◆ jacobianInputSparse()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::VectorXs ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::jacobianInputSparse ( const state_vector_t x,
const control_vector_t u,
const SCALAR  t 
)
virtual

◆ sparsityPatternState()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
void ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::sparsityPatternState ( Eigen::VectorXi &  rows,
Eigen::VectorXi &  cols 
)
virtual

Generates the sparsity pattern of the jacobian wrt state. The default implementation returns a vector of ones corresponding to the dense jacobianState.

Parameters
rowsThe vector of the row indices containing non zero elements in the constraint jacobian
colsThe vector of the column indices containing non zero elements in the constraint jacobian

◆ sparsityPatternInput()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
void ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::sparsityPatternInput ( Eigen::VectorXi &  rows,
Eigen::VectorXi &  cols 
)
virtual

Generates the sparsity pattern of the jacobian wrt control input. The default implementation returns a vector of ones corresponding to the dense jacobianInput.

Parameters
rowsThe vector of the row indices containing non zero elements in the constraint jacobian
colsThe vector of the column indices containing non zero elements in the constraint jacobian

◆ genDiagonalIndices()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
void ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::genDiagonalIndices ( const size_t  num_elements,
Eigen::VectorXi &  iRow_vec,
Eigen::VectorXi &  jCol_vec 
)
staticprotected

upper bound on the constraints

Generates indices of a diagonal square matrix

Parameters
[in]num_elementsThe number of elements
[out]iRow_vecThe row vector
[out]jCol_vecThe column vector

Referenced by ct::optcon::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::sparsityPatternState().

◆ genSparseDiagonalIndices()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
void ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::genSparseDiagonalIndices ( const Eigen::VectorXi &  diag_sparsity,
Eigen::VectorXi &  iRow_vec,
Eigen::VectorXi &  jCol_vec 
)
staticprotected

Generates indices of a sparse diagonal square matrix.

Parameters
[in]diag_sparsitySparsity pattern for the diagonal (Example: [0 1 0 0 1 1])
[out]iRow_vecThe row vector
[out]jCol_vecThe column vector

◆ genBlockIndices()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
void ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::genBlockIndices ( const size_t  num_rows,
const size_t  num_cols,
Eigen::VectorXi &  iRow_vec,
Eigen::VectorXi &  jCol_vec 
)
staticprotected

Generates indices of a full matrix.

Parameters
[in]num_rowsThe number of rows of the matrix
[in]num_colsThe number columns of the matrix
[out]iRow_vecThe row vector
[out]jCol_vecThe col vector

Member Data Documentation

◆ Trait

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef ct::core::tpl::TraitSelector<SCALAR>::Trait ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::Trait

◆ lb_

◆ ub_


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