Drake
Drake C++ Documentation
GraphOfConvexSets::Vertex Class Referencefinal

Detailed Description

Each vertex in the graph has a corresponding ConvexSet, and a std::string name.

#include <drake/geometry/optimization/graph_of_convex_sets.h>

Public Member Functions

 ~Vertex ()
 
VertexId id () const
 Returns the unique identifier associated with this Vertex. More...
 
int ambient_dimension () const
 Returns the ambient dimension of the ConvexSet. More...
 
const std::string & name () const
 Returns the name of the vertex. More...
 
const VectorX< symbolic::Variable > & x () const
 Returns a decision variable corresponding to an element of the ConvexSet, which can be used for constructing symbolic::Expression costs and constraints. More...
 
const ConvexSetset () const
 Returns a const reference to the underlying ConvexSet. More...
 
std::pair< symbolic::Variable, solvers::Binding< solvers::Cost > > AddCost (const symbolic::Expression &e)
 Adds a cost to this vertex, described by a symbolic::Expression e containing only elements of x() as variables. More...
 
std::pair< symbolic::Variable, solvers::Binding< solvers::Cost > > AddCost (const solvers::Binding< solvers::Cost > &binding)
 Adds a cost to this vertex. More...
 
solvers::Binding< solvers::ConstraintAddConstraint (const symbolic::Formula &f)
 Adds a constraint to this vertex, described by a symbolic::Formula f containing only elements of x() as variables. More...
 
solvers::Binding< solvers::ConstraintAddConstraint (const solvers::Binding< solvers::Constraint > &binding)
 Adds a constraint to this vertex. More...
 
const std::vector< solvers::Binding< solvers::Cost > > & GetCosts () const
 Returns all costs on this vertex. More...
 
const std::vector< solvers::Binding< solvers::Constraint > > & GetConstraints () const
 Returns all constraints on this vertex. More...
 
double GetSolutionCost (const solvers::MathematicalProgramResult &result) const
 Returns the sum of the costs associated with this vertex in a solvers::MathematicalProgramResult. More...
 
Eigen::VectorXd GetSolution (const solvers::MathematicalProgramResult &result) const
 Returns the solution of x() in a MathematicalProgramResult. More...
 
const std::vector< Edge * > & incoming_edges () const
 
const std::vector< Edge * > & outgoing_edges () const
 
Does not allow copy, move, or assignment
 Vertex (const Vertex &)=delete
 
Vertexoperator= (const Vertex &)=delete
 
 Vertex (Vertex &&)=delete
 
Vertexoperator= (Vertex &&)=delete
 

Friends

class GraphOfConvexSets
 

Constructor & Destructor Documentation

◆ Vertex() [1/2]

Vertex ( const Vertex )
delete

◆ Vertex() [2/2]

Vertex ( Vertex &&  )
delete

◆ ~Vertex()

~Vertex ( )

Member Function Documentation

◆ AddConstraint() [1/2]

Adds a constraint to this vertex, described by a symbolic::Formula f containing only elements of x() as variables.

Exceptions
std::exceptionif f.GetFreeVariables() is not a subset of x().
std::exceptionif ambient_dimension() == 0.

◆ AddConstraint() [2/2]

Adds a constraint to this vertex.

binding must contain only elements of x() as variables.

Exceptions
std::exceptionif binding.variables() is not a subset of x().
std::exceptionif ambient_dimension() == 0.

◆ AddCost() [1/2]

Adds a cost to this vertex, described by a symbolic::Expression e containing only elements of x() as variables.

For technical reasons relating to being able to "turn-off" the cost on inactive vertices, all costs are eventually implemented with a slack variable and a constraint:

min g(x) ⇒ min ℓ, s.t. ℓ ≥ g(x)
Note
Linear costs lead to negative costs if decision variables are not properly constrained. Users may want to check that the solution does not contain negative costs.
Returns
the pair <ℓ, g(x)>.
Exceptions
std::exceptionif e.GetVariables() is not a subset of x().

◆ AddCost() [2/2]

std::pair<symbolic::Variable, solvers::Binding<solvers::Cost> > AddCost ( const solvers::Binding< solvers::Cost > &  binding)

Adds a cost to this vertex.

binding must contain only elements of x() as variables. For technical reasons relating to being able to "turn-off" the cost on inactive vertices, all costs are eventually implemented with a slack variable and a constraint:

min g(x) ⇒ min ℓ, s.t. ℓ ≥ g(x)
Note
Linear costs lead to negative costs if decision variables are not properly constrained. Users may want to check that the solution does not contain negative costs.
Returns
the pair <ℓ, g(x)>.
Exceptions
std::exceptionif binding.variables() is not a subset of x().

◆ ambient_dimension()

int ambient_dimension ( ) const

Returns the ambient dimension of the ConvexSet.

◆ GetConstraints()

const std::vector<solvers::Binding<solvers::Constraint> >& GetConstraints ( ) const

Returns all constraints on this vertex.

◆ GetCosts()

const std::vector<solvers::Binding<solvers::Cost> >& GetCosts ( ) const

Returns all costs on this vertex.

◆ GetSolution()

Eigen::VectorXd GetSolution ( const solvers::MathematicalProgramResult result) const

Returns the solution of x() in a MathematicalProgramResult.

This solution is NaN if the vertex is not in the shortest path (or if we are solving the the convex relaxation and the total flow through this vertex at the solution is numerically close to zero). We prefer to return NaN than a value not contained in set().

◆ GetSolutionCost()

double GetSolutionCost ( const solvers::MathematicalProgramResult result) const

Returns the sum of the costs associated with this vertex in a solvers::MathematicalProgramResult.

◆ id()

VertexId id ( ) const

Returns the unique identifier associated with this Vertex.

◆ incoming_edges()

const std::vector<Edge*>& incoming_edges ( ) const

◆ name()

const std::string& name ( ) const

Returns the name of the vertex.

◆ operator=() [1/2]

Vertex& operator= ( Vertex &&  )
delete

◆ operator=() [2/2]

Vertex& operator= ( const Vertex )
delete

◆ outgoing_edges()

const std::vector<Edge*>& outgoing_edges ( ) const

◆ set()

const ConvexSet& set ( ) const

Returns a const reference to the underlying ConvexSet.

◆ x()

const VectorX<symbolic::Variable>& x ( ) const

Returns a decision variable corresponding to an element of the ConvexSet, which can be used for constructing symbolic::Expression costs and constraints.

Friends And Related Function Documentation

◆ GraphOfConvexSets

friend class GraphOfConvexSets
friend

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