HOG2
PRAStar.h
Go to the documentation of this file.
1 /*
2  * $Id: praStar.h
3  * hog2
4  *
5  * Created by Nathan Sturtevant on 9/28/04.
6  * Modified by Nathan Sturtevant on 02/29/20.
7  *
8  * This file is part of HOG2. See https://github.com/nathansttt/hog2 for licensing information.
9  *
10  */
11 
12 #ifndef PRASTAR_H
13 #define PRASTAR_H
14 
15 #include <iostream>
16 #include "SearchAlgorithm.h"
17 #include "Heap.h"
18 
23 class praStar : public SearchAlgorithm {
24 
25 public:
26  praStar();
27  virtual ~praStar() {}
28  virtual path *GetPath(GraphAbstraction *aMap, node *from, node *to, reservationProvider *rp = 0);
29  virtual const char *GetName() { return algName; }
30  void setPartialPathLimit(int limit) { partialLimit = limit;
31  sprintf(algName,"PRA*(%d)",partialLimit); }
33  void setPlanFromMiddle(bool _planFromMiddle) { planFromMiddle = _planFromMiddle; }
34  void setExpandSearchRadius(bool _expandSearchRadius) { expandSearchRadius = _expandSearchRadius; }
35  void setUseSmoothing(bool _smoothing) { smoothing = _smoothing; }
36  void setCache(path **p);
38  void setFixedPlanLevel(int p) { fixedPlanLevel = p; }
39  void getAbstractPathLengths(std::vector<int> &len) { len = lengths; }
40 protected:
41 
42  path *getAbstractPath(Graph *g, unsigned int source, unsigned int destParent,
43  std::vector<unsigned int> &eligibleNodeParents, int LABEL,
44  unsigned int dest);
45 
46  unsigned int astar(Graph *g, unsigned int source, unsigned int destParent,
47  std::vector<unsigned int> &eligibleNodeParents, int LABEL,
48  unsigned int dest);
49 
50  void relaxEdge(Heap *nodeHeap, Graph *g, edge *e, int source, int nextNode, int dest,
51  int LABEL);
52  path *smoothPath(path *p);
53 
57  char algName[30];
61  bool smoothing;
63  std::vector<int> lengths;
64 };
65 
66 
67 #endif
GraphAbstraction
A generic class for basic operations on Graph abstractions.
Definition: GraphAbstraction.h:63
Heap.h
praStar::praStar
praStar()
Definition: PRAStar.cpp:18
SearchAlgorithm.h
praStar::algName
char algName[30]
Definition: PRAStar.h:57
Graph
A generic Graph class.
Definition: Graph.h:66
praStar::setCache
void setCache(path **p)
Definition: PRAStar.cpp:28
praStar::planFromMiddle
bool planFromMiddle
Definition: PRAStar.h:60
praStar::astar
unsigned int astar(Graph *g, unsigned int source, unsigned int destParent, std::vector< unsigned int > &eligibleNodeParents, int LABEL, unsigned int dest)
Definition: PRAStar.cpp:275
praStar::cache
path ** cache
Definition: PRAStar.h:54
praStar::GetPath
virtual path * GetPath(GraphAbstraction *aMap, node *from, node *to, reservationProvider *rp=0)
Definition: PRAStar.cpp:33
praStar::getAbstractPath
path * getAbstractPath(Graph *g, unsigned int source, unsigned int destParent, std::vector< unsigned int > &eligibleNodeParents, int LABEL, unsigned int dest)
Definition: PRAStar.cpp:234
praStar::rp
reservationProvider * rp
Definition: PRAStar.h:62
praStar::fixedPlanLevel
int fixedPlanLevel
Definition: PRAStar.h:56
praStar::lengths
std::vector< int > lengths
Definition: PRAStar.h:63
praStar::getPartialPathLimit
int getPartialPathLimit()
Definition: PRAStar.h:32
praStar::setPlanFromMiddle
void setPlanFromMiddle(bool _planFromMiddle)
Definition: PRAStar.h:33
praStar::relaxEdge
void relaxEdge(Heap *nodeHeap, Graph *g, edge *e, int source, int nextNode, int dest, int LABEL)
Definition: PRAStar.cpp:421
praStar::smoothPath
path * smoothPath(path *p)
Definition: PRAStar.cpp:267
praStar::setFixedPlanLevel
void setFixedPlanLevel(int p)
Set a fixed level for abstraction in planning.
Definition: PRAStar.h:38
praStar::GetName
virtual const char * GetName()
Definition: PRAStar.h:29
praStar::getAbstractPathLengths
void getAbstractPathLengths(std::vector< int > &len)
Definition: PRAStar.h:39
praStar::smoothing
bool smoothing
Definition: PRAStar.h:61
praStar::setUseSmoothing
void setUseSmoothing(bool _smoothing)
Definition: PRAStar.h:35
praStar::~praStar
virtual ~praStar()
Definition: PRAStar.h:27
Heap
A simple & efficient Heap class which uses Graph objects.
Definition: Heap.h:27
reservationProvider
Definition: ReservationProvider.h:33
praStar
The pra* search algorithm which does partial pathfinding using abstraction.
Definition: PRAStar.h:23
SearchAlgorithm
A generic algorithm which can be used for pathfinding.
Definition: SearchAlgorithm.h:25
path
A linked list of nodes which form a continuous path.
Definition: Path.h:20
praStar::setPartialPathLimit
void setPartialPathLimit(int limit)
Definition: PRAStar.h:30
praStar::map
GraphAbstraction * map
Definition: PRAStar.h:58
praStar::partialLimit
int partialLimit
Definition: PRAStar.h:55
node
Nodes to be stored within a Graph.
Definition: Graph.h:170
praStar::setExpandSearchRadius
void setExpandSearchRadius(bool _expandSearchRadius)
Definition: PRAStar.h:34
praStar::expandSearchRadius
bool expandSearchRadius
Definition: PRAStar.h:59
edge
Edge class for connections between node in a Graph.
Definition: Graph.h:129