HOG2
FringeSearch.h
Go to the documentation of this file.
1 /*
2  * FringeSearch.h
3  * hog
4  *
5  * Created by Nathan Sturtevant on 1/19/07.
6  * Copyright 2007 __MyCompanyName__. All rights reserved.
7  *
8  */
9 
10 #include "SearchAlgorithm.h"
11 
12 #ifndef FRINGESEARCH_H
13 #define FRINGESEARCH_H
14 
15 struct costs
16 {
17  node *n;
18  double gCost, hCost;
19 };
20 
21 typedef std::vector<node *> nodeList;
22 typedef std::vector<costs> costList;
23 
25 public:
26  virtual ~heuristicProvider() {}
27  virtual double h(uint32_t node1, uint32_t node2) = 0;
28 };
29 
30 class FringeSearch : public SearchAlgorithm {
31 public:
32  FringeSearch();
33  const char *GetName() { return bpmx?"BPMXFringeSearch":"FringeSearch"; }
34  virtual path *GetPath(GraphAbstraction *aMap, node *from, node *to, reservationProvider *rp = 0);
35  void setUseBPMX(bool use) { bpmx = use; }
37  unsigned int getNodesReopened() { return nodesReopened; }
38  unsigned int getHValuesPropagated() { return nodesHPropagated; }
39 private:
40  void initializeSearch(GraphAbstraction *aGraph, node *from, node *to);
41  bool onClosedList(node *n);
42  bool onOpenList(node *n);
43  void addToClosedList(node *n);
44  void addToOpenList(node *n);
45  void addToOpenList2(node *n);
46  void moveToOpenList1(node *n);
47  double getFCost(node *n);
48  double getGCost(node *n);
49  double getHCost(node *n);
50  double h(node *n1, node *n2);
51  void setHCost(node *n, double val);
52  void addCosts(node *n, node *parent, edge *e);
53  void getCosts(node *n, costs &val);
54  void updateCosts(node *n, node *parent, edge *e);
56  void checkIteration();
57  void propagateHValues(node *n, int dist = 10000);
58  void propagateGValues(node *n);
60  Graph *g;
69  bool bpmx;
70 };
71 
72 #endif
heuristicProvider::h
virtual double h(uint32_t node1, uint32_t node2)=0
FringeSearch::addToOpenList
void addToOpenList(node *n)
Definition: FringeSearch.cpp:120
GraphAbstraction
A generic class for basic operations on Graph abstractions.
Definition: GraphAbstraction.h:63
FringeSearch::FringeSearch
FringeSearch()
Definition: FringeSearch.cpp:20
FringeSearch::setHeuristicProvider
void setHeuristicProvider(heuristicProvider *hh)
Definition: FringeSearch.h:36
SearchAlgorithm.h
FringeSearch::propagateGValues
void propagateGValues(node *n)
Definition: FringeSearch.cpp:340
FringeSearch::initializeSearch
void initializeSearch(GraphAbstraction *aGraph, node *from, node *to)
Definition: FringeSearch.cpp:103
FringeSearch::getFCost
double getFCost(node *n)
Definition: FringeSearch.cpp:167
FringeSearch::nodesReopened
unsigned int nodesReopened
Definition: FringeSearch.h:68
FringeSearch::nextFLimit
double nextFLimit
Definition: FringeSearch.h:67
FringeSearch::g
Graph * g
Definition: FringeSearch.h:60
heuristicProvider::~heuristicProvider
virtual ~heuristicProvider()
Definition: FringeSearch.h:26
Graph
A generic Graph class.
Definition: Graph.h:66
FringeSearch::addToOpenList2
void addToOpenList2(node *n)
Definition: FringeSearch.cpp:139
costs::gCost
double gCost
Definition: FringeSearch.h:18
FringeSearch::GetName
const char * GetName()
Definition: FringeSearch.h:33
FringeSearch::getHCost
double getHCost(node *n)
Definition: FringeSearch.cpp:185
FringeSearch::closedList
nodeList closedList
Definition: FringeSearch.h:65
FringeSearch::addToClosedList
void addToClosedList(node *n)
Definition: FringeSearch.cpp:145
costList
std::vector< costs > costList
Definition: FringeSearch.h:22
FringeSearch::h
double h(node *n1, node *n2)
Definition: FringeSearch.cpp:366
costs
Definition: FringeSearch.h:15
FringeSearch::onOpenList
bool onOpenList(node *n)
Definition: FringeSearch.cpp:158
FringeSearch::GetPath
virtual path * GetPath(GraphAbstraction *aMap, node *from, node *to, reservationProvider *rp=0)
Definition: FringeSearch.cpp:29
FringeSearch::updateCosts
void updateCosts(node *n, node *parent, edge *e)
Definition: FringeSearch.cpp:255
FringeSearch::moveToOpenList1
void moveToOpenList1(node *n)
Definition: FringeSearch.cpp:126
FringeSearch::list1
nodeList list1
Definition: FringeSearch.h:63
FringeSearch::hp
heuristicProvider * hp
Definition: FringeSearch.h:62
FringeSearch::propagateHValues
void propagateHValues(node *n, int dist=10000)
Definition: FringeSearch.cpp:310
heuristicProvider
Definition: FringeSearch.h:24
FringeSearch::addCosts
void addCosts(node *n, node *parent, edge *e)
Definition: FringeSearch.cpp:218
FringeSearch::onClosedList
bool onClosedList(node *n)
Definition: FringeSearch.cpp:151
FringeSearch::getHValuesPropagated
unsigned int getHValuesPropagated()
Definition: FringeSearch.h:38
FringeSearch::extractBestPath
path * extractBestPath(node *n)
Definition: FringeSearch.cpp:270
FringeSearch::setUseBPMX
void setUseBPMX(bool use)
Definition: FringeSearch.h:35
FringeSearch::getNodesReopened
unsigned int getNodesReopened()
Definition: FringeSearch.h:37
FringeSearch::nodesHPropagated
unsigned int nodesHPropagated
Definition: FringeSearch.h:68
FringeSearch::setHCost
void setHCost(node *n, double val)
Definition: FringeSearch.cpp:194
FringeSearch::list2
nodeList list2
Definition: FringeSearch.h:63
FringeSearch::costTable
costList costTable
Definition: FringeSearch.h:66
FringeSearch
Definition: FringeSearch.h:30
FringeSearch::nextList
nodeList * nextList
Definition: FringeSearch.h:64
FringeSearch::aMap
GraphAbstraction * aMap
Definition: FringeSearch.h:61
FringeSearch::currList
nodeList * currList
Definition: FringeSearch.h:64
FringeSearch::getGCost
double getGCost(node *n)
Definition: FringeSearch.cpp:176
FringeSearch::getCosts
void getCosts(node *n, costs &val)
Definition: FringeSearch.cpp:206
reservationProvider
Definition: ReservationProvider.h:33
FringeSearch::goal
node * goal
Definition: FringeSearch.h:59
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
costs::hCost
double hCost
Definition: FringeSearch.h:18
FringeSearch::checkIteration
void checkIteration()
Definition: FringeSearch.cpp:294
FringeSearch::bpmx
bool bpmx
Definition: FringeSearch.h:69
costs::n
node * n
Definition: FringeSearch.h:17
nodeList
std::vector< node * > nodeList
Definition: FringeSearch.h:21
FringeSearch::currFLimit
double currFLimit
Definition: FringeSearch.h:67
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