Drake
Constraint Class Reference

A constraint is a function + lower and upper bounds. More...

#include <drake/solvers/constraint.h>

Inheritance diagram for Constraint:
[legend]
Collaboration diagram for Constraint:
[legend]

Public Member Functions

template<typename DerivedLB , typename DerivedUB >
 Constraint (int num_constraints, int num_vars, const Eigen::MatrixBase< DerivedLB > &lb, const Eigen::MatrixBase< DerivedUB > &ub, const std::string &description="")
 Constructs a constraint which has num_constraints rows, with an input num_vars x 1 vector. More...
 
 Constraint (int num_constraints, int num_vars)
 Constructs a constraint which has num_constraints rows, with an input num_vars x 1 vector, with no bounds. More...
 
bool CheckSatisfied (const Eigen::Ref< const Eigen::VectorXd > &x, double tol=1E-6) const
 Return whether this constraint is satisfied by the given value, x. More...
 
bool CheckSatisfied (const Eigen::Ref< const AutoDiffVecXd > &x, double tol=1E-6) const
 
const Eigen::VectorXd & lower_bound () const
 
const Eigen::VectorXd & upper_bound () const
 
size_t num_constraints () const
 Number of rows in the output constraint. More...
 
template<typename Derived >
void UpdateLowerBound (const Eigen::MatrixBase< Derived > &new_lb)
 Updates the lower bound. More...
 
template<typename Derived >
void UpdateUpperBound (const Eigen::MatrixBase< Derived > &new_ub)
 Updates the upper bound. More...
 
template<typename DerivedL , typename DerivedU >
void set_bounds (const Eigen::MatrixBase< DerivedL > &lower_bound, const Eigen::MatrixBase< DerivedU > &upper_bound)
 Set the upper and lower bounds of the constraint. More...
 
Does not allow copy, move, or assignment
 Constraint (const Constraint &)=delete
 
Constraintoperator= (const Constraint &)=delete
 
 Constraint (Constraint &&)=delete
 
Constraintoperator= (Constraint &&)=delete
 
- Public Member Functions inherited from EvaluatorBase
virtual ~EvaluatorBase ()
 
void Eval (const Eigen::Ref< const Eigen::VectorXd > &x, Eigen::VectorXd &y) const
 Evaluates the expression with a scalar type of double. More...
 
void Eval (const Eigen::Ref< const AutoDiffVecXd > &x, AutoDiffVecXd &y) const
 Evaluates the expression with a scalar type of AutoDiffXd. More...
 
void set_description (const std::string &description)
 Set a human-friendly description for the evaluator. More...
 
const std::string & get_description () const
 Getter for a human-friendly description for the evaluator. More...
 
int num_vars () const
 Getter for the number of variables, namely the number of rows in x, as used in Eval(x, y). More...
 
int num_outputs () const
 Getter for the number of outputs, namely the number of rows in y, as used in Eval(x, y). More...
 
 EvaluatorBase (const EvaluatorBase &)=delete
 
EvaluatorBaseoperator= (const EvaluatorBase &)=delete
 
 EvaluatorBase (EvaluatorBase &&)=delete
 
EvaluatorBaseoperator= (EvaluatorBase &&)=delete
 

Protected Member Functions

virtual bool DoCheckSatisfied (const Eigen::Ref< const Eigen::VectorXd > &x, const double tol) const
 
virtual bool DoCheckSatisfied (const Eigen::Ref< const AutoDiffVecXd > &x, const double tol) const
 
- Protected Member Functions inherited from EvaluatorBase
 EvaluatorBase (int num_outputs, int num_vars, const std::string &description="")
 Constructs a evaluator. More...
 
virtual void DoEval (const Eigen::Ref< const Eigen::VectorXd > &x, Eigen::VectorXd &y) const =0
 Implements expression evaluation for scalar type double. More...
 
virtual void DoEval (const Eigen::Ref< const AutoDiffVecXd > &x, AutoDiffVecXd &y) const =0
 Implements expression evaluation for scalar type AutoDiffXd. More...
 

Detailed Description

A constraint is a function + lower and upper bounds.

Solver interfaces must acknowledge that these constraints are mutable. Parameters can change after the constraint is constructed and before the call to Solve().

It should support evaluating the constraint, and adding it to an optimization problem.

Constructor & Destructor Documentation

Constraint ( const Constraint )
delete
Constraint ( Constraint &&  )
delete
Constraint ( int  num_constraints,
int  num_vars,
const Eigen::MatrixBase< DerivedLB > &  lb,
const Eigen::MatrixBase< DerivedUB > &  ub,
const std::string &  description = "" 
)
inline

Constructs a constraint which has num_constraints rows, with an input num_vars x 1 vector.

Parameters
num_constraints.The number of rows in the constraint output.
num_vars.The number of rows in the input. If the input dimension is unknown, then set num_vars to Eigen::Dynamic.
lbLower bound, which must be a num_constraints x 1 vector.
ubUpper bound, which must be a num_constraints x 1 vector.
See also
Eval(...)
Constraint ( int  num_constraints,
int  num_vars 
)
inline

Constructs a constraint which has num_constraints rows, with an input num_vars x 1 vector, with no bounds.

Parameters
num_constraints.The number of rows in the constraint output.
num_vars.The number of rows in the input. If the input dimension is unknown, then set num_vars to Eigen::Dynamic.
See also
Eval(...)

Member Function Documentation

bool CheckSatisfied ( const Eigen::Ref< const Eigen::VectorXd > &  x,
double  tol = 1E-6 
) const
inline

Return whether this constraint is satisfied by the given value, x.

Parameters
xA num_vars x 1 vector.
tolA tolerance for bound checking.

Here is the call graph for this function:

bool CheckSatisfied ( const Eigen::Ref< const AutoDiffVecXd > &  x,
double  tol = 1E-6 
) const
inline

Here is the call graph for this function:

virtual bool DoCheckSatisfied ( const Eigen::Ref< const Eigen::VectorXd > &  x,
const double  tol 
) const
inlineprotectedvirtual

Reimplemented in LinearComplementarityConstraint.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool DoCheckSatisfied ( const Eigen::Ref< const AutoDiffVecXd > &  x,
const double  tol 
) const
inlineprotectedvirtual

Reimplemented in LinearComplementarityConstraint.

Here is the call graph for this function:

const Eigen::VectorXd& lower_bound ( ) const
inline

Here is the caller graph for this function:

size_t num_constraints ( ) const
inline

Number of rows in the output constraint.

Here is the call graph for this function:

Here is the caller graph for this function:

Constraint& operator= ( Constraint &&  )
delete
Constraint& operator= ( const Constraint )
delete
void set_bounds ( const Eigen::MatrixBase< DerivedL > &  lower_bound,
const Eigen::MatrixBase< DerivedU > &  upper_bound 
)
inline

Set the upper and lower bounds of the constraint.

Parameters
lower_bound.A num_constraints x 1 vector.
upper_bound.A num_constraints x 1 vector.

Here is the call graph for this function:

Here is the caller graph for this function:

void UpdateLowerBound ( const Eigen::MatrixBase< Derived > &  new_lb)
inline

Updates the lower bound.

Here is the call graph for this function:

void UpdateUpperBound ( const Eigen::MatrixBase< Derived > &  new_ub)
inline

Updates the upper bound.

Here is the call graph for this function:

const Eigen::VectorXd& upper_bound ( ) const
inline

Here is the caller graph for this function:


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