- 3.0.2 optimal control module.
StateSumConstraint Class Reference

A simple 1d constraint term. More...

#include <StateSumConstraint.h>

Inheritance diagram for StateSumConstraint:
ct::optcon::ConstraintBase< 2, 1 >

Public Types

typedef ct::core::tpl::TraitSelector< ct::core::ADCGScalar >::Trait TraitCG
 
typedef ct::optcon::ConstraintBase< 2, 1 > Base
 
typedef ct::core::StateVector< 2 > state_vector_t
 
typedef ct::core::ControlVector< 1 > control_vector_t
 
typedef Eigen::Matrix< double, 1, 2 > Jacobian_state_t
 
typedef Eigen::Matrix< double, 1, 1 > Jacobian_control_t
 
- Public Types inherited from ct::optcon::ConstraintBase< 2, 1 >
typedef core::StateVector< STATE_DIM, double > state_vector_t
 
typedef core::ControlVector< CONTROL_DIM, double > control_vector_t
 
typedef Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorXs
 
typedef Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixXs
 

Public Member Functions

 StateSumConstraint (double lb, double ub)
 constructor with constraint boundaries. More...
 
virtual ~StateSumConstraint ()
 
virtual StateSumConstraintclone () const override
 Creates a new instance of the object with same properties than original. More...
 
virtual size_t getConstraintSize () const override
 The evaluate method used for jit compilation in constraint container ad. More...
 
virtual Eigen::VectorXd evaluate (const state_vector_t &x, const control_vector_t &u, const double t) override
 
virtual Eigen::Matrix< ct::core::ADCGScalar, Eigen::Dynamic, 1 > evaluateCppadCg (const ct::core::StateVector< 2, ct::core::ADCGScalar > &x, const ct::core::ControlVector< 1, ct::core::ADCGScalar > &u, ct::core::ADCGScalar t) override
 
- Public Member Functions inherited from ct::optcon::ConstraintBase< 2, 1 >
 ConstraintBase (std::string name="Unnamed")
 Custom constructor. More...
 
 ConstraintBase (const ConstraintBase &arg)
 Copy constructor. More...
 
virtual ~ConstraintBase ()
 Destructor. More...
 
virtual VectorXs evaluate (const state_vector_t &x, const control_vector_t &u, const double t)=0
 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 double t)
 Returns the constraint jacobian wrt state. More...
 
virtual MatrixXs jacobianInput (const state_vector_t &x, const control_vector_t &u, const double 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 double 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 double 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< double >::Trait Trait
 
- Public Attributes inherited from ct::optcon::ConstraintBase< 2, 1 >
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef ct::core::tpl::TraitSelector< double >::Trait Trait
 

Additional Inherited Members

- Static Protected Member Functions inherited from ct::optcon::ConstraintBase< 2, 1 >
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< 2, 1 >
VectorXs lb_
 
VectorXs ub_
 lower bound on the constraints More...
 

Detailed Description

A simple 1d constraint term.

This term implements sum of states inequality constraints $ d_{lb} \leq x_{0} + x_{1} \leq d_{ub} $

Examples:
switched_continuous_optcon.cpp.

Member Typedef Documentation

◆ TraitCG

◆ Base

◆ state_vector_t

◆ control_vector_t

◆ Jacobian_state_t

typedef Eigen::Matrix<double, 1, 2> StateSumConstraint::Jacobian_state_t

◆ Jacobian_control_t

typedef Eigen::Matrix<double, 1, 1> StateSumConstraint::Jacobian_control_t

Constructor & Destructor Documentation

◆ StateSumConstraint()

StateSumConstraint::StateSumConstraint ( double  lb,
double  ub 
)
inline

constructor with constraint boundaries.

References ct::optcon::ConstraintBase< 2, 1 >::lb_, and ct::optcon::ConstraintBase< 2, 1 >::ub_.

Referenced by clone().

◆ ~StateSumConstraint()

virtual StateSumConstraint::~StateSumConstraint ( )
inlinevirtual

Member Function Documentation

◆ clone()

virtual StateSumConstraint* StateSumConstraint::clone ( ) const
inlineoverridevirtual

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

Returns
Copy of this object.

Implements ct::optcon::ConstraintBase< 2, 1 >.

References StateSumConstraint().

◆ getConstraintSize()

virtual size_t StateSumConstraint::getConstraintSize ( ) const
inlineoverridevirtual

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< 2, 1 >.

◆ evaluate()

virtual Eigen::VectorXd StateSumConstraint::evaluate ( const state_vector_t x,
const control_vector_t u,
const double  t 
)
inlineoverridevirtual

References x.

◆ evaluateCppadCg()

virtual Eigen::Matrix<ct::core::ADCGScalar, Eigen::Dynamic, 1> StateSumConstraint::evaluateCppadCg ( const ct::core::StateVector< 2, ct::core::ADCGScalar > &  x,
const ct::core::ControlVector< 1, ct::core::ADCGScalar > &  u,
ct::core::ADCGScalar  t 
)
inlineoverridevirtual

References x.

Member Data Documentation

◆ Trait

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef ct::core::tpl::TraitSelector<double>::Trait StateSumConstraint::Trait

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