![]() |
- 3.0.2 optimal control module.
|
Base class for the constraints used in this toolbox. More...
#include <ConstraintBase.h>
Public Types | |
| typedef core::StateVector< STATE_DIM, SCALAR > | state_vector_t |
| typedef core::ControlVector< CONTROL_DIM, SCALAR > | control_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... | |
Base class for the constraints used in this toolbox.
| STATE_DIM | The state dimension |
| CONTROL_DIM | The control dimension |
| SCALAR | The Scalar type |
| typedef core::StateVector<STATE_DIM, SCALAR> ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::state_vector_t |
| typedef core::ControlVector<CONTROL_DIM, SCALAR> ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::control_vector_t |
| typedef Eigen::Matrix<SCALAR, Eigen::Dynamic, 1> ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::VectorXs |
| typedef Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::MatrixXs |
| ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::ConstraintBase | ( | std::string | name = "Unnamed" | ) |
Custom constructor.
| [in] | name | The name of the constraint |
| ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::ConstraintBase | ( | const ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR > & | arg | ) |
Copy constructor.
| [in] | arg | The object to be copied |
|
virtual |
Destructor.
|
pure virtual |
Creates a new instance of the object with same properties than original.
Implemented in StateGenConstraint, ct::optcon::example::ConstraintTerm2D< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::example::StateInputConstraint_Example< STATE_DIM, CONTROL_DIM, SCALAR >, ControlInputGenConstraint, ct::optcon::BoxConstraintBase< DERIVED_DIM, 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::StateConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, ConstraintTerm1D, ct::optcon::example::ConstraintTerm1D< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::example::PureStateConstraint_Example< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::ObstacleConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, and StateSumConstraint.
|
pure virtual |
The evaluation of the constraint violation. Note this method is SCALAR typed.
| [in] | x | The state vector |
| [in] | u | The control vector |
| [in] | t | The time |
Implemented in ct::optcon::example::ConstraintTerm2D< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::example::StateInputConstraint_Example< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::BoxConstraintBase< DERIVED_DIM, 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::StateConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::example::ConstraintTerm1D< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::example::PureStateConstraint_Example< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, and ct::optcon::ObstacleConstraint< STATE_DIM, CONTROL_DIM, SCALAR >.
|
pure virtual |
The evaluate method used for jit compilation in constraint container ad.
| [in] | x | The state vector |
| [in] | u | The control vector |
| [in] | t | The time |
Implemented in ct::optcon::example::ConstraintTerm2D< STATE_DIM, CONTROL_DIM, SCALAR >, StateGenConstraint, ct::optcon::example::StateInputConstraint_Example< STATE_DIM, CONTROL_DIM, SCALAR >, ControlInputGenConstraint, ct::optcon::BoxConstraintBase< DERIVED_DIM, 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 >, ConstraintTerm1D, ct::optcon::example::ConstraintTerm1D< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::example::PureStateConstraint_Example< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::ObstacleConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, and StateSumConstraint.
|
virtual |
Returns the constraint jacobian wrt state.
Reimplemented in ct::optcon::example::ConstraintTerm2D< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::example::StateInputConstraint_Example< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::BoxConstraintBase< DERIVED_DIM, 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::StateConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::example::ConstraintTerm1D< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::example::PureStateConstraint_Example< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, and ct::optcon::ObstacleConstraint< STATE_DIM, CONTROL_DIM, SCALAR >.
|
virtual |
Returns the constraint jacobian wrt input.
Reimplemented in ct::optcon::example::ConstraintTerm2D< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::example::StateInputConstraint_Example< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::BoxConstraintBase< DERIVED_DIM, 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::example::ConstraintTerm1D< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::StateConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, and ct::optcon::ObstacleConstraint< STATE_DIM, CONTROL_DIM, SCALAR >.
|
virtual |
Returns the lower constraint bound.
|
virtual |
Returns the upper constraint bound.
| void ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::getName | ( | std::string & | constraintName | ) | const |
Returns the constraint name.
| [out] | constraintName | The constraint name |
| void ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::setName | ( | const std::string | constraintName | ) |
Sets the constraint name.
| [in] | constraintName | The constraint name |
|
virtual |
Returns the number of nonzeros in the jacobian wrt state. The default implementation assumes a dense matrix with only nonzero elements.
Reimplemented in ct::optcon::BoxConstraintBase< DERIVED_DIM, 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::StateConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, and ct::optcon::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >.
|
virtual |
Returns the number of nonzeros in the jacobian wrt control input. The default implementation assumes a dense matrix with only nonzero elements.
Reimplemented in ct::optcon::BoxConstraintBase< DERIVED_DIM, 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::StateConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, and ct::optcon::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >.
|
virtual |
Returns the constraint jacobian wrt state in sparse structure. The default implementation maps the JacobianState matrix to a vector.
Reimplemented in ct::optcon::BoxConstraintBase< DERIVED_DIM, 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::StateConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, ct::optcon::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, and ct::optcon::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >.
|
virtual |
Returns the constraint jacobian wrt control input in sparse structure. The default implementation maps the JacobianState matrix to a vector.
Reimplemented in ct::optcon::BoxConstraintBase< DERIVED_DIM, 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::StateConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, and ct::optcon::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >.
|
virtual |
Generates the sparsity pattern of the jacobian wrt state. The default implementation returns a vector of ones corresponding to the dense jacobianState.
| rows | The vector of the row indices containing non zero elements in the constraint jacobian |
| cols | The vector of the column indices containing non zero elements in the constraint jacobian |
|
virtual |
Generates the sparsity pattern of the jacobian wrt control input. The default implementation returns a vector of ones corresponding to the dense jacobianInput.
| rows | The vector of the row indices containing non zero elements in the constraint jacobian |
| cols | The vector of the column indices containing non zero elements in the constraint jacobian |
|
staticprotected |
upper bound on the constraints
Generates indices of a diagonal square matrix
| [in] | num_elements | The number of elements |
| [out] | iRow_vec | The row vector |
| [out] | jCol_vec | The column vector |
Referenced by ct::optcon::TerminalConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::sparsityPatternState().
|
staticprotected |
Generates indices of a sparse diagonal square matrix.
| [in] | diag_sparsity | Sparsity pattern for the diagonal (Example: [0 1 0 0 1 1]) |
| [out] | iRow_vec | The row vector |
| [out] | jCol_vec | The column vector |
|
staticprotected |
Generates indices of a full matrix.
| [in] | num_rows | The number of rows of the matrix |
| [in] | num_cols | The number columns of the matrix |
| [out] | iRow_vec | The row vector |
| [out] | jCol_vec | The col vector |
| EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef ct::core::tpl::TraitSelector<SCALAR>::Trait ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >::Trait |
|
protected |
Referenced by ct::optcon::example::ConstraintTerm1D< STATE_DIM, CONTROL_DIM, SCALAR >::ConstraintTerm1D(), ct::optcon::example::ConstraintTerm2D< STATE_DIM, CONTROL_DIM, SCALAR >::ConstraintTerm2D(), ct::optcon::ObstacleConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::ObstacleConstraint(), ct::optcon::example::PureStateConstraint_Example< STATE_DIM, CONTROL_DIM, SCALAR >::PureStateConstraint_Example(), and ct::optcon::example::StateInputConstraint_Example< STATE_DIM, CONTROL_DIM, SCALAR >::StateInputConstraint_Example().
|
protected |
lower bound on the constraints
Referenced by ct::optcon::example::ConstraintTerm1D< STATE_DIM, CONTROL_DIM, SCALAR >::ConstraintTerm1D(), ct::optcon::example::ConstraintTerm2D< STATE_DIM, CONTROL_DIM, SCALAR >::ConstraintTerm2D(), ct::optcon::ObstacleConstraint< STATE_DIM, CONTROL_DIM, SCALAR >::ObstacleConstraint(), ct::optcon::example::PureStateConstraint_Example< STATE_DIM, CONTROL_DIM, SCALAR >::PureStateConstraint_Example(), and ct::optcon::example::StateInputConstraint_Example< STATE_DIM, CONTROL_DIM, SCALAR >::StateInputConstraint_Example().