HOG2
SearchAlgorithm.h
Go to the documentation of this file.
1 /*
2  * $Id: SearchAlgorithm.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 SEARCHALGORITHM_H
13 #define SEARCHALGORITHM_H
14 
15 #include "Graph.h"
16 #include "Path.h"
17 #include "MapAbstraction.h"
18 #include "UnitSimulation.h"
19 #include "ReservationProvider.h"
20 
26 public:
28  virtual ~SearchAlgorithm() {}
29  virtual const char *GetName() = 0;
30  virtual path *GetPath(GraphAbstraction *aMap, node *from, node *to, reservationProvider *rp = 0) = 0;
31  uint64_t GetNodesExpanded() { return nodesExpanded; }
32  uint64_t GetNodesTouched() { return nodesTouched; }
33  virtual void LogFinalStats(StatCollection *) {}
34 
35  //protected:
36  uint32_t nodesExpanded;
37  uint32_t nodesTouched;
38 };
39 
40 extern void DoRandomPath(GraphAbstraction *aMap, SearchAlgorithm *sa, bool repeat = false);
41 
42 #endif
GraphAbstraction
A generic class for basic operations on Graph abstractions.
Definition: GraphAbstraction.h:63
UnitSimulation.h
SearchAlgorithm::LogFinalStats
virtual void LogFinalStats(StatCollection *)
Definition: SearchAlgorithm.h:33
Graph.h
SearchAlgorithm::GetNodesTouched
uint64_t GetNodesTouched()
Definition: SearchAlgorithm.h:32
Path.h
SearchAlgorithm::GetNodesExpanded
uint64_t GetNodesExpanded()
Definition: SearchAlgorithm.h:31
SearchAlgorithm::nodesTouched
uint32_t nodesTouched
Definition: SearchAlgorithm.h:37
SearchAlgorithm::GetName
virtual const char * GetName()=0
SearchAlgorithm::nodesExpanded
uint32_t nodesExpanded
Definition: SearchAlgorithm.h:36
SearchAlgorithm::GetPath
virtual path * GetPath(GraphAbstraction *aMap, node *from, node *to, reservationProvider *rp=0)=0
StatCollection
The StatCollection class is for collecting stats across different parts of the simulation.
Definition: StatCollection.h:34
DoRandomPath
void DoRandomPath(GraphAbstraction *aMap, SearchAlgorithm *sa, bool repeat=false)
Definition: SearchAlgorithm.cpp:26
ReservationProvider.h
MapAbstraction.h
reservationProvider
Definition: ReservationProvider.h:33
SearchAlgorithm
A generic algorithm which can be used for pathfinding.
Definition: SearchAlgorithm.h:25
SearchAlgorithm::~SearchAlgorithm
virtual ~SearchAlgorithm()
Definition: SearchAlgorithm.h:28
SearchAlgorithm::SearchAlgorithm
SearchAlgorithm()
Definition: SearchAlgorithm.h:27
path
A linked list of nodes which form a continuous path.
Definition: Path.h:20
node
Nodes to be stored within a Graph.
Definition: Graph.h:170