Parasol Planning Library (PPL)
Data Structures | Macros | Functions
GenericStateGraph.h File Reference
#include "MPProblem/Environment/Environment.h"
#include "Utilities/PMPLExceptions.h"
#include "Utilities/RuntimeUtils.h"
#include <containers/sequential/graph/graph.h>
#include <containers/sequential/graph/graph_util.h>
#include <containers/sequential/graph/vertex_iterator_adaptor.h>
#include <containers/sequential/graph/algorithms/connected_components.h>
#include <containers/sequential/graph/algorithms/graph_input_output.h>
#include "Utilities/CCTracker.h"
#include <fstream>
#include <functional>
#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
Include dependency graph for GenericStateGraph.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  GenericStateGraph< Vertex, Edge >
 

Macros

#define INVALID_VID   (std::numeric_limits<size_t>::max())
 
#define INVALID_EID   (std::numeric_limits<size_t>::max())
 

Functions

template<typename GenericStateGraph >
void Read (GenericStateGraph *_g, const std::string &_filename)
 
template<typename GenericStateGraph >
void ReadMessage (GenericStateGraph *_g, const std::string &_msg)
 
std::unordered_set< size_t > VertexSetIntersection (const std::unordered_set< size_t > &_a, const std::unordered_set< size_t > &_b)
 
bool HaveCommonVertex (const std::unordered_set< size_t > &_a, const std::unordered_set< size_t > &_b)
 
std::unordered_set< size_t > & VertexSetUnionInPlace (std::unordered_set< size_t > &_receiver, const std::unordered_set< size_t > &_source)
 
template<typename T , typename... Rest>
const T & RandomElement (const std::unordered_set< T, Rest... > &_set) noexcept
 

Macro Definition Documentation

◆ INVALID_EID

#define INVALID_EID   (std::numeric_limits<size_t>::max())

◆ INVALID_VID

#define INVALID_VID   (std::numeric_limits<size_t>::max())

Function Documentation

◆ HaveCommonVertex()

bool HaveCommonVertex ( const std::unordered_set< size_t > &  _a,
const std::unordered_set< size_t > &  _b 
)
inline

Check if two vertex sets have any members in common.

Parameters
_aThe first set.
_bThe second set.
Returns
True if there are any vertices in both _a and _b.

◆ RandomElement()

template<typename T , typename... Rest>
const T& RandomElement ( const std::unordered_set< T, Rest... > &  _set)
inlinenoexcept

Select a random element from a vertex set (or other unordered set).

Parameters
_setThe set.
Returns
A random element from within.
Note
This is a two-stage random process that is far more efficient than simply std::advancing the begin iterator, which costs linear time. The solution here is to randomly select a bucket and then choose a random element within. This is linear in the bucket size (much smaller than the whole container).

◆ Read()

template<typename GenericStateGraph >
void Read ( GenericStateGraph _g,
const std::string &  _filename 
)

Read in a roadmap (.map) file.

Parameters
_gThe graph to populate from the map file.
_filenameThe name of the map file to read.
Note
This is a non-member to avoid problems with explicit instantiation of this function for robot groups. It should be returned to a member function when we have an elegant means for implementing group roadmap input.

@TODO this is a bad way to handle the fact that it's necessary to know the robot type (non/holonomic) when reading and writing.

◆ ReadMessage()

template<typename GenericStateGraph >
void ReadMessage ( GenericStateGraph _g,
const std::string &  _msg 
)

Read in a message.

Parameters
_gThe graph to populate from the message.
_msgThe message containing the graph.
Note
This is a non-member to avoid problems with explicit instantiation of this function for robot groups. It should be returned to a member function when we have an elegant means for implementing group roadmap input.

@TODO this is a bad way to handle the fact that it's necessary to know the robot type (non/holonomic) when reading and writing.

◆ VertexSetIntersection()

std::unordered_set<size_t> VertexSetIntersection ( const std::unordered_set< size_t > &  _a,
const std::unordered_set< size_t > &  _b 
)
inline

Find the intersection of two vertex sets.

Parameters
_aThe first set.
_bThe second set.
Returns
The intersection of _a and _b.

◆ VertexSetUnionInPlace()

std::unordered_set<size_t>& VertexSetUnionInPlace ( std::unordered_set< size_t > &  _receiver,
const std::unordered_set< size_t > &  _source 
)
inline

Merge one vertex set into another.

Parameters
_receiverThe vertex set receiving new VIDs.
_sourceThe source of the new VIDs.
Returns
A reference to _receiver.