Drake
LinearCost Class Reference

Implements a cost of the form a'x + b . More...

#include <drake/solvers/cost.h>

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

Public Member Functions

 LinearCost (const Eigen::Ref< const Eigen::VectorXd > &a, double b=0.)
 Construct a linear cost of the form a'x + b . More...
 
 ~LinearCost () override
 
Eigen::SparseMatrix< doubleGetSparseMatrix () const
 
const Eigen::VectorXd & a () const
 
double b () const
 
void UpdateCoefficients (const Eigen::Ref< const Eigen::VectorXd > &new_a, double new_b=0.)
 Updates the linear term, upper and lower bounds in the linear constraint. More...
 
Does not allow copy, move, or assignment
 LinearCost (const LinearCost &)=delete
 
LinearCostoperator= (const LinearCost &)=delete
 
 LinearCost (LinearCost &&)=delete
 
LinearCostoperator= (LinearCost &&)=delete
 
- Public Member Functions inherited from Cost
 Cost (const Cost &)=delete
 
Costoperator= (const Cost &)=delete
 
 Cost (Cost &&)=delete
 
Costoperator= (Cost &&)=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

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

Detailed Description

Implements a cost of the form a'x + b .

Constructor & Destructor Documentation

LinearCost ( const LinearCost )
delete
LinearCost ( LinearCost &&  )
delete
LinearCost ( const Eigen::Ref< const Eigen::VectorXd > &  a,
double  b = 0. 
)
inline

Construct a linear cost of the form a'x + b .

Parameters
aLinear term.
b(optional) Constant term.
~LinearCost ( )
inlineoverride

Member Function Documentation

const Eigen::VectorXd& a ( ) const
inline
double b ( ) const
inline

Here is the caller graph for this function:

void DoEval ( const Eigen::Ref< const Eigen::VectorXd > &  x,
Eigen::VectorXd &  y 
) const
overrideprotectedvirtual

Implements expression evaluation for scalar type double.

Parameters
xInput vector.
yOutput vector.
Precondition
x must be of size num_vars x 1.
Postcondition
y will be of size num_outputs x 1.

Implements EvaluatorBase.

void DoEval ( const Eigen::Ref< const AutoDiffVecXd > &  x,
AutoDiffVecXd y 
) const
overrideprotectedvirtual

Implements expression evaluation for scalar type AutoDiffXd.

Parameters
xInput vector.
yOutput vector.
Precondition
x must be of size num_vars x 1.
Postcondition
y will be of size num_outputs x 1.

Implements EvaluatorBase.

Eigen::SparseMatrix<double> GetSparseMatrix ( ) const
inline
LinearCost& operator= ( LinearCost &&  )
delete
LinearCost& operator= ( const LinearCost )
delete
void UpdateCoefficients ( const Eigen::Ref< const Eigen::VectorXd > &  new_a,
double  new_b = 0. 
)
inline

Updates the linear term, upper and lower bounds in the linear constraint.

The updated constraint is a_new' x + b_new . Note that the number of variables (number of cols) cannot change.

Parameters
new_aNew linear term.
new_b(optional) New constant term.

Here is the call graph for this function:


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