59 using Eigen::Vector2d;
94 bounds.at(0) =
Bounds(-1.0, 1.0);
116 Vector2d x = GetVariables()->GetComponent(
"var_set1")->GetValues();
117 g(0) = std::pow(x(0),2) + x(1);
127 b.at(0) =
Bounds(1.0, 1.0);
141 if (var_set ==
"var_set1") {
142 Vector2d x = GetVariables()->GetComponent(
"var_set1")->GetValues();
144 jac_block.coeffRef(0, 0) = 2.0*x(0);
145 jac_block.coeffRef(0, 1) = 1.0;
158 Vector2d x = GetVariables()->GetComponent(
"var_set1")->GetValues();
159 return -std::pow(x(1)-2,2);
164 if (var_set ==
"var_set1") {
165 Vector2d x = GetVariables()->GetComponent(
"var_set1")->GetValues();
167 jac.coeffRef(0, 0) = 0.0;
168 jac.coeffRef(0, 1) = -2.0*(x(1)-2.0);
A container holding a single cost term.
ExVariables(const std::string &name)
A container holding a set of related constraints.
void FillJacobianBlock(std::string var_set, Jacobian &jac_block) const override
Set individual Jacobians corresponding to each decision variable set.
VecBound GetBounds() const override
Returns the "bounds" of this component.
VectorXd GetValues() const override
Returns the "values" of whatever this component represents.
ExCost(const std::string &name)
static const Bounds NoBound
Eigen::SparseMatrix< double, Eigen::RowMajor > Jacobian
Upper and lower bound for optimization variables and constraints.
VecBound GetBounds() const override
Returns the "bounds" of this component.
common namespace for all elements in this library.
double GetCost() const override
Returns the scalar cost term calculated from the variables.
A container holding a set of related optimization variables.
ExConstraint(const std::string &name)
void FillJacobianBlock(std::string var_set, Jacobian &jac) const override
Set individual Jacobians corresponding to each decision variable set.
std::vector< Bounds > VecBound
int GetRows() const
Returns the number of rows of this component.
VectorXd GetValues() const override
Returns the "values" of whatever this component represents.
void SetVariables(const VectorXd &x) override
Sets the optimization variables from an Eigen vector.