Public Member Functions | List of all members
ifopt::ExConstraint Class Reference

#include <test_vars_constr_cost.h>

Inheritance diagram for ifopt::ExConstraint:
Inheritance graph
[legend]

Public Member Functions

 ExConstraint ()
 
 ExConstraint (const std::string &name)
 
void FillJacobianBlock (std::string var_set, Jacobian &jac_block) const override
 Set individual Jacobians corresponding to each decision variable set. More...
 
VecBound GetBounds () const override
 Returns the "bounds" of this component. More...
 
VectorXd GetValues () const override
 Returns the "values" of whatever this component represents. More...
 
- Public Member Functions inherited from ifopt::ConstraintSet
 ConstraintSet (int n_constraints, const std::string &name)
 Creates constraints on the variables x. More...
 
Jacobian GetJacobian () const final
 The matrix of derivatives for these constraints and variables. More...
 
void LinkWithVariables (const VariablesPtr &x)
 Connects the constraint with the optimization variables. More...
 
virtual ~ConstraintSet ()=default
 
- Public Member Functions inherited from ifopt::Component
 Component (int num_rows, const std::string &name)
 Creates a component. More...
 
std::string GetName () const
 Returns the name (id) of this component. More...
 
int GetRows () const
 Returns the number of rows of this component. More...
 
virtual void Print (double tolerance, int &index_start) const
 Prints the relevant information (name, rows, values) of this component. More...
 
void SetRows (int num_rows)
 Sets the number of rows of this component. More...
 
virtual ~Component ()=default
 

Additional Inherited Members

- Public Types inherited from ifopt::ConstraintSet
using Ptr = std::shared_ptr< ConstraintSet >
 
using VariablesPtr = Composite::Ptr
 
- Public Types inherited from ifopt::Component
using Jacobian = Eigen::SparseMatrix< double, Eigen::RowMajor >
 
using Ptr = std::shared_ptr< Component >
 
using VecBound = std::vector< Bounds >
 
using VectorXd = Eigen::VectorXd
 
- Static Public Attributes inherited from ifopt::Component
static const int kSpecifyLater = -1
 
- Protected Member Functions inherited from ifopt::ConstraintSet
const VariablesPtr GetVariables () const
 Read access to the value of the optimization variables. More...
 

Detailed Description

Definition at line 104 of file test_vars_constr_cost.h.

Constructor & Destructor Documentation

◆ ExConstraint() [1/2]

ifopt::ExConstraint::ExConstraint ( )
inline

Definition at line 106 of file test_vars_constr_cost.h.

◆ ExConstraint() [2/2]

ifopt::ExConstraint::ExConstraint ( const std::string &  name)
inline

Definition at line 110 of file test_vars_constr_cost.h.

Member Function Documentation

◆ FillJacobianBlock()

void ifopt::ExConstraint::FillJacobianBlock ( std::string  var_set,
Jacobian jac_block 
) const
inlineoverridevirtual

Set individual Jacobians corresponding to each decision variable set.

Parameters
var_setSet of variables the current Jacobian block belongs to.
jac_blockColumns 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.

Attention: jac_bock is a sparse matrix, and must always have the same sparsity pattern. Therefore, it's better not to build a dense matrix and call .sparseView(), because if some entries happen to be zero for some iteration, that changes the sparsity pattern. A more robust way is to directly set as follows (which can also be set =0.0 without erros): jac_block.coeffRef(1, 3) = ...

Implements ifopt::ConstraintSet.

Definition at line 136 of file test_vars_constr_cost.h.

◆ GetBounds()

VecBound ifopt::ExConstraint::GetBounds ( ) const
inlineoverridevirtual

Returns the "bounds" of this component.

  • For Variable these are the upper and lower variable bound.
  • For Constraint this represents the constraint bounds.
  • For Cost these done't exists (set to infinity).

Implements ifopt::Component.

Definition at line 124 of file test_vars_constr_cost.h.

◆ GetValues()

VectorXd ifopt::ExConstraint::GetValues ( ) const
inlineoverridevirtual

Returns the "values" of whatever this component represents.

  • For Variable this represents the actual optimization values.
  • For Constraint this represents the constraint value g.
  • For Cost this represents the cost value.

Implements ifopt::Component.

Definition at line 113 of file test_vars_constr_cost.h.


The documentation for this class was generated from the following file:


ifopt
Author(s): Alexander W. Winkler
autogenerated on Fri Sep 16 2022 02:15:26