20 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR =
double>
24 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
31 typedef Eigen::Matrix<SCALAR, Eigen::Dynamic, 1>
VectorXs;
32 typedef Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic>
MatrixXs;
70 virtual VectorXs
evaluate(
const state_vector_t&
x,
const control_vector_t&
u,
const SCALAR t) = 0;
83 virtual Eigen::Matrix<ct::core::ADCGScalar, Eigen::Dynamic, 1> evaluateCppadCg(
86 ct::core::ADCGScalar
t);
130 void getName(std::string& constraintName)
const;
137 void setName(
const std::string constraintName);
212 static void genDiagonalIndices(
const size_t num_elements, Eigen::VectorXi& iRow_vec, Eigen::VectorXi& jCol_vec);
222 Eigen::VectorXi& iRow_vec,
223 Eigen::VectorXi& jCol_vec);
234 const size_t num_cols,
235 Eigen::VectorXi& iRow_vec,
236 Eigen::VectorXi& jCol_vec);
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 Ja...
Definition: ConstraintBase-impl.h:100
core::StateVector< STATE_DIM, SCALAR > state_vector_t
Definition: ConstraintBase.h:28
virtual VectorXs getLowerBound() const
Returns the lower constraint bound.
Definition: ConstraintBase-impl.h:62
void getName(std::string &constraintName) const
Returns the constraint name.
Definition: ConstraintBase-impl.h:75
virtual ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR > * clone() const =0
Creates a new instance of the object with same properties than original.
ct::core::ControlVector< control_dim > u
Definition: LoadFromFileTest.cpp:21
virtual MatrixXs jacobianState(const state_vector_t &x, const control_vector_t &u, const SCALAR t)
Returns the constraint jacobian wrt state.
Definition: ConstraintBase-impl.h:40
static void genDiagonalIndices(const size_t num_elements, Eigen::VectorXi &iRow_vec, Eigen::VectorXi &jCol_vec)
upper bound on the constraints
Definition: ConstraintBase-impl.h:136
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 map...
Definition: ConstraintBase-impl.h:113
Eigen::Matrix< SCALAR, Eigen::Dynamic, Eigen::Dynamic > MatrixXs
Definition: ConstraintBase.h:32
core::ControlVector< CONTROL_DIM, SCALAR > control_vector_t
Definition: ConstraintBase.h:29
Eigen::Matrix< SCALAR, Eigen::Dynamic, 1 > VectorXs
Definition: ConstraintBase.h:31
clear all close all load ct GNMSLog0 mat reformat t
Definition: gnmsPlot.m:6
static void genSparseDiagonalIndices(const Eigen::VectorXi &diag_sparsity, Eigen::VectorXi &iRow_vec, Eigen::VectorXi &jCol_vec)
Generates indices of a sparse diagonal square matrix.
Definition: ConstraintBase-impl.h:155
void setName(const std::string constraintName)
Sets the constraint name.
Definition: ConstraintBase-impl.h:81
CppAD::AD< CppAD::cg::CG< double > > SCALAR
virtual void sparsityPatternInput(Eigen::VectorXi &rows, Eigen::VectorXi &cols)
Generates the sparsity pattern of the jacobian wrt control input. The default implementation returns ...
Definition: ConstraintBase-impl.h:130
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.
virtual size_t getConstraintSize() const =0
The evaluate method used for jit compilation in constraint container ad.
VectorXs ub_
lower bound on the constraints
Definition: ConstraintBase.h:203
virtual size_t getNumNonZerosJacobianState() const
Returns the number of nonzeros in the jacobian wrt state. The default implementation assumes a dense ...
Definition: ConstraintBase-impl.h:87
ct::core::StateVector< state_dim > x
Definition: LoadFromFileTest.cpp:20
virtual VectorXs getUpperBound() const
Returns the upper constraint bound.
Definition: ConstraintBase-impl.h:69
virtual ~ConstraintBase()
Destructor.
Definition: ConstraintBase-impl.h:23
ConstraintBase(std::string name="Unnamed")
Custom constructor.
Definition: ConstraintBase-impl.h:12
VectorXs lb_
Definition: ConstraintBase.h:202
virtual void sparsityPatternState(Eigen::VectorXi &rows, Eigen::VectorXi &cols)
Generates the sparsity pattern of the jacobian wrt state. The default implementation returns a vector...
Definition: ConstraintBase-impl.h:124
virtual MatrixXs jacobianInput(const state_vector_t &x, const control_vector_t &u, const SCALAR t)
Returns the constraint jacobian wrt input.
Definition: ConstraintBase-impl.h:51
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef ct::core::tpl::TraitSelector< SCALAR >::Trait Trait
Definition: ConstraintBase.h:26
virtual size_t getNumNonZerosJacobianInput() const
Returns the number of nonzeros in the jacobian wrt control input. The default implementation assumes ...
Definition: ConstraintBase-impl.h:93
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.
Definition: ConstraintBase-impl.h:182
Base class for the constraints used in this toolbox.
Definition: ConstraintBase.h:21