- 3.0.2 optimal control module.
|
Base for box constraint, templated on dimension of the decision vector of the derived class. More...
#include <BoxConstraintBase.h>
Public Types | |
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, 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 | |
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 BoxConstraintBase< DERIVED_DIM, STATE_DIM, CONTROL_DIM, SCALAR > * | clone () const override=0 |
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 VectorXs | evaluate (const state_vector_t &x, const control_vector_t &u, const SCALAR t) override=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 SCALAR t) override=0 |
Returns the constraint jacobian wrt state. More... | |
virtual MatrixXs | jacobianInput (const state_vector_t &x, const control_vector_t &u, const SCALAR t) override=0 |
Returns the constraint jacobian wrt input. More... | |
virtual size_t | getNumNonZerosJacobianState () const override=0 |
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=0 |
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=0 |
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=0 |
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=0 |
virtual void | sparsityPatternInput (VectorXi &rows, VectorXi &cols) override=0 |
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... | |
Static Public Member Functions | |
static void | sparsityPatternSparseJacobian (const VectorXi &sparsity_vec, const size_t &constrSize, VectorXi &rows, VectorXi &cols) |
generate sparsity pattern for sparse box constraint More... | |
Protected Member Functions | |
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... | |
Protected Attributes | |
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... | |
Additional Inherited Members | |
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 |
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... | |
Base for box constraint, templated on dimension of the decision vector of the derived class.
DERIVED_DIM | Dimension of the decision vector of the derived class |
STATE_DIM | The state dimension |
INPUT_DIM | The control dimension |
SCALAR | The Scalar type |
using ct::optcon::BoxConstraintBase< DERIVED_DIM, STATE_DIM, CONTROL_DIM, SCALAR >::Trait = typename ct::core::tpl::TraitSelector<SCALAR>::Trait |
using ct::optcon::BoxConstraintBase< DERIVED_DIM, STATE_DIM, CONTROL_DIM, SCALAR >::Base = ConstraintBase<STATE_DIM, CONTROL_DIM, SCALAR> |
using ct::optcon::BoxConstraintBase< DERIVED_DIM, STATE_DIM, CONTROL_DIM, SCALAR >::state_vector_t = core::StateVector<STATE_DIM, SCALAR> |
using ct::optcon::BoxConstraintBase< DERIVED_DIM, STATE_DIM, CONTROL_DIM, SCALAR >::control_vector_t = core::ControlVector<CONTROL_DIM, SCALAR> |
using ct::optcon::BoxConstraintBase< DERIVED_DIM, STATE_DIM, CONTROL_DIM, SCALAR >::decision_vector_t = core::StateVector<DERIVED_DIM, SCALAR> |
using ct::optcon::BoxConstraintBase< DERIVED_DIM, STATE_DIM, CONTROL_DIM, SCALAR >::VectorXi = Eigen::Matrix<int, Eigen::Dynamic, 1> |
using ct::optcon::BoxConstraintBase< DERIVED_DIM, STATE_DIM, CONTROL_DIM, SCALAR >::VectorXs = Eigen::Matrix<SCALAR, Eigen::Dynamic, 1> |
using ct::optcon::BoxConstraintBase< DERIVED_DIM, STATE_DIM, CONTROL_DIM, SCALAR >::MatrixXs = Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> |
using ct::optcon::BoxConstraintBase< DERIVED_DIM, STATE_DIM, CONTROL_DIM, SCALAR >::sparsity_matrix_t = Eigen::Matrix<SCALAR, Eigen::Dynamic, DERIVED_DIM> |
ct::optcon::BoxConstraintBase< DERIVED_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.
[in] | vLow | The full lower bound |
[in] | vHigh | The full upper bound |
ct::optcon::BoxConstraintBase< DERIVED_DIM, STATE_DIM, CONTROL_DIM, SCALAR >::BoxConstraintBase | ( | const VectorXs & | lb, |
const VectorXs & | ub, | ||
const Eigen::VectorXi & | sparsity_vec | ||
) |
Constructor for sparse box constraint. Takes bounds and sparsity pattern.
lb | Lower boundary values |
ub | Upper boundary values |
sparsity_vec | Box constraint sparsity pattern as a vector |
ct::optcon::BoxConstraintBase< DERIVED_DIM, STATE_DIM, CONTROL_DIM, SCALAR >::BoxConstraintBase | ( | const BoxConstraintBase< DERIVED_DIM, STATE_DIM, CONTROL_DIM, SCALAR > & | arg | ) |
|
virtual |
|
static |
generate sparsity pattern for sparse box constraint
|
overridepure virtual |
Creates a new instance of the object with same properties than original.
Implements ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >.
Implemented in ct::optcon::StateConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, and ct::optcon::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >.
|
overridevirtual |
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 |
Implements ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >.
|
overridepure 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 |
Implements ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >.
Implemented in ct::optcon::StateConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, and ct::optcon::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >.
|
overridepure virtual |
Returns the constraint jacobian wrt state.
Reimplemented from ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >.
Implemented in ct::optcon::StateConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, and ct::optcon::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >.
|
overridepure virtual |
Returns the constraint jacobian wrt input.
Reimplemented from ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >.
Implemented in ct::optcon::StateConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, and ct::optcon::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >.
|
overridepure virtual |
Returns the number of nonzeros in the jacobian wrt state. The default implementation assumes a dense matrix with only nonzero elements.
Reimplemented from ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >.
Implemented in ct::optcon::StateConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, and ct::optcon::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >.
|
overridepure virtual |
Returns the number of nonzeros in the jacobian wrt control input. The default implementation assumes a dense matrix with only nonzero elements.
Reimplemented from ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >.
Implemented in ct::optcon::StateConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, and ct::optcon::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >.
|
overridepure virtual |
Returns the constraint jacobian wrt state in sparse structure. The default implementation maps the JacobianState matrix to a vector.
Reimplemented from ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >.
Implemented in ct::optcon::StateConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, and ct::optcon::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >.
|
overridepure virtual |
Returns the constraint jacobian wrt control input in sparse structure. The default implementation maps the JacobianState matrix to a vector.
Reimplemented from ct::optcon::ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >.
Implemented in ct::optcon::StateConstraint< STATE_DIM, CONTROL_DIM, SCALAR >, and ct::optcon::ControlInputConstraint< STATE_DIM, CONTROL_DIM, SCALAR >.
|
overridepure virtual |
|
overridepure virtual |
|
protected |
transform a sparsity vector (giving the sparsity pattern on the diagonal) in to a sparsity matrix
spVec | diagonal sparsity pattern, e.g. [0 0 1 0 1 0] |
nConstr | number of constraints |
|
protected |
sparsity in vector form
|
protected |
sparsity matrix
|
protected |
size of the constraint