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

Class for terminal constraint. More...

#include <TerminalConstraint.h>

Inheritance diagram for ct::optcon::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >:
ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >

Public Types

typedef ConstraintBase< STATE_DIM, CONTROL_DIM, SCALARBase
 
typedef core::StateVector< STATE_DIM, SCALARstate_vector_t
 
typedef core::ControlVector< CONTROL_DIM, SCALARcontrol_vector_t
 
typedef Eigen::Matrix< int, Eigen::Dynamic, 1 > VectorXi
 
typedef Eigen::Matrix< SCALAR, Eigen::Dynamic, 1 > VectorXs
 
typedef Eigen::Matrix< SCALAR, Eigen::Dynamic, Eigen::Dynamic > MatrixXs
 
- Public Types inherited from ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >
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

 TerminalConstraint (const core::StateVector< STATE_DIM, SCALAR > xf)
 Custom constructor. More...
 
virtual TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR > * clone () const override
 Creates a new instance of the object with same properties than original. More...
 
 TerminalConstraint (const TerminalConstraint &arg)
 
virtual ~TerminalConstraint ()
 
virtual size_t getConstraintSize () const override
 The evaluate method used for jit compilation in constraint container ad. More...
 
virtual VectorXs evaluate (const state_vector_t &x, const control_vector_t &u, const SCALAR t) override
 The evaluation of the constraint violation. Note this method is SCALAR typed. More...
 
virtual MatrixXs jacobianState (const state_vector_t &x, const control_vector_t &u, const SCALAR t) override
 Returns the constraint jacobian wrt state. More...
 
virtual MatrixXs jacobianInput (const state_vector_t &x, const control_vector_t &u, const SCALAR t) override
 Returns the constraint jacobian wrt input. More...
 
virtual size_t getNumNonZerosJacobianState () const override
 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 override
 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) override
 Returns the constraint jacobian wrt state in sparse structure. The default implementation maps the JacobianState matrix to a vector. More...
 
virtual void sparsityPatternState (VectorXi &rows, VectorXi &cols) override
 
- Public Member Functions inherited from ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >
 ConstraintBase (std::string name="Unnamed")
 Custom constructor. More...
 
 ConstraintBase (const ConstraintBase &arg)
 Copy constructor. More...
 
virtual ~ConstraintBase ()
 Destructor. 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 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
 
- Public Attributes inherited from ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef ct::core::tpl::TraitSelector< SCALAR >::Trait Trait
 

Additional Inherited Members

- Static Protected Member Functions inherited from ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >
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 inherited from ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >
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::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >

Class for terminal constraint.

Template Parameters
STATE_DIMThe state dimension
CONTROL_DIMThe control dimension
SCALARThe Scalar type
Examples:
DMS.cpp.

Member Typedef Documentation

◆ Base

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
typedef ConstraintBase<STATE_DIM, CONTROL_DIM, SCALAR> ct::optcon::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::Base

◆ state_vector_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
typedef core::StateVector<STATE_DIM, SCALAR> ct::optcon::TerminalConstraint< 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::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::control_vector_t

◆ VectorXi

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
typedef Eigen::Matrix<int, Eigen::Dynamic, 1> ct::optcon::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::VectorXi

◆ VectorXs

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
typedef Eigen::Matrix<SCALAR, Eigen::Dynamic, 1> ct::optcon::TerminalConstraint< 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::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::MatrixXs

Constructor & Destructor Documentation

◆ TerminalConstraint() [1/2]

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
ct::optcon::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::TerminalConstraint ( const core::StateVector< STATE_DIM, SCALAR xf)

Custom constructor.

Parameters
[in]xfThe desired terminal state

◆ TerminalConstraint() [2/2]

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

◆ ~TerminalConstraint()

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

Member Function Documentation

◆ clone()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR > * ct::optcon::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::clone ( ) const
overridevirtual

Creates a new instance of the object with same properties than original.

Returns
Copy of this object.

Implements ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >.

◆ getConstraintSize()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
size_t ct::optcon::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::getConstraintSize ( ) const
overridevirtual

The evaluate method used for jit compilation in constraint container ad.

Parameters
[in]xThe state vector
[in]uThe control vector
[in]tThe time
Returns
The constraint violation Returns the number of constraints
The number of constraints

Implements ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >.

◆ evaluate()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::VectorXs ct::optcon::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::evaluate ( const state_vector_t x,
const control_vector_t u,
const SCALAR  t 
)
overridevirtual

The evaluation of the constraint violation. Note this method is SCALAR typed.

Parameters
[in]xThe state vector
[in]uThe control vector
[in]tThe time
Returns
The constraint violation

Implements ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >.

References t, u, and x.

◆ jacobianState()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::MatrixXs ct::optcon::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::jacobianState ( const state_vector_t x,
const control_vector_t u,
const SCALAR  t 
)
overridevirtual

Returns the constraint jacobian wrt state.

Returns
The constraint jacobian

Reimplemented from ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >.

◆ jacobianInput()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::MatrixXs ct::optcon::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::jacobianInput ( const state_vector_t x,
const control_vector_t u,
const SCALAR  t 
)
overridevirtual

Returns the constraint jacobian wrt input.

Returns
The constraint jacobian

Reimplemented from ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >.

◆ getNumNonZerosJacobianState()

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

Returns the number of nonzeros in the jacobian wrt state. The default implementation assumes a dense matrix with only nonzero elements.

Returns
The number of non zeros

Reimplemented from ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >.

◆ getNumNonZerosJacobianInput()

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

Returns the number of nonzeros in the jacobian wrt control input. The default implementation assumes a dense matrix with only nonzero elements.

Returns
The number of non zeros

Reimplemented from ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >.

◆ jacobianStateSparse()

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

Returns the constraint jacobian wrt state in sparse structure. The default implementation maps the JacobianState matrix to a vector.

Returns
The sparse constraint jacobian

Reimplemented from ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >.

◆ sparsityPatternState()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
void ct::optcon::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::sparsityPatternState ( VectorXi rows,
VectorXi cols 
)
overridevirtual

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::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::Trait

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