Drake
FormulaPositiveSemidefinite Class Reference

Symbolic formula representing positive-semidefinite (PSD) constraint. More...

#include <drake/common/symbolic_formula_cell.h>

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

Public Member Functions

 FormulaPositiveSemidefinite (const Eigen::Ref< const MatrixX< Expression >> &m)
 Constructs a positive-semidefinite formula from a symmetric matrix m. More...
 
template<typename Derived >
 FormulaPositiveSemidefinite (const Eigen::TriangularView< Derived, Eigen::Lower > &l)
 Constructs a symbolic positive-semidefinite formula from a lower triangular-view l. More...
 
template<typename Derived >
 FormulaPositiveSemidefinite (const Eigen::TriangularView< Derived, Eigen::Upper > &u)
 Constructs a symbolic positive-semidefinite formula from an upper triangular-view u. More...
 
Variables GetFreeVariables () const override
 Returns set of free variables in formula. More...
 
bool EqualTo (const FormulaCell &f) const override
 Checks structural equality. More...
 
bool Less (const FormulaCell &f) const override
 Checks ordering between this PSD formula and f. More...
 
bool Evaluate (const Environment &env) const override
 Evaluates under a given environment. More...
 
Formula Substitute (const Substitution &s) const override
 Returns a Formula obtained by replacing all occurrences of the variables in s in the current formula cell with the corresponding expressions in s. More...
 
std::ostream & Display (std::ostream &os) const override
 Outputs string representation of formula into output stream os. More...
 
const MatrixX< symbolic::Expression > & get_matrix () const
 Returns the corresponding matrix in this PSD formula. More...
 
- Public Member Functions inherited from FormulaCell
FormulaKind get_kind () const
 Returns kind of formula. More...
 
size_t get_hash () const
 Returns hash of formula. More...
 

Additional Inherited Members

- Protected Member Functions inherited from FormulaCell
 FormulaCell ()=delete
 Default constructor (deleted). More...
 
 FormulaCell (FormulaCell &&f)=default
 Move-construct a formula from an rvalue. More...
 
 FormulaCell (const FormulaCell &f)=default
 Copy-construct a formula from an lvalue. More...
 
FormulaCelloperator= (FormulaCell &&f)=delete
 Move-assign (DELETED). More...
 
FormulaCelloperator= (const FormulaCell &f)=delete
 Copy-assign (DELETED). More...
 
 FormulaCell (FormulaKind k, size_t hash)
 Construct FormulaCell of kind k with hash. More...
 
virtual ~FormulaCell ()=default
 Default destructor. More...
 

Detailed Description

Symbolic formula representing positive-semidefinite (PSD) constraint.

Constructor & Destructor Documentation

FormulaPositiveSemidefinite ( const Eigen::Ref< const MatrixX< Expression >> &  m)
explicit

Constructs a positive-semidefinite formula from a symmetric matrix m.

Exceptions
std::runtime_errorif m is not symmetric.
Note
This constructor checks if m is symmetric by calling math::IsSymmetric function which can be costly.

Here is the call graph for this function:

FormulaPositiveSemidefinite ( const Eigen::TriangularView< Derived, Eigen::Lower > &  l)
inlineexplicit

Constructs a symbolic positive-semidefinite formula from a lower triangular-view l.

FormulaPositiveSemidefinite ( const Eigen::TriangularView< Derived, Eigen::Upper > &  u)
inlineexplicit

Constructs a symbolic positive-semidefinite formula from an upper triangular-view u.

Here is the call graph for this function:

Member Function Documentation

ostream & Display ( std::ostream &  os) const
overridevirtual

Outputs string representation of formula into output stream os.

Implements FormulaCell.

bool EqualTo ( const FormulaCell c) const
overridevirtual

Checks structural equality.

Implements FormulaCell.

Here is the call graph for this function:

bool Evaluate ( const Environment env) const
overridevirtual

Evaluates under a given environment.

Implements FormulaCell.

const MatrixX<symbolic::Expression>& get_matrix ( ) const
inline

Returns the corresponding matrix in this PSD formula.

Here is the call graph for this function:

Variables GetFreeVariables ( ) const
overridevirtual

Returns set of free variables in formula.

Implements FormulaCell.

bool Less ( const FormulaCell f) const
overridevirtual

Checks ordering between this PSD formula and f.

The ordering between two PSD formulas psd1 and psd2 are determined by the ordering between the two matrices m1 in psd1 and m2 in psd2.

First, we compare the size of m1 and m2:

  • If m1 is smaller than m2, psd1.Less(psd2) is true.
  • If m2 is smaller than m1, psd1.Less(psd2) is false.

If m1 and m2 are of the same size, we perform element-wise comparison by following column-major order. See the following example:

m1 << x + y, -3.14,
-3.14, y;
m2 << x + y, 3.14,
3.14, y;
const Formula psd1{positive_semidefinite(m1)};
const Formula psd2{positive_semidefinite(m2)};
EXPECT_TRUE(psd1.Less(psd2));

Note that in the code above, psd1.Less(psd2) holds because we have

  • m1 in column-major ordering : (x + y) -3.14 -3.14 y_
  • m2 in column-major ordering : (x + y) 3.14 3.14 y_.

Implements FormulaCell.

Here is the call graph for this function:

Formula Substitute ( const Substitution s) const
overridevirtual

Returns a Formula obtained by replacing all occurrences of the variables in s in the current formula cell with the corresponding expressions in s.

Implements FormulaCell.

Here is the call graph for this function:


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