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

Class for control input box constraint term. More...

#include <ControlInputConstraint.h>

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

Public Types

using Trait = typename ct::core::tpl::TraitSelector< SCALAR >::Trait
 
using Base = BoxConstraintBase< CONTROL_DIM, STATE_DIM, CONTROL_DIM, SCALAR >
 
using state_vector_t = core::StateVector< STATE_DIM, SCALAR >
 
using control_vector_t = core::ControlVector< CONTROL_DIM, SCALAR >
 
using VectorXi = Eigen::Matrix< int, Eigen::Dynamic, 1 >
 
using VectorXs = Eigen::Matrix< SCALAR, Eigen::Dynamic, 1 >
 
using MatrixXs = Eigen::Matrix< SCALAR, Eigen::Dynamic, Eigen::Dynamic >
 
using sparsity_matrix_t = Eigen::Matrix< SCALAR, Eigen::Dynamic, CONTROL_DIM >
 
- Public Types inherited from ct::optcon::BoxConstraintBase< CONTROL_DIM, STATE_DIM, CONTROL_DIM, SCALAR >
using Trait = typename ct::core::tpl::TraitSelector< SCALAR >::Trait
 
using Base = ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >
 
using state_vector_t = core::StateVector< STATE_DIM, SCALAR >
 
using control_vector_t = core::ControlVector< CONTROL_DIM, SCALAR >
 
using decision_vector_t = core::StateVector< DERIVED_DIM, SCALAR >
 
using VectorXi = Eigen::Matrix< int, Eigen::Dynamic, 1 >
 
using VectorXs = Eigen::Matrix< SCALAR, Eigen::Dynamic, 1 >
 
using MatrixXs = Eigen::Matrix< SCALAR, Eigen::Dynamic, Eigen::Dynamic >
 
using sparsity_matrix_t = Eigen::Matrix< SCALAR, Eigen::Dynamic, DERIVED_DIM >
 
- 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

 ControlInputConstraint (const control_vector_t &uLow, const control_vector_t &uHigh)
 Constructor taking lower and upper state bounds directly. Assumes state box constraint is dense. More...
 
 ControlInputConstraint (const VectorXs &lb, const VectorXs &ub, const Eigen::VectorXi &control_sparsity)
 Constructor for sparse control input box constraint. Takes bounds and sparsity pattern. More...
 
 ControlInputConstraint (const ControlInputConstraint &arg)
 
virtual ~ControlInputConstraint ()
 
virtual ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR > * clone () const override
 Creates a new instance of the object with same properties than original. 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 VectorXs jacobianInputSparse (const state_vector_t &x, const control_vector_t &u, const SCALAR t) override
 Returns the constraint jacobian wrt control input in sparse structure. The default implementation maps the JacobianState matrix to a vector. More...
 
virtual void sparsityPatternState (VectorXi &rows, VectorXi &cols) override
 
virtual void sparsityPatternInput (VectorXi &rows, VectorXi &cols) override
 
- Public Member Functions inherited from ct::optcon::BoxConstraintBase< CONTROL_DIM, STATE_DIM, CONTROL_DIM, SCALAR >
 BoxConstraintBase (const decision_vector_t &vLow, const decision_vector_t &vHigh)
 Constructor taking lower and upper state bounds directly. Assumes the box constraint is dense. More...
 
 BoxConstraintBase (const VectorXs &lb, const VectorXs &ub, const Eigen::VectorXi &sparsity_vec)
 Constructor for sparse box constraint. Takes bounds and sparsity pattern. More...
 
 BoxConstraintBase (const BoxConstraintBase &arg)
 
virtual ~BoxConstraintBase ()
 
virtual size_t getConstraintSize () const override
 The evaluate method used for jit compilation in constraint container ad. More...
 
- 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 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...
 

Additional Inherited Members

- Static Public Member Functions inherited from ct::optcon::BoxConstraintBase< CONTROL_DIM, STATE_DIM, CONTROL_DIM, SCALAR >
static void sparsityPatternSparseJacobian (const VectorXi &sparsity_vec, const size_t &constrSize, VectorXi &rows, VectorXi &cols)
 generate sparsity pattern for sparse box constraint More...
 
- 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
 
- Protected Member Functions inherited from ct::optcon::BoxConstraintBase< CONTROL_DIM, STATE_DIM, CONTROL_DIM, SCALAR >
sparsity_matrix_t diagSparsityVecToSparsityMat (const VectorXi &spVec, const size_t &nConstr)
 transform a sparsity vector (giving the sparsity pattern on the diagonal) in to a sparsity matrix More...
 
- 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::BoxConstraintBase< CONTROL_DIM, STATE_DIM, CONTROL_DIM, SCALAR >
VectorXi sparsity_
 sparsity in vector form More...
 
sparsity_matrix_t sparsity_J_
 sparsity matrix More...
 
size_t constrSize_
 size of the constraint 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::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >

Class for control input box constraint term.

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

Member Typedef Documentation

◆ Trait

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
using ct::optcon::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::Trait = typename ct::core::tpl::TraitSelector<SCALAR>::Trait

◆ Base

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
using ct::optcon::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::Base = BoxConstraintBase<CONTROL_DIM, STATE_DIM, CONTROL_DIM, SCALAR>

◆ state_vector_t

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

◆ control_vector_t

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

◆ VectorXi

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

◆ VectorXs

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

◆ MatrixXs

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

◆ sparsity_matrix_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
using ct::optcon::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::sparsity_matrix_t = Eigen::Matrix<SCALAR, Eigen::Dynamic, CONTROL_DIM>

Constructor & Destructor Documentation

◆ ControlInputConstraint() [1/3]

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
ct::optcon::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::ControlInputConstraint ( const control_vector_t uLow,
const control_vector_t uHigh 
)

Constructor taking lower and upper state bounds directly. Assumes state box constraint is dense.

Parameters
[in]uLowThe upper control input bound
[in]uHighThe lower control input bound

◆ ControlInputConstraint() [2/3]

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
ct::optcon::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::ControlInputConstraint ( const VectorXs lb,
const VectorXs ub,
const Eigen::VectorXi &  control_sparsity 
)

Constructor for sparse control input box constraint. Takes bounds and sparsity pattern.

Parameters
lbLower boundary values
ubUpper boundary values
control_sparsityControl input constraint sparsity pattern

◆ ControlInputConstraint() [3/3]

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

◆ ~ControlInputConstraint()

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

Member Function Documentation

◆ clone()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR > * ct::optcon::ControlInputConstraint< 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::BoxConstraintBase< CONTROL_DIM, STATE_DIM, CONTROL_DIM, SCALAR >.

◆ evaluate()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
Eigen::Matrix< SCALAR, Eigen::Dynamic, 1 > ct::optcon::ControlInputConstraint< 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::BoxConstraintBase< CONTROL_DIM, STATE_DIM, CONTROL_DIM, SCALAR >.

References ct::optcon::BoxConstraintBase< CONTROL_DIM, STATE_DIM, CONTROL_DIM, SCALAR >::sparsity_J_, t, u, and x.

◆ jacobianState()

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

◆ jacobianInput()

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

◆ getNumNonZerosJacobianState()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
size_t ct::optcon::ControlInputConstraint< 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

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

◆ getNumNonZerosJacobianInput()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
size_t ct::optcon::ControlInputConstraint< 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

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

References ct::optcon::BoxConstraintBase< CONTROL_DIM, STATE_DIM, CONTROL_DIM, SCALAR >::constrSize_.

◆ jacobianStateSparse()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::VectorXs ct::optcon::ControlInputConstraint< 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

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

◆ jacobianInputSparse()

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

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

Returns
The sparse constraint jacobian

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

References ct::optcon::BoxConstraintBase< CONTROL_DIM, STATE_DIM, CONTROL_DIM, SCALAR >::constrSize_.

◆ sparsityPatternState()

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

◆ sparsityPatternInput()


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