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 ConvexSet & | set () 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::Constraint > | AddConstraint (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::Constraint > | AddConstraint (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 | |
Vertex & | operator= (const Vertex &)=delete |
Vertex (Vertex &&)=delete | |
Vertex & | operator= (Vertex &&)=delete |
Friends | |
class | GraphOfConvexSets |
~Vertex | ( | ) |
solvers::Binding<solvers::Constraint> AddConstraint | ( | const symbolic::Formula & | f | ) |
Adds a constraint to this vertex, described by a symbolic::Formula f
containing only elements of x() as variables.
std::exception | if f.GetFreeVariables() is not a subset of x(). |
std::exception | if ambient_dimension() == 0. |
solvers::Binding<solvers::Constraint> AddConstraint | ( | const solvers::Binding< solvers::Constraint > & | binding | ) |
Adds a constraint to this vertex.
binding
must contain only elements of x() as variables.
std::exception | if binding.variables() is not a subset of x(). |
std::exception | if ambient_dimension() == 0. |
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.
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)
std::exception | if e.GetVariables() is not a subset of x(). |
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)
std::exception | if binding.variables() is not a subset of x(). |
const std::vector<solvers::Binding<solvers::Constraint> >& GetConstraints | ( | ) | const |
Returns all constraints on this vertex.
const std::vector<solvers::Binding<solvers::Cost> >& GetCosts | ( | ) | const |
Returns all costs on this vertex.
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().
double GetSolutionCost | ( | const solvers::MathematicalProgramResult & | result | ) | const |
Returns the sum of the costs associated with this vertex in a solvers::MathematicalProgramResult.
const std::vector<Edge*>& incoming_edges | ( | ) | const |
const std::string& name | ( | ) | const |
Returns the name of the vertex.
const std::vector<Edge*>& outgoing_edges | ( | ) | const |
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.
|
friend |