Parasol Planning Library (PPL)
|
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <memory>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>
Go to the source code of this file.
Data Structures | |
struct | SSSPOutput< GraphType > |
The output of an SSSP run. More... | |
struct | TwoVariableSSSPNode |
Typedefs | |
template<typename GraphType > | |
using | SSSPAdjacencyMap = std::unordered_map< typename GraphType::vertex_descriptor, std::vector< typename GraphType::vertex_descriptor > > |
template<typename GraphType > | |
using | SSSPTerminationCriterion = std::function< SSSPTermination(typename GraphType::vertex_iterator &, const SSSPOutput< GraphType > &_sssp)> |
template<typename GraphType > | |
using | SSSPPathWeightFunction = std::function< double(typename GraphType::adj_edge_iterator &, const double, const double)> |
template<typename GraphType > | |
using | SSSPHeuristicFunction = std::function< double(const GraphType *g, typename GraphType::vertex_descriptor source, typename GraphType::vertex_descriptor target)> |
template<typename GraphType > | |
using | SSSPNeighborsFunction = std::function< void(GraphType *g, typename GraphType::vertex_descriptor vd)> |
Enumerations | |
enum class | SSSPTermination { Continue , EndBranch , EndSearch } |
The possible early-termination conditions for an SSSP run. More... | |
Functions | |
std::ostream & | operator<< (std::ostream &_os, const SSSPTermination &_t) |
Debug output for termination criteria. More... | |
template<typename GraphType > | |
SSSPTerminationCriterion< GraphType > | SSSPDefaultTermination () |
template<typename GraphType > | |
SSSPPathWeightFunction< GraphType > | SSSPDefaultPathWeight () |
template<typename GraphType > | |
SSSPHeuristicFunction< GraphType > | SSSPDefaultHeuristic () |
template<typename GraphType > | |
SSSPNeighborsFunction< GraphType > | SSSPDefaultNeighbors () |
template<typename GraphType > | |
SSSPOutput< GraphType > | AStarSSSP (GraphType *const _g, const std::vector< typename GraphType::vertex_descriptor > &_starts, std::vector< typename GraphType::vertex_descriptor > &_goals, SSSPPathWeightFunction< GraphType > &_weight, SSSPHeuristicFunction< GraphType > &_heuristic, SSSPNeighborsFunction< GraphType > &_neighbors, SSSPTerminationCriterion< GraphType > &_earlyStop, const double _startDistance=0) |
template<typename GraphType > | |
SSSPOutput< GraphType > | AStarSSSP (GraphType *const _g, const std::vector< typename GraphType::vertex_descriptor > &_starts, std::vector< typename GraphType::vertex_descriptor > &_goals, SSSPPathWeightFunction< GraphType > &_weight, SSSPTerminationCriterion< GraphType > &_earlyStop) |
template<typename GraphType > | |
SSSPOutput< GraphType > | DijkstraSSSP (GraphType *const _g, const std::vector< typename GraphType::vertex_descriptor > &_starts, SSSPPathWeightFunction< GraphType > &_weight, SSSPTerminationCriterion< GraphType > &_earlyStop, const SSSPAdjacencyMap< GraphType > &_adjacencyMap={}, const double _startDistance=0) |
template<typename GraphType > | |
SSSPOutput< GraphType > | DijkstraSSSP (GraphType *const _g, const std::vector< typename GraphType::vertex_descriptor > &_starts, SSSPPathWeightFunction< GraphType > &_weight, const SSSPAdjacencyMap< GraphType > &_adjacencyMap={}) |
template<typename GraphType > | |
SSSPOutput< GraphType > | DijkstraSSSP (GraphType *const _g, const std::vector< typename GraphType::vertex_descriptor > &_starts, SSSPTerminationCriterion< GraphType > &_stop, const SSSPAdjacencyMap< GraphType > &_adjacencyMap={}) |
template<typename GraphType > | |
SSSPOutput< GraphType > | DijkstraSSSP (GraphType *const _g, const std::vector< typename GraphType::vertex_descriptor > &_starts, const SSSPAdjacencyMap< GraphType > &_adjacencyMap={}) |
template<typename GraphType > | |
std::shared_ptr< TwoVariableSSSPNode > | TwoVariableDijkstraSSSP (GraphType *const _g, const std::vector< typename GraphType::vertex_descriptor > &_starts, std::unordered_set< size_t > _goals, const double _startTime, const double _minEndTime, const double _lastConstraint, const double _lastGoalConstraint, SSSPPathWeightFunction< GraphType > &_weight) |
using SSSPAdjacencyMap = std::unordered_map<typename GraphType::vertex_descriptor, std::vector<typename GraphType::vertex_descriptor> > |
A descriptor-based adjacency map. Can model alternative adjacency mappings and successors from an SSSP run.
using SSSPHeuristicFunction = std::function<double( const GraphType* g, typename GraphType::vertex_descriptor source, typename GraphType::vertex_descriptor target)> |
Define heuristic function for SSSP. This takes the graph, source node and target node. It should return a value representing some estimate of the cost left to finish the search.
using SSSPNeighborsFunction = std::function<void( GraphType* g, typename GraphType::vertex_descriptor vd)> |
Define neighbors function for SSSP. This takes in the graph and the current node to get the neighbors of. This should return a vertex iterator of the neighbors.
using SSSPPathWeightFunction = std::function<double(typename GraphType::adj_edge_iterator&, const double, const double)> |
Define a path weight function for SSSP. This takes an edge iterator and the best path distances to the source and target nodes found so far. It should return the new target path distance that would be achieved by using this edge instead of the previous best. Use infinity to represent an untraversable edge or max double to represent a worst-case (but still traversable) edge.
using SSSPTerminationCriterion = std::function<SSSPTermination(typename GraphType::vertex_iterator&, const SSSPOutput<GraphType>& _sssp)> |
Define an early termination criterion as a function which takes a vertex iterator and the current output object.
|
strong |
SSSPOutput<GraphType> AStarSSSP | ( | GraphType *const | _g, |
const std::vector< typename GraphType::vertex_descriptor > & | _starts, | ||
std::vector< typename GraphType::vertex_descriptor > & | _goals, | ||
SSSPPathWeightFunction< GraphType > & | _weight, | ||
SSSPHeuristicFunction< GraphType > & | _heuristic, | ||
SSSPNeighborsFunction< GraphType > & | _neighbors, | ||
SSSPTerminationCriterion< GraphType > & | _earlyStop, | ||
const double | _startDistance = 0 |
||
) |
Compute the SSSP through a graph from a start node to a goal node with A* algorithm
_g | The graph pointer. |
_starts | The vertex descriptors to start from. |
_goals | The vertex descriptors to find shortest path to. |
_weight | The function for determining total path weight. |
_heuristic | The function for determining heuristic cost. |
_neighbors | The function for getting neighbors of a given node. |
An element in the priority queue for A*, representing one instance of discovering a cell. Cells may be discovered multiple times from different, parents with different distances.
< The parent cell descriptor.
< This cell descriptor.
< Computed distance to this cell at time of insertion.
< Computed heuristic at time of insertion.
Construct an element for the search queue.
_parent | The parent node descriptor. |
_target | The target node descriptor. |
_g | The distance from starting node to this node. |
_h | The heuristic value for this node. |
Total ordering by decreasing f = g + h
SSSPOutput<GraphType> AStarSSSP | ( | GraphType *const | _g, |
const std::vector< typename GraphType::vertex_descriptor > & | _starts, | ||
std::vector< typename GraphType::vertex_descriptor > & | _goals, | ||
SSSPPathWeightFunction< GraphType > & | _weight, | ||
SSSPTerminationCriterion< GraphType > & | _earlyStop | ||
) |
Compute the SSSP through a graph from a start node to a goal node with A* algorithm
_g | The graph pointer. |
_starts | The vertex descriptors to start from. |
_goals | The vertex descriptors to find shortest path to. |
_weight | The function for determining total path weight. |
_heuristic | The function for determining heuristic cost. |
_neighbors | The function for getting neighbors of a given node. |
SSSPOutput<GraphType> DijkstraSSSP | ( | GraphType *const | _g, |
const std::vector< typename GraphType::vertex_descriptor > & | _starts, | ||
const SSSPAdjacencyMap< GraphType > & | _adjacencyMap = {} |
||
) |
Compute the SSSP through a graph from a start node with Dijkstra's algorithm. Use the standard path weight and termination criterion.
_g | The graph pointer. |
_starts | The vertex descriptors to start from. |
SSSPOutput<GraphType> DijkstraSSSP | ( | GraphType *const | _g, |
const std::vector< typename GraphType::vertex_descriptor > & | _starts, | ||
SSSPPathWeightFunction< GraphType > & | _weight, | ||
const SSSPAdjacencyMap< GraphType > & | _adjacencyMap = {} |
||
) |
Compute the SSSP through a graph from a start node with Dijkstra's algorithm. Use the standard termination criterion.
_g | The graph pointer. |
_starts | The vertex descriptors to start from. |
_weight | The function for determining total path weight. |
SSSPOutput<GraphType> DijkstraSSSP | ( | GraphType *const | _g, |
const std::vector< typename GraphType::vertex_descriptor > & | _starts, | ||
SSSPPathWeightFunction< GraphType > & | _weight, | ||
SSSPTerminationCriterion< GraphType > & | _earlyStop, | ||
const SSSPAdjacencyMap< GraphType > & | _adjacencyMap = {} , |
||
const double | _startDistance = 0 |
||
) |
Compute the SSSP through a graph from a start node with Dijkstra's algorithm.
_g | The graph pointer. |
_starts | The vertex descriptors to start from. |
_weight | The function for determining total path weight. |
_earlyStop | The early termination criterion. |
An element in the PQ for dijkstra's, representing one instance of discovering a cell. Cells may be discovered multiple times from different parents with different distances.
< The parent cell descriptor.
< This cell descriptor.
< Computed distance at the time of insertion.
Construct an element for the search queue.
_parent | The parent node descriptor. |
_target | The target node descriptor. |
_distance | The distance from parent to target. |
Total ordering by decreasing distance.
SSSPOutput<GraphType> DijkstraSSSP | ( | GraphType *const | _g, |
const std::vector< typename GraphType::vertex_descriptor > & | _starts, | ||
SSSPTerminationCriterion< GraphType > & | _stop, | ||
const SSSPAdjacencyMap< GraphType > & | _adjacencyMap = {} |
||
) |
Compute the SSSP through a graph from a start node with Dijkstra's algorithm. Use the standard path weight.
_g | The graph pointer. |
_starts | The vertex descriptors to start from. |
_stop | The termination criterion. |
std::ostream& operator<< | ( | std::ostream & | _os, |
const SSSPTermination & | _t | ||
) |
Debug output for termination criteria.
SSSPHeuristicFunction<GraphType> SSSPDefaultHeuristic | ( | ) |
Create a standard SSSP heuristic function.
SSSPNeighborsFunction<GraphType> SSSPDefaultNeighbors | ( | ) |
Create a standard SSSP neighbors function.
SSSPPathWeightFunction<GraphType> SSSPDefaultPathWeight | ( | ) |
Create a standard SSSP weight function.
SSSPTerminationCriterion<GraphType> SSSPDefaultTermination | ( | ) |
Create a standard SSSP stop criterion.
std::shared_ptr<TwoVariableSSSPNode> TwoVariableDijkstraSSSP | ( | GraphType *const | _g, |
const std::vector< typename GraphType::vertex_descriptor > & | _starts, | ||
std::unordered_set< size_t > | _goals, | ||
const double | _startTime, | ||
const double | _minEndTime, | ||
const double | _lastConstraint, | ||
const double | _lastGoalConstraint, | ||
SSSPPathWeightFunction< GraphType > & | _weight | ||
) |