ompl::geometric::BITstar::Vertex Class Reference

The vertex of the underlying graphs in BIT*. More...

#include <ompl/geometric/planners/bitstar/datastructures/Vertex.h>

Public Member Functions

 Vertex (ompl::base::SpaceInformationPtr si, ompl::base::OptimizationObjectivePtr opt, bool root=false)
 Constructor.
 
 ~Vertex ()
 Destructor.
 
BITstar::VertexId getId () const
 The (unique) vertex ID.
 
ompl::base::State const * stateConst () const
 The state of a vertex as a constant pointer.
 
ompl::base::Statestate ()
 The state of a vertex as a mutable pointer.
 
bool isRoot () const
 Whether the vertex is root.
 
bool hasParent () const
 Get whether this vertex has a parent.
 
bool isInTree () const
 Get whether a vertex is "in the graph" or not. This returns true if the vertex is the graph root or is connected to a parent.
 
unsigned int getDepth () const
 Get the "depth" of the vertex from the root. A root vertex is at depth 0, a direct descendent of the root 1, etc.
 
VertexConstPtr getParentConst () const
 Get the parent of a vertex as a constant pointer.
 
VertexPtr getParent ()
 Get the parent of a vertex as a mutable pointer.
 
void addParent (const VertexPtr &newParent, const ompl::base::Cost &edgeInCost, bool updateChildCosts=true)
 Set the parent of a vertex, cannot be used to replace a previous parent. Will update this vertex's cost, and can update descendent costs.
 
void removeParent (bool updateChildCosts=true)
 Remove the parent edge. Will update this vertex's cost, and can update the descendent costs.
 
bool hasChildren () const
 Get whether this vertex has any children.
 
void getChildrenConst (VertexConstPtrVector *children) const
 Get the children of a vertex as constant pointers.
 
void getChildren (VertexPtrVector *children)
 Get the children of a vertex as mutable pointers.
 
void addChild (const VertexPtr &newChild, bool updateChildCosts=true)
 Add a child vertex. Does not change this vertex's cost, and can update the child and its descendent costs.
 
void removeChild (const VertexPtr &oldChild, bool updateChildCosts=true)
 Remove a child vertex. Does not change this vertex's cost, and can update the child and its descendent costs. Will throw an exception if the given vertex pointer is not in the vector of children.
 
ompl::base::Cost getCost () const
 Get the cost-to-come of a vertex. Return infinity if the edge is disconnected.
 
ompl::base::Cost getEdgeInCost () const
 Get the incremental cost-to-come of a vertex.
 
bool isNew () const
 Returns true if the vertex is marked as new. Vertices are new until marked old.
 
void markNew ()
 Mark the vertex as new.
 
void markOld ()
 Mark the vertex as old.
 
bool hasBeenExpandedToSamples () const
 Returns true if the vertex has been expanded towards samples.
 
void markExpandedToSamples ()
 Mark the vertex as expanded towards samples.
 
void markUnexpandedToSamples ()
 Mark the vertex as not expanded towards samples.
 
bool hasBeenExpandedToVertices () const
 Returns true if the vertex has been expanded towards vertices.
 
void markExpandedToVertices ()
 Mark the vertex as expanded towards vertices.
 
void markUnexpandedToVertices ()
 Mark the vertex as not expanded towards vertices.
 
bool isPruned () const
 Whether the vertex has been pruned.
 
void markPruned ()
 Mark the vertex as pruned.
 
void markUnpruned ()
 Mark the vertex as unpruned.
 

Protected Member Functions

void updateCostAndDepth (bool cascadeUpdates=true)
 Calculates the updated cost and depth of the current state, as well as calling all children's updateCostAndDepth() functions and thus updating everything down-stream (if desired).
 

Detailed Description

The vertex of the underlying graphs in BIT*.

Short description
A class to store a state as a vertex in a (tree) graph. Allocates and frees it's own memory on construction/destruction. Parent vertices are owned by their children as shared pointers, assuring that a parent vertex will not be deleted while the child exists. Child vertices are owned by their parents as weak pointers, assuring that the shared-pointer ownership loop is broken.
Note
Add/Remove functions should almost always update their children's cost. The only known exception is when a series of operations are being performed and it would be beneficial to delay the update until the last operation. In this case, make sure that the last call updates the children and is on the highest ancestor that has been changed. Updates only flow downstream.

Definition at line 79 of file Vertex.h.


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