31 #ifndef _CONSTRAINTSBASE_H
32 #define _CONSTRAINTSBASE_H
34 #include <Eigen/Dense>
36 namespace DirectTrajectoryOptimization {
45 template <
class DIMENSIONS>
50 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
52 typedef typename DIMENSIONS::state_vector_t state_vector_t;
53 typedef typename DIMENSIONS::control_vector_t control_vector_t;
58 virtual Eigen::VectorXd evalConstraintsFct(
const state_vector_t& x,
const control_vector_t& u) {
59 return (Eigen::VectorXd::Zero(g_size));
61 virtual Eigen::VectorXd evalConstraintsFctDerivatives(
const state_vector_t& x,
const control_vector_t& u) {
62 return (Eigen::VectorXd::Zero(nnz_jac_));
65 Eigen::VectorXd getConstraintsLowerBound() {
return g_low;}
66 Eigen::VectorXd getConstraintsUpperBound() {
return g_up;}
68 void setSize(
const int & size) {g_size = size;}
69 void setConstraintsLowerBound(
const Eigen::VectorXd & g_lb_candidate);
70 void setConstraintsUpperBound(
const Eigen::VectorXd & g_ub_candidate);
72 int getNumConstraints() {
return g_size;}
80 Eigen::VectorXi getSparseRow() {
return iRow_;}
81 Eigen::VectorXi getSparseCol() {
return jCol_;}
85 Eigen::VectorXd g_low;
90 Eigen::VectorXi iRow_ , jCol_;
93 template <
class DIMENSIONS>
94 void ConstraintsBase<DIMENSIONS>::setConstraintsLowerBound(
const Eigen::VectorXd & g_lb_candidate) {
96 int candidate_size = g_lb_candidate.size();
98 if (candidate_size != g_size) {
99 std::cout <<
"ERROR : Lower bound vector size " << std::endl;
100 std::exit(EXIT_FAILURE);
102 g_low = g_lb_candidate;
106 template <
class DIMENSIONS>
107 void ConstraintsBase<DIMENSIONS>::setConstraintsUpperBound(
const Eigen::VectorXd & g_ub_candidate) {
109 int candidate_size = g_ub_candidate.size();
111 if (candidate_size != g_size) {
112 std::cout <<
"ERROR : Lower bound vector size " << std::endl;
113 std::exit(EXIT_FAILURE);
115 g_up = g_ub_candidate;
Base class for TO constraints.
Definition: ConstraintsBase.hpp:46
int getNnzJac()
Access the number of non-zero elements of the Jacobian of this constraint.
Definition: ConstraintsBase.hpp:78