HOG2
OldTemplateAStar.h
Go to the documentation of this file.
1 
29 #ifndef OldTemplateAStar_H
30 #define OldTemplateAStar_H
31 
32 #define __STDC_CONSTANT_MACROS
33 #include <stdint.h>
34 // this is defined in stdint.h, but it doesn't always get defined correctly
35 // even when __STDC_CONSTANT_MACROS is defined before including stdint.h
36 // because stdint might be included elsewhere first...
37 #ifndef UINT32_MAX
38 #define UINT32_MAX 4294967295U
39 #endif
40 
41 #include "FPUtil.h"
42 #include <unordered_map>
43 #include "OpenClosedList.h"
44 //#include "SearchEnvironment.h" // for the SearchEnvironment class
45 #include "float.h"
46 
47 #include <algorithm> // for vector reverse
48 
49 #include "GenericSearchAlgorithm.h"
50 
51 //int discardcount;
53 {
57  template <class state>
58  class SearchNode {
59  public:
60  SearchNode(state &curr, state &prev, double _fCost, double _gCost, uint64_t key)
61  :fCost(_fCost), gCost(_gCost), currNode(curr), prevNode(prev), hashKey(key){}
62 
63  SearchNode(state &curr, uint64_t key)
64  :fCost(0), gCost(0), currNode(curr), prevNode(curr), hashKey(key) {}
65 
66  // This probably needs to be fixed. Problem is you can't set the states to
67  // 0 - so how to initialize?
69  :fCost(0), gCost(0), hashKey(0) {}
70 
71  double fCost;
72  double gCost;
73  state currNode;
74  state prevNode;
75  uint64_t hashKey;
76  };
77 
78  template <class state>
79  struct SearchNodeEqual {
80  bool operator()(const SearchNode<state> &i1, const SearchNode<state> &i2) const
81  { return (i1.currNode == i2.currNode); } };
82 
83  template <class state>
85  bool operator()(const SearchNode<state> &i1, const SearchNode<state> &i2) const
86  {
87  if (fequal(i1.fCost, i2.fCost))
88  {
89  return (fless(i1.gCost, i2.gCost));
90  }
91  return (fgreater(i1.fCost, i2.fCost));
92  } };
93 
94  template <class state>
95  struct SearchNodeHash {
96  size_t operator()(const SearchNode<state> &x) const
97  { return (size_t)(x.hashKey); }
98  };
99 }
100 
101 
105 template <class state, class action, class environment>
106 class OldTemplateAStar : public GenericSearchAlgorithm<state,action,environment> {
107 public:
108  OldTemplateAStar() { env = 0; useBPMX = false; radius = 4.0; stopAfterGoal = true; weight=1; useRadius=false; useOccupancyInfo=false; radEnv = 0;}
109  virtual ~OldTemplateAStar() {}
110  void GetPath(environment *env, state& from, state& to, std::vector<state> &thePath);
111 
112  void GetPath(environment *, state& , state& , std::vector<action> & ) { assert(false); };
113 
116 
117  typedef std::unordered_map<uint64_t, OldOldTemplateAStarUtil::SearchNode<state>, Hash64 > NodeLookupTable;
118 
121  state goal, start;
122 
123  typedef typename NodeLookupTable::const_iterator closedList_iterator;
124 
125  bool InitializeSearch(environment *env, state& from, state& to, std::vector<state> &thePath);
126  bool DoSingleSearchStep(std::vector<state> &thePath);
127  void AddAdditionalStartState(state& newState);
128 
129  state CheckNextNode();
130  void ExtractPathToStart(state& n, std::vector<state> &thePath);
131  void DoAbstractSearch(){useOccupancyInfo = false; useRadius = false;}
132  virtual const char *GetName();
133 
134  void PrintStats();
135  //long GetNodesExpanded() { return nodesExpanded; }
136  //long GetNodesTouched() { return nodesTouched; }
138  int GetMemoryUsage();
139 
140  //closedList_iterator GetClosedListIter() const;
142  bool ClosedListIterNext(closedList_iterator& it, state& next) const;
143  bool GetClosedListGCost(state &val, double &gCost) const;
144 
145  void SetUseBPMX(bool use) { useBPMX = use; }
146  bool GetUsingBPMX() { return useBPMX; }
147 
148  //state ClosedListIterNext(closedList_iterator&) const;
149  uint64_t GetNodesExpanded() { return nodesExpanded; }
150  uint64_t GetNodesTouched() { return nodesTouched; }
151 
153 
154  void SetRadius(double rad) {radius = rad;}
155  double GetRadius() { return radius; }
156 
157  void SetRadiusEnvironment(environment *e) {radEnv = e;}
158 
159  void SetStopAfterGoal(bool val) { stopAfterGoal = val; }
160  bool GetStopAfterGoal() { return stopAfterGoal; }
161 
162  void OpenGLDraw() const;
163 
171  void SetWeight (double w){weight = w;}
172 private:
174  bool GetNextNode(state &next);
175  //state Node();
176  void UpdateClosedNode(environment *env, state& currOpenNode, state& neighbor);
177  void UpdateWeight(environment *env, state& currOpenNode, state& neighbor);
178  void AddToOpenList(environment *env, state& currOpenNode, state& neighbor);
179 
180  std::vector<state> neighbors;
181  environment *env;
183 
184  double radius; // how far around do we consider other agents?
185  double weight;
186 
187  bool useOccupancyInfo;// = false;
188  bool useRadius;// = false;
190  bool useBPMX;
191  environment *radEnv;
192 };
193 
194 using namespace OldOldTemplateAStarUtil;
195 static const bool verbose = false;
204 template <class state, class action, class environment>
206 {
207  static char name[32];
208  sprintf(name, "OldTemplateAStar[]");
209  return name;
210 }
211 
223 template <class state, class action, class environment>
224 void OldTemplateAStar<state,action,environment>::GetPath(environment *_env, state& from, state& to, std::vector<state> &thePath)
225 {
226  //discardcount=0;
227  if (!InitializeSearch(_env, from, to, thePath))
228  {
229  return;
230  }
231  while (!DoSingleSearchStep(thePath)) {}
232 }
233 
244 template <class state, class action, class environment>
245 bool OldTemplateAStar<state,action,environment>::InitializeSearch(environment *_env, state& from, state& to, std::vector<state> &thePath)
246 {
247  thePath.resize(0);
248  //if (useRadius)
249  //std::cout<<"Using radius\n";
250  firstRound = true;
251  env = _env;
252  if (!radEnv)
253  radEnv = _env;
254  closedList.clear();
255  openQueue.reset();
256  assert(openQueue.size() == 0);
257  assert(closedList.size() == 0);
258  nodesTouched = nodesExpanded = 0;
259  start = from;
260  goal = to;
261 
262  if ((from == to) && (stopAfterGoal)) //assumes that from and to are valid states
263  {
264  return false;
265  }
266 
267  //SearchNode<state> first(env->heuristic(goal, start), 0, start, start);
268  SearchNode<state> first(start, start, weight*env->HCost(start, goal), 0, env->GetStateHash(start));
269  openQueue.Add(first);
270 
271  return true;
272 }
273 
279 template <class state, class action, class environment>
281 {
282  SearchNode<state> first(newState, newState, weight*env->HCost(goal, newState), 0,env->GetStateHash(newState));
283  openQueue.Add(first);
284 }
285 
296 template <class state, class action, class environment>
298 {
299  state currentOpenNode;
300 
301  if (openQueue.size() == 0)
302  {
303  thePath.resize(0); // no path found!
304  //closedList.clear();
305  return true;
306  }
307 
308  // get top of queue
309  if (!GetNextNode(currentOpenNode))
310  {
311  printf("Oh no! No more open nodes!\n");
312  }
313  //env->OutputXY(currentOpenNode);
314  //std::cout<<std::endl;
315  if ((stopAfterGoal) && (env->GoalTest(currentOpenNode, goal)))
316  {
317  ExtractPathToStart(currentOpenNode, thePath);
318  // Path is backwards - reverse
319  reverse(thePath.begin(), thePath.end());
320  // closedList.clear();
321  // openQueue.reset();
322  // env = 0;
323  return true;
324  }
325 
326  neighbors.resize(0);
327  env->GetSuccessors(currentOpenNode, neighbors);
328 
329  if (useBPMX) // propagate best child to parent
330  {
331  SearchNode<state> currNode = closedList[env->GetStateHash(currentOpenNode)];
332  double oldf = currNode.fCost;
333  for (unsigned int x = 0; x < neighbors.size(); x++)
334  {
335  double newh = env->HCost(neighbors[x], goal)-env->GCost(currentOpenNode, neighbors[x]);
336  if (fgreater(newh, currNode.fCost-currNode.gCost))
337  currNode.fCost = currNode.gCost + newh;
338  }
339  // std::cout << "Updating parent (" << currNode.currNode << ") f-cost from " << oldf << " to " << currNode.fCost << std::endl;
340  closedList[env->GetStateHash(currentOpenNode)].fCost = currNode.fCost;
341  }
342  //printf("Expanding %d\n", currentOpenNode);
343 
344  // iterate over all the children
345  for (unsigned int x = 0; x < neighbors.size(); x++)
346  {
347  nodesTouched++;
348  state neighbor = neighbors[x];
349 
350  if (closedList.find(env->GetStateHash(neighbor)) != closedList.end())
351  {
352  //UpdateClosedNode(env, currentOpenNode, neighbor);
353  }
354  else if (openQueue.IsIn(SearchNode<state>(neighbor, env->GetStateHash(neighbor))))
355  {
356  UpdateWeight(env, currentOpenNode, neighbor);
357  }
358  else if (useRadius && useOccupancyInfo && env->GetOccupancyInfo() && radEnv && (radEnv->HCost(start, neighbor) < radius) &&(env->GetOccupancyInfo()->GetStateOccupied(neighbor)) && ((!(radEnv->GoalTest(neighbor, goal)))))// || (currentOpenNode == start )) )
359  {
360  SearchNode<state> sn(neighbor, env->GetStateHash(neighbor));
361  closedList[env->GetStateHash(neighbor)] = sn;
362  }
363  else {
364  AddToOpenList(env, currentOpenNode, neighbor);
365  }
366 
367  firstRound = false;
368  }
369 
370  if ((openQueue.size() == 0) && (stopAfterGoal == false))
371  {
372  ExtractPathToStart(currentOpenNode, thePath);
373  // Path is backwards - reverse
374  reverse(thePath.begin(), thePath.end());
375  return true;
376  }
377 
378  // std::cout<<std::endl;
379  return false;
380 }
381 
389 template <class state, class action, class environment>
391 {
392  return openQueue.top().currNode;
393 }
394 
404 template <class state, class action, class environment>
406 {
407  nodesExpanded++;
408  if (openQueue.Empty())
409  return false;
410  SearchNode<state> it = openQueue.Remove();
411  //if (it == openQueue.end())
412  // return false;
413  next = it.currNode;
414  //printf("h-cost\t%f\n", it.fCost-it.gCost);
415 
416  // std::cout << "Current open node " << next << " f-cost: " << it.fCost << " g-cost: " << it.gCost <<
417  // " h-value: " << env->HCost(next, goal) << "/" << it.fCost-it.gCost << std::endl;
418 
419  closedList[env->GetStateHash(next)] = it;
420  // std::cout<<"Getting "<<it.gCost<<" ";
421  return true;
422 }
423 
432 template <class state, class action, class environment>
433 void OldTemplateAStar<state,action,environment>::UpdateClosedNode(environment *e, state &currOpenNode, state &neighbor)
434 {
435  //printf("Found in closed list!\n");
436  SearchNode<state> prev = closedList[e->GetStateHash(neighbor)];
437  //openQueue.find(SearchNode<state>(neighbor, e->GetStateHash(neighbor)));
438  SearchNode<state> alt = closedList[e->GetStateHash(currOpenNode)];
439  double edgeWeight = e->GCost(currOpenNode, neighbor);
440  double altCost = alt.gCost+edgeWeight+(prev.fCost-prev.gCost);
441  if (fgreater(prev.fCost, altCost))
442  {
443  //std::cout << "Reopening node " << neighbor << " setting parent to " << currOpenNode << std::endl;
444  //printf("Reopening node %d setting parent to %d - %f vs. %f\n", neighbor, currOpenNode, prev.fCost, altCost);
445  prev.fCost = altCost;
446  prev.gCost = alt.gCost+edgeWeight;
447  prev.prevNode = currOpenNode;
448  // this is generally unneeded. But, in a search space where two
449  // nodes may be "equal" but not identical, it is important.
450  prev.currNode = neighbor;
451  closedList.erase(e->GetStateHash(neighbor));
452  assert(closedList.find(e->GetStateHash(neighbor)) == closedList.end());
453  openQueue.Add(prev);
454  }
455 }
456 
465 template <class state, class action, class environment>
466 void OldTemplateAStar<state,action,environment>::UpdateWeight(environment *e, state &currOpenNode, state &neighbor)
467 {
468  //printf("Found in open list!\n");
469  SearchNode<state> prev = openQueue.find(SearchNode<state>(neighbor, e->GetStateHash(neighbor)));
470  SearchNode<state> alt = closedList[e->GetStateHash(currOpenNode)];
471  double edgeWeight = e->GCost(currOpenNode, neighbor);
472  double altCost = alt.gCost+edgeWeight+(prev.fCost-prev.gCost);
473  if (fgreater(prev.fCost, altCost))
474  {
475  // std::cout << "Updating node " << neighbor << " setting parent to " << currOpenNode << std::endl;
476  //printf("Resetting node %d setting parent to %d\n", neighbor, currOpenNode);
477  prev.fCost = altCost;
478  prev.gCost = alt.gCost+edgeWeight;
479  prev.prevNode = currOpenNode;
480  // this is generally unneeded. But, in a search space where two
481  // nodes may be "equal" but not identical, it is important.
482  prev.currNode = neighbor;
483  openQueue.DecreaseKey(prev);
484  }
485 }
486 
495 template <class state, class action,class environment>
496 void OldTemplateAStar<state, action,environment>::AddToOpenList(environment *e, state &currOpenNode, state &neighbor)
497 {
498  //printf("Adding node %d setting parent to %d\n", neighbor, currOpenNode);
499  // std::cout << "Adding node " << neighbor << " setting parent to " << currOpenNode << std::endl;
500  double edgeWeight = e->GCost(currOpenNode, neighbor);
501 
502  double oldfCost = closedList[e->GetStateHash(currOpenNode)].fCost;
503  double oldgCost = closedList[e->GetStateHash(currOpenNode)].gCost;
504  double gCost = oldgCost+edgeWeight;
505  double fCost = gCost+weight*e->HCost(neighbor, goal);
506  if (/*(useBPMX) && */(fgreater(oldfCost, fCost))) // pathmax rule
507  {
508  // std::cout << "Adding node: (" << neighbor << ") f-cost from " << fCost << " to " << oldfCost
509  // << " h-cost: " << fCost-gCost << " g-cost: " << gCost << " hash: " << e->GetStateHash(neighbor) << std::endl;
510  fCost = oldfCost;
511  }
512  else {
513  // std::cout << "Adding node: (" << neighbor << ") f-cost " << fCost
514  // << " h-cost: " << fCost-gCost << " g-cost: " << gCost << " hash: " << e->GetStateHash(neighbor) << std::endl;
515  }
516  SearchNode<state> n(neighbor, currOpenNode, fCost, gCost, e->GetStateHash(neighbor));
517 
518  openQueue.Add(n);
519 }
520 
529 template <class state, class action,class environment>
531  std::vector<state> &thePath)
532 {
534  if (closedList.find(env->GetStateHash(goalNode)) != closedList.end())
535  {
536  n = closedList[env->GetStateHash(goalNode)];
537  }
538  else n = openQueue.find(SearchNode<state>(goalNode, env->GetStateHash(goalNode)));
539 
540  do {
541  //std::cout << "Extracting " << n.currNode << " with parent " << n.prevNode << std::endl;
542  //printf("Extracting %d with parent %d\n", n.currNode, n.prevNode);
543  thePath.push_back(n.currNode);
544  if (closedList.find(env->GetStateHash(n.prevNode)) != closedList.end())
545  {
546  n = closedList[env->GetStateHash(n.prevNode)];
547  }
548  else {
549  printf("No backward path found!\n");
550  break;
551  }
552  } while (!(n.currNode == n.prevNode));
553  thePath.push_back(n.currNode);
554 }
555 
562 template <class state, class action, class environment>
564 {
565  printf("%u items in closed list\n", (unsigned int)closedList.size());
566  printf("%u items in open queue\n", (unsigned int)openQueue.size());
567 }
568 
576 template <class state, class action, class environment>
578 {
579  return closedList.size()+openQueue.size();
580 }
581 
589 template <class state, class action,class environment>
590 //std::unordered_map<state, OldOldTemplateAStarUtil::SearchNode<state> >::const_iterator
592 {
593  return closedList.begin();
594 }
595 
606 template <class state, class action, class environment>
608 {
609  if (it == closedList.end())
610  return false;
611  next = (*it).first;
612  it++;
613  return true;
614 }
615 
626 template <class state, class action, class environment>
628 {
629  if (closedList.find(env->GetStateHash(val)) != closedList.end())
630  {
631  gCost = closedList.find(env->GetStateHash(val))->second.gCost;
632  return true;
633  }
634  return false;
635 }
636 
643 template <class state, class action, class environment>
645 {
646  int x = 0;
647  if (env == 0)
648  return;
649  //env->SetColor(0.0, 0.0, 0.0, 0.15);
650  for (closedList_iterator it = closedList.begin(); it != closedList.end(); it++)
651  {
652  env->OpenGLDraw((*it).second.currNode);
653  }
654 }
655 
656 #endif
OldOldTemplateAStarUtil::SearchNodeCompare::operator()
bool operator()(const SearchNode< state > &i1, const SearchNode< state > &i2) const
Definition: OldTemplateAStar.h:85
OldTemplateAStar::start
state start
Definition: OldTemplateAStar.h:121
OldOldTemplateAStarUtil::SearchNode
A search node class to use with hash maps.
Definition: OldTemplateAStar.h:58
OldOldTemplateAStarUtil::SearchNodeHash::operator()
size_t operator()(const SearchNode< state > &x) const
Definition: OldTemplateAStar.h:96
GenericSearchAlgorithm.h
An interface for generic search algorithms.
graphMove
Definition: GraphEnvironment.h:34
OldTemplateAStar::radEnv
environment * radEnv
Definition: OldTemplateAStar.h:191
OldTemplateAStar::GetPath
void GetPath(environment *env, state &from, state &to, std::vector< state > &thePath)
Perform an A* search between two states.
Definition: OldTemplateAStar.h:224
OldTemplateAStar::ClosedListIterNext
bool ClosedListIterNext(closedList_iterator &it, state &next) const
Get the next state in the closed list.
Definition: OldTemplateAStar.h:607
OldTemplateAStar::goal
state goal
Definition: OldTemplateAStar.h:121
OldTemplateAStar::nodesTouched
uint64_t nodesTouched
Definition: OldTemplateAStar.h:173
OldTemplateAStar::GetClosedListIter
void GetClosedListIter(closedList_iterator)
Get an iterator for the closed list.
Definition: OldTemplateAStar.h:591
OldTemplateAStar::InitializeSearch
bool InitializeSearch(environment *env, state &from, state &to, std::vector< state > &thePath)
Initialize the A* search.
Definition: OldTemplateAStar.h:245
OldTemplateAStar::neighbors
std::vector< state > neighbors
Definition: OldTemplateAStar.h:180
OldTemplateAStar::OldTemplateAStar
OldTemplateAStar()
Definition: OldTemplateAStar.h:108
OldOldTemplateAStarUtil::SearchNodeHash
Definition: OldTemplateAStar.h:95
OldTemplateAStar::GetNextNode
bool GetNextNode(state &next)
Removes the top node from the open list
Definition: OldTemplateAStar.h:405
OldTemplateAStar::UpdateClosedNode
void UpdateClosedNode(environment *env, state &currOpenNode, state &neighbor)
Check and update the weight of a closed node.
Definition: OldTemplateAStar.h:433
OldTemplateAStar::weight
double weight
Definition: OldTemplateAStar.h:185
FPUtil.h
OldOldTemplateAStarUtil::SearchNode::hashKey
uint64_t hashKey
Definition: OldTemplateAStar.h:75
OpenClosedList.h
OldTemplateAStar::GetName
virtual const char * GetName()
Return the name of the algorithm.
Definition: OldTemplateAStar.h:205
neighbor
graphMove neighbor
Definition: RoadMap.h:17
OldTemplateAStar::SetRadius
void SetRadius(double rad)
Definition: OldTemplateAStar.h:154
OldTemplateAStar::SetStopAfterGoal
void SetStopAfterGoal(bool val)
Definition: OldTemplateAStar.h:159
OldTemplateAStar::SetWeight
void SetWeight(double w)
Use weighted A* and set the weight.
Definition: OldTemplateAStar.h:171
OldTemplateAStar::AddToOpenList
void AddToOpenList(environment *env, state &currOpenNode, state &neighbor)
Add a node to the open list.
Definition: OldTemplateAStar.h:496
GenericSearchAlgorithm
Definition: GenericSearchAlgorithm.h:35
OldTemplateAStar::useRadius
bool useRadius
Definition: OldTemplateAStar.h:188
OldTemplateAStar::LogFinalStats
void LogFinalStats(StatCollection *)
Definition: OldTemplateAStar.h:152
OldTemplateAStar::ExtractPathToStart
void ExtractPathToStart(state &n, std::vector< state > &thePath)
Get the path from a goal state to the start state.
Definition: OldTemplateAStar.h:530
OldTemplateAStar::nodesExpanded
uint64_t nodesExpanded
Definition: OldTemplateAStar.h:173
OldTemplateAStar::PQueue
OpenClosedList< OldOldTemplateAStarUtil::SearchNode< state >, OldOldTemplateAStarUtil::SearchNodeHash< state >, OldOldTemplateAStarUtil::SearchNodeEqual< state >, OldOldTemplateAStarUtil::SearchNodeCompare< state > > PQueue
Definition: OldTemplateAStar.h:112
Hash64
Definition: SearchEnvironment.h:23
fless
bool fless(double a, double b)
Definition: FPUtil.h:28
OldTemplateAStar::DoAbstractSearch
void DoAbstractSearch()
Definition: OldTemplateAStar.h:131
verbose
static const bool verbose
Definition: OldTemplateAStar.h:195
OpenClosedList
A simple Heap class.
Definition: OpenClosedList.h:27
OldTemplateAStar::AddAdditionalStartState
void AddAdditionalStartState(state &newState)
Add additional start state to the search.
Definition: OldTemplateAStar.h:280
OldTemplateAStar::GetNodesTouched
uint64_t GetNodesTouched()
Definition: OldTemplateAStar.h:150
OldTemplateAStar::closedList_iterator
NodeLookupTable::const_iterator closedList_iterator
Definition: OldTemplateAStar.h:123
OldTemplateAStar::env
environment * env
Definition: OldTemplateAStar.h:181
OldTemplateAStar::openQueue
PQueue openQueue
Definition: OldTemplateAStar.h:119
fgreater
bool fgreater(double a, double b)
Definition: FPUtil.h:29
OldTemplateAStar::GetUsingBPMX
bool GetUsingBPMX()
Definition: OldTemplateAStar.h:146
OldTemplateAStar::CheckNextNode
state CheckNextNode()
Returns the next state on the open list (but doesn't pop it off the queue).
Definition: OldTemplateAStar.h:390
OldOldTemplateAStarUtil::SearchNode::gCost
double gCost
Definition: OldTemplateAStar.h:72
StatCollection
The StatCollection class is for collecting stats across different parts of the simulation.
Definition: StatCollection.h:34
OldOldTemplateAStarUtil::SearchNode::prevNode
state prevNode
Definition: OldTemplateAStar.h:74
OldTemplateAStar::NodeLookupTable
std::unordered_map< uint64_t, OldOldTemplateAStarUtil::SearchNode< state >, Hash64 > NodeLookupTable
Definition: OldTemplateAStar.h:117
OldTemplateAStar::radius
double radius
Definition: OldTemplateAStar.h:184
OldTemplateAStar::ResetNodeCount
void ResetNodeCount()
Definition: OldTemplateAStar.h:137
OldTemplateAStar::GetRadius
double GetRadius()
Definition: OldTemplateAStar.h:155
OldOldTemplateAStarUtil::SearchNode::SearchNode
SearchNode()
Definition: OldTemplateAStar.h:68
OldTemplateAStar::OpenGLDraw
void OpenGLDraw() const
Draw the open/closed list.
Definition: OldTemplateAStar.h:644
OldOldTemplateAStarUtil::SearchNode::SearchNode
SearchNode(state &curr, uint64_t key)
Definition: OldTemplateAStar.h:63
OldTemplateAStar::firstRound
bool firstRound
Definition: OldTemplateAStar.h:189
OldTemplateAStar
A templated version of A*, based on HOG genericAStar.
Definition: OldTemplateAStar.h:106
OldTemplateAStar::GetMemoryUsage
int GetMemoryUsage()
Return the amount of memory used by OldTemplateAStar.
Definition: OldTemplateAStar.h:577
OldTemplateAStar::DoSingleSearchStep
bool DoSingleSearchStep(std::vector< state > &thePath)
Expand a single node.
Definition: OldTemplateAStar.h:297
OldTemplateAStar::SetRadiusEnvironment
void SetRadiusEnvironment(environment *e)
Definition: OldTemplateAStar.h:157
OldTemplateAStar::GetNodesExpanded
uint64_t GetNodesExpanded()
Definition: OldTemplateAStar.h:149
OldTemplateAStar::PrintStats
void PrintStats()
A function that prints the number of states in the closed list and open queue.
Definition: OldTemplateAStar.h:563
OldTemplateAStar::SetUseBPMX
void SetUseBPMX(bool use)
Definition: OldTemplateAStar.h:145
OldOldTemplateAStarUtil::SearchNodeEqual::operator()
bool operator()(const SearchNode< state > &i1, const SearchNode< state > &i2) const
Definition: OldTemplateAStar.h:80
closedList_iterator
GenericAStarUtil::NodeLookupTable::const_iterator closedList_iterator
Definition: GenericAStar.h:75
OldTemplateAStar::stopAfterGoal
bool stopAfterGoal
Definition: OldTemplateAStar.h:182
OldOldTemplateAStarUtil::SearchNodeEqual
Definition: OldTemplateAStar.h:79
fequal
bool fequal(double a, double b, double tolerance=TOLERANCE)
Definition: FPUtil.h:32
OldOldTemplateAStarUtil::SearchNode::currNode
state currNode
Definition: OldTemplateAStar.h:73
OldTemplateAStar::GetClosedListGCost
bool GetClosedListGCost(state &val, double &gCost) const
Get state from the closed list.
Definition: OldTemplateAStar.h:627
OldOldTemplateAStarUtil
Definition: OldTemplateAStar.h:52
OldTemplateAStar::UpdateWeight
void UpdateWeight(environment *env, state &currOpenNode, state &neighbor)
Update the weight of a node.
Definition: OldTemplateAStar.h:466
OldTemplateAStar::GetStopAfterGoal
bool GetStopAfterGoal()
Definition: OldTemplateAStar.h:160
OldTemplateAStar::~OldTemplateAStar
virtual ~OldTemplateAStar()
Definition: OldTemplateAStar.h:109
OldTemplateAStar::useOccupancyInfo
bool useOccupancyInfo
Definition: OldTemplateAStar.h:187
OldTemplateAStar::closedList
NodeLookupTable closedList
Definition: OldTemplateAStar.h:120
OldOldTemplateAStarUtil::SearchNode::fCost
double fCost
Definition: OldTemplateAStar.h:71
OldOldTemplateAStarUtil::SearchNodeCompare
Definition: OldTemplateAStar.h:84
OldTemplateAStar::useBPMX
bool useBPMX
Definition: OldTemplateAStar.h:190
OldOldTemplateAStarUtil::SearchNode::SearchNode
SearchNode(state &curr, state &prev, double _fCost, double _gCost, uint64_t key)
Definition: OldTemplateAStar.h:60