HOG2
AStar3.h
Go to the documentation of this file.
1 /*
2  * $Id: aStar3.h
3  * hog2
4  *
5  * Created by Nathan Sturtevant on 9/29/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 ASTAROld_H
13 #define ASTAROld_H
14 
15 #include "SearchAlgorithm.h"
16 #include "Heap.h"
17 
18 // this is a "classic" implementation of A*
19 // it is not particularly optimized, it is more of an example of how an
20 // algorithm can be coded in this framework
21 
26 class aStarOld : public SearchAlgorithm {
27 
28 public:
29  aStarOld(double _w = 1.0, bool _doPathDraw = true);
30  path *GetPath(GraphAbstraction *aMap, node *from, node *to, reservationProvider *rp = 0);
31  virtual const char *GetName() { return aStarName; }
32  void drawPath(bool _doPathDraw) { doPathDraw = _doPathDraw; }
33 
34 private:
35  void relaxEdge(Heap *nodeHeap, Graph *g, edge *e, int source, int nextNode, node *to);
36  path *extractBestPath(Graph *g, unsigned int current);
38  double wh;
39  char aStarName[128];
40  bool doPathDraw;
41 };
42 
43 #endif
GraphAbstraction
A generic class for basic operations on Graph abstractions.
Definition: GraphAbstraction.h:63
aStarOld::extractBestPath
path * extractBestPath(Graph *g, unsigned int current)
Definition: AStar3.cpp:137
aStarOld::GetPath
path * GetPath(GraphAbstraction *aMap, node *from, node *to, reservationProvider *rp=0)
Definition: AStar3.cpp:35
Heap.h
aStarOld::map
GraphAbstraction * map
Definition: AStar3.h:37
SearchAlgorithm.h
aStarOld::wh
double wh
Definition: AStar3.h:38
aStarOld::doPathDraw
bool doPathDraw
Definition: AStar3.h:40
aStarOld
A sample A* implementation.
Definition: AStar3.h:26
Graph
A generic Graph class.
Definition: Graph.h:66
aStarOld::relaxEdge
void relaxEdge(Heap *nodeHeap, Graph *g, edge *e, int source, int nextNode, node *to)
Definition: AStar3.cpp:120
aStarOld::GetName
virtual const char * GetName()
Definition: AStar3.h:31
aStarOld::aStarName
char aStarName[128]
Definition: AStar3.h:39
aStarOld::aStarOld
aStarOld(double _w=1.0, bool _doPathDraw=true)
Definition: AStar3.cpp:21
Heap
A simple & efficient Heap class which uses Graph objects.
Definition: Heap.h:27
reservationProvider
Definition: ReservationProvider.h:33
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
aStarOld::drawPath
void drawPath(bool _doPathDraw)
Definition: AStar3.h:32
node
Nodes to be stored within a Graph.
Definition: Graph.h:170
edge
Edge class for connections between node in a Graph.
Definition: Graph.h:129