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);
142 if (var_set ==
"var_set1") {
143 Vector2d x = GetVariables()->GetComponent(
"var_set1")->GetValues();
145 jac_block.coeffRef(0, 0) = 2.0*x(0);
146 jac_block.coeffRef(0, 1) = 1.0;
159 Vector2d x = GetVariables()->GetComponent(
"var_set1")->GetValues();
160 return -std::pow(x(1)-2,2);
165 if (var_set ==
"var_set1") {
166 Vector2d x = GetVariables()->GetComponent(
"var_set1")->GetValues();
168 jac.coeffRef(0, 0) = 0.0;
169 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.