A container holding a set of related constraints. More...
#include <constraint_set.h>
Public Member Functions | |
ConstraintSet (int n_constraints, const std::string &name) | |
Creates constraints on the variables x . | |
Jacobian | GetJacobian () const override final |
The matrix of derivatives for these constraints and variables. | |
virtual void | LinkWithVariables (const VariablesPtr &x) final |
Connects the constraint with the optimization variables. | |
virtual | ~ConstraintSet () |
Protected Member Functions | |
const VariablesPtr | GetVariables () const |
Read access to the value of the optimization variables. | |
Private Member Functions | |
virtual void | FillJacobianBlock (std::string var_set, Jacobian &jac_block) const =0 |
Set individual Jacobians corresponding to each decision variable set. | |
virtual void | InitVariableDependedQuantities (const VariablesPtr &x_init) |
Initialize quantities that depend on the optimization variables. | |
virtual void | SetVariables (const VectorXd &x) override final |
Sets the optimization variables from an Eigen vector. | |
Private Attributes | |
VariablesPtr | variables_ |
A container holding a set of related constraints.
This container holds constraints representing a single concept, e.g. n
constraints keeping a foot inside its range of motion. Each of the n
rows is given by: lower_bound < g(x) < upper_bound
Definition at line 47 of file constraint_set.h.
ifopt::ConstraintSet::ConstraintSet | ( | int | n_constraints, |
const std::string & | name | ||
) |
virtual ifopt::ConstraintSet::~ConstraintSet | ( | ) | [virtual] |
virtual void ifopt::ConstraintSet::FillJacobianBlock | ( | std::string | var_set, |
Jacobian & | jac_block | ||
) | const [private, pure virtual] |
Set individual Jacobians corresponding to each decision variable set.
var_set | Set of variables the current Jacobian block belongs to. |
jac_block | Columns of the overall Jacobian affected by var_set. |
A convenience function so the user does not have to worry about the ordering of variable sets. All that is required is that the user knows the internal ordering of variables in each individual set and provides the Jacobian of the constraints w.r.t. this set (starting at column 0). GetJacobian() then inserts these columns at the correct position in the overall Jacobian.
If the constraint doen't depend on a var_set
, this function should simply do nothing.
Implemented in ifopt::ExCost, and ifopt::ExConstraint.
ConstraintSet::Jacobian ifopt::ConstraintSet::GetJacobian | ( | ) | const [override, virtual] |
The matrix of derivatives for these constraints and variables.
Assuming n
constraints and m
variables, the returned Jacobian has dimensions n x m. Every row represents the derivatives of a single constraint, whereas every column refers to a single optimization variable.
This function only combines the user-defined jacobians from FillJacobianBlock().
Implements ifopt::Component.
const VariablesPtr ifopt::ConstraintSet::GetVariables | ( | ) | const [inline, protected] |
Read access to the value of the optimization variables.
This must be used to formulate the constraint violation and Jacobian.
Definition at line 87 of file constraint_set.h.
virtual void ifopt::ConstraintSet::InitVariableDependedQuantities | ( | const VariablesPtr & | x_init | ) | [inline, private, virtual] |
Initialize quantities that depend on the optimization variables.
x | A pointer to the initial values of the optimization variables. |
Sometimes the number of constraints depends on the variable representation, or shorthands to specific variable sets want to be saved for quicker access later. This function can be overwritten for that.
Definition at line 116 of file constraint_set.h.
void ifopt::ConstraintSet::LinkWithVariables | ( | const VariablesPtr & | x | ) | [virtual] |
virtual void ifopt::ConstraintSet::SetVariables | ( | const VectorXd & | x | ) | [inline, override, private, virtual] |
Sets the optimization variables from an Eigen vector.
This is only done for Variable, where these are set from the current values of the NLP solvers.
Implements ifopt::Component.
Definition at line 119 of file constraint_set.h.
VariablesPtr ifopt::ConstraintSet::variables_ [private] |
Definition at line 106 of file constraint_set.h.