HOG2
IRDijkstra.cpp
Go to the documentation of this file.
1 /*
2  * IRDijkstra.cpp
3  * hog2
4  *
5  * Created by Nathan Sturtevant on 10/9/07.
6  * Copyright 2007 Nathan Sturtevant, University of Alberta. All rights reserved.
7  *
8  */
9 
10 #include "IRDijkstra.h"
11 #include <vector>
12 
13 using namespace IRDijkstraConstants;
14 
17 {
18  g = 0;
19 }
20 
22 {
23 }
24 
25 const char *IRDijkstra::GetName()
26 {
27  return "IRDijkstra";
28 }
29 
31 {
32  if (!InitializeSearch(aMap, from, to))
33  return 0;
34  path *p = 0;
35  while (p == 0)
36  {
37  p = DoOneSearchStep();
38  //std::cout << p << endl;
39  }
40  return p;
41 }
42 
44 {
45  if (q.size() == 0)
46  return 0;
47  node *gNext = q.top().n;
48  q.pop();
49  //printf("Analyzing %d next\n", gNext->GetNum());
50  //std::cout << *gNext << std::endl;
51 
52 
53  if (gNext == gGoal) // we found the goal
54  {
55  if ((q.size() > 0) &&
57  {
58  node *temp = gNext;
59  gNext = q.top().n;
60  q.pop();
61  q.Add(GNode(temp));
62  }
63  else {
64  closedList[gNext->GetNum()] = GNode(gNext);
66  if (done)
67  {
68  //std::cout<<"finished" << std::endl;
69  //printf("%d refined nodes %d expanded nodes with pathlength %u \n", nodesRefined, nodesExpanded, p->length() );
70  return p;
71  }
72  if (p)
73  {
74  q.reset();
75  closedList.clear();
76  }
77  return p;
78  }
79  }
80 
81  nodesExpanded++;
82  ExpandNeighbors(gNext);
83 
84  closedList[gNext->GetNum()] = GNode(gNext);
85  return 0;
86 }
87 
89 {
90  closedList.clear();
91  q.reset();
92 
93  gStart = 0;
94  absGraph = aMap;
95  aStart = from;
96  aGoal = to;
97  delete g;
98  g = new Graph();
100 
101  // find most abstract node in Graph
102  node *top = FindTopLevelNode(from, to, aMap);
103  if (top == 0)
104  return false;
105  node *newTop = new node("top");
106  gStart = gGoal = newTop;
107  g->AddNode(newTop);
108  SetInitialValues(newTop, top, 0);
109  q.Add(GNode(newTop));
110  return true;
111 }
112 
114 {
115  if ((one == 0) || (two == 0))
116  return 0;
117  if (aMap->GetAbstractionLevel(one) >= (int)aMap->getNumAbstractGraphs())
118  return 0;
119  if (aMap->GetAbstractionLevel(one) == (int)aMap->getNumAbstractGraphs() - 1)
120  {
121  if (one == two)
122  return one;
123  return 0;
124  }
125  node *tmp = FindTopLevelNode(aMap->GetParent(one), aMap->GetParent(two), aMap);
126  if ((tmp == 0) && (one == two))
127  return one;
128  return tmp;
129 }
130 
131 /*
132  * aRealNode is the node inside the absGraph
133  * gNewNode is the node about to be added to Graph
134  * gParent is the parent inside the Graph
135  */
136 void IRDijkstra::SetInitialValues(node *gNewNode, node *aRealNode, node *gParent)
137 {
139  gNewNode->SetLabelL(kCorrespondingNode, aRealNode->GetNum());
140  if (gParent)
141  {
142  gNewNode->SetLabelF(kGCost, gParent->GetLabelF(kGCost));
143  //gNewNode->SetLabelF(kHCost, gParent->GetLabelF(kHCost));
144  }
145  else {
146  gNewNode->SetLabelF(kGCost, 0.0);
147  //gNewNode->SetLabelF(kHCost, 0.0);
148  }
149 // gNewNode->SetLabelL(kOptimalFlag, 0);
150 // gNewNode->SetLabelL(kInOpenList, 1);
151 
152  if ((gParent == gStart) && (absGraph->IsParentOf(aRealNode, aStart)))
153  {
154  //std::cout << "Assigning start to " << *gNewNode << std::endl;
155  gStart = gNewNode;
156  }
157  if ((gParent == gGoal) && (absGraph->IsParentOf(aRealNode, aGoal)))
158  {
159  //std::cout << "Assigning goal to " << *gNewNode << std::endl;
160  gGoal = gNewNode;
161  }
162 }
163 
165 {
166  neighbor_iterator ni = gNode->getNeighborIter();
167  for (int next = gNode->nodeNeighborNext(ni); next != -1; next = gNode->nodeNeighborNext(ni))
168  {
169  nodesTouched++;
170  node *gNeighbor = g->GetNode(next);
171  if (q.IsIn(GNode(gNeighbor))) // check for lower cost
172  {
173  if (fless(gNode->GetLabelF(kGCost)+1.0,
174  gNeighbor->GetLabelF(kGCost)))
175  {
176  gNeighbor->SetLabelF(kGCost, gNode->GetLabelF(kGCost)+1.0);
177  q.DecreaseKey(GNode(gNeighbor));
178  }
179  }
180  else if (closedList.find(gNeighbor->GetNum()) != closedList.end())
181  {
182  }
183  else { // add to open list
184  gNeighbor->SetLabelF(kGCost, gNode->GetLabelF(kGCost)+1.0);
185  q.Add(GNode(gNeighbor));
186  }
187  }
188 }
189 
191 {
192  done = true;
193 
194  path *p = GetSolution(gGoal);
195  for (path *i = p; i; i = i->next)
196  {
197  if (i->n->GetLabelL(kAbstractionLevel) != 0)
198  {
199  done = false;
200  }
201  }
202  if (done)
203  return p;
204 
205  std::vector<node*> nodes;
206  GetAllSolutionNodes(gGoal, nodes);
207  for (unsigned int x = 0; x < nodes.size(); x++)
208  {
209  //printf("## Refining %d\n", nodes[x]->GetNum());
210  RefineNode(nodes[x]);
211  }
212  //printf("%d refined nodes %d expanded nodes with pathlength %u \n", nodesRefined, nodesExpanded, p->length() );
213  closedList.clear();
214  q.reset();
215  q.Add(GNode(gStart));
216 
217  if (done)
218  return p;
219  delete p;
220  return 0;
221 }
222 
223 void IRDijkstra::GetAllSolutionNodes(node *goal, std::vector<node*> &nodes)
224 {
225  nodes.push_back(goal);
226  closedList.erase(goal->GetNum());
227  for (unsigned int x = 0; x < nodes.size(); x++)
228  {
229  node *gNode = nodes[x];
230 
231  neighbor_iterator ni = gNode->getNeighborIter();
232  for (int next = gNode->nodeNeighborNext(ni); next != -1; next = gNode->nodeNeighborNext(ni))
233  {
234  node *gNeighbor = g->GetNode(next);
235  if (closedList.find(gNeighbor->GetNum()) != closedList.end())
236  {
237 // printf("Neighbor (%d) has g-cost %1.2f, solution path through (%d) has cost %1.2f\n",
238 // gNeighbor->GetNum(), gNeighbor->GetLabelF(kGCost),
239 // gNode->GetNum(), gNode->GetLabelF(kGCost));
240  if (!fgreater(gNeighbor->GetLabelF(kGCost)+1, gNode->GetLabelF(kGCost)))
241  {
242 // printf("Adding to list!\n");
243  closedList.erase(gNeighbor->GetNum());
244  nodes.push_back(gNeighbor);
245  }
246  }
247  }
248  }
249 }
250 
252 {
253  neighbor_iterator ni = gNode->getNeighborIter();
254  for (int next = gNode->nodeNeighborNext(ni); next != -1; next = gNode->nodeNeighborNext(ni))
255  {
256  node *gNeighbor = g->GetNode(next);
257  if (closedList.find(gNeighbor->GetNum()) != closedList.end())
258  {
259  node* n = closedList[gNeighbor->GetNum()].n; // silly!
260  if (fequal(n->GetLabelF(kGCost) + 1.0, gNode->GetLabelF(kGCost)))
261  {
262  return new path(gNode, GetSolution(n));
263  }
264  }
265  }
266  return new path(gNode, 0);
267 }
268 
269 //void IRDijkstra::UpdateNode(node *gNode)
270 //{
271 // UpdateH(gNode);
272 // std::cout << "After UpdateH " << *gNode << std::endl;
273 // UpdateG(gNode);
274 // std::cout << "After UpdateG " << *gNode << std::endl;
275 // UpdateOptH(gNode);
276 // std::cout << "After UpdateOptH " << *gNode << std::endl;
277 // gNode->SetLabelL(kInOpenList, 0);
278 // q.Add(GNode(gNode));
279 //}
280 
281 //void IRDijkstra::UpdateH(node *gNode)
282 //{
283 // double minH = DBL_MAX;
284 //
285 // // update h
286 // neighbor_iterator ni = gNode->getNeighborIter();
287 // for (int next = gNode->nodeNeighborNext(ni); next != -1; next = gNode->nodeNeighborNext(ni))
288 // {
289 // node *gNeighbor = g->GetNode(next);
290 // double tmpH = gNeighbor->GetLabelF(kHCost) + g->FindEdge(next, gNode->GetNum())->GetWeight();
291 // if (fless(tmpH, minH))
292 // minH = tmpH;
293 // }
294 // if (gNode->GetLabelL(kAbstractionLevel) == 0)
295 // minH = std::max(minH, absGraph->h(gNode, aGoal));
296 // if (fgreater(minH, gNode->GetLabelF(kHCost)) &&
297 // (gNode != gGoal))
298 // {
299 // gNode->SetLabelF(kHCost, minH);
300 // MakeNeighborsOpen(gNode);
301 // }
302 //}
303 
304 //void IRDijkstra::UpdateG(node *gNode)
305 //{
306 // double minG = DBL_MAX;
307 //
308 // // update g
309 // neighbor_iterator ni = gNode->getNeighborIter();
310 // for (int next = gNode->nodeNeighborNext(ni); next != -1; next = gNode->nodeNeighborNext(ni))
311 // {
312 // node *gNeighbor = g->GetNode(next);
313 // double tmpG = gNeighbor->GetLabelF(kGCost) + g->FindEdge(next, gNode->GetNum())->GetWeight();
314 // if (fless(tmpG, minG))
315 // minG = tmpG;
316 // }
317 // if (gNode->GetLabelL(kAbstractionLevel) == 0)
318 // minG = std::max(minG, absGraph->h(gNode, aStart));
319 // if (fgreater(minG, gNode->GetLabelF(kGCost)) &&
320 // (gNode != gStart))
321 // {
322 // gNode->SetLabelF(kGCost, minG);
323 // MakeNeighborsOpen(gNode);
324 // }
325 //}
326 
327 //void IRDijkstra::UpdateOptH(node *gNode)
328 //{
329 // bool optH = false;
330 // if ((gNode->GetLabelL(kAbstractionLevel) == 0) &&
331 // (gNode->GetLabelL(kOptimalFlag) == 0))
332 // {
333 // if (gNode == gGoal)
334 // {
335 // optH = true;
336 // }
337 // else {
338 // neighbor_iterator ni = gNode->getNeighborIter();
339 // for (int next = gNode->nodeNeighborNext(ni); next != -1; next = gNode->nodeNeighborNext(ni))
340 // {
341 // node *gNeighbor = g->GetNode(next);
342 // if ((gNeighbor->GetLabelL(kOptimalFlag) == 1) &&
343 // (fequal(gNeighbor->GetLabelF(kHCost) + g->FindEdge(next, gNode->GetNum())->GetWeight(),
344 // gNode->GetLabelF(kHCost))))
345 // {
346 // optH = true;
347 // }
348 // }
349 // }
350 //
351 // if ((gNode->GetLabelL(kOptimalFlag) == 0) && (optH))
352 // {
353 // gNode->SetLabelL(kOptimalFlag, 1);
354 // MakeNeighborsOpen(gNode);
355 // }
356 // }
357 //}
358 
359 //void IRDijkstra::MakeNeighborsOpen(node *gNode)
360 //{
361 // neighbor_iterator ni = gNode->getNeighborIter();
362 // for (int next = gNode->nodeNeighborNext(ni); next != -1; next = gNode->nodeNeighborNext(ni))
363 // {
364 // node *gNeighbor = g->GetNode(next);
365 // if (gNeighbor->GetLabelL(kInOpenList) == 0)
366 // {
367 // gNeighbor->SetLabelL(kInOpenList, 1);
368 // q.DecreaseKey(GNode(gNeighbor));
369 // }
370 // }
371 //}
372 
374 {
375  if (absGraph->GetAbstractionLevel(gNode) == 0)
376  return;
377  nodesRefined++;
378  std::vector<node *> aChildren;
379  std::vector<node *> gChildren;
380  node *aNode = GetRealNode(gNode);
381  for (int x = 0; x < absGraph->GetNumChildren(aNode); x++)
382  {
383  aChildren.push_back(absGraph->GetNthChild(aNode, x));
384  }
385 
386  // first, add children to graph g
387  for (unsigned int x = 0; x < aChildren.size(); x++)
388  {
389  gChildren.push_back(new node("child"));
390  g->AddNode(gChildren[x]);
391  SetInitialValues(gChildren[x], aChildren[x], gNode);
392  q.Add(GNode(gChildren[x]));
393  }
394 
395  // first, connect children to each other
396  Graph *aGraph = absGraph->GetAbstractGraph(absGraph->GetAbstractionLevel(aChildren[0]));
397  for (unsigned int x = 0; x < gChildren.size(); x++)
398  {
399  for (unsigned int y = 0; y < gChildren.size(); y++)
400  {
401  if (x != y)
402  {
403  edge *e;
404  if ((e = aGraph->findDirectedEdge(aChildren[x]->GetNum(), aChildren[y]->GetNum())) != 0)
405  {
406  g->AddEdge(new edge(gChildren[x]->GetNum(), gChildren[y]->GetNum(), 1.0));
407  //(absGraph->GetAbstractionLevel(aChildren[0])==0)?e->GetWeight():1.5));
408  }
409  }
410  }
411  }
412 
413  // check neighbors of original node
414  neighbor_iterator ni = gNode->getNeighborIter();
415  for (int next = gNode->nodeNeighborNext(ni); next != -1; next = gNode->nodeNeighborNext(ni))
416  {
417  node *gNeighbor = g->GetNode(next);
418  if (gNeighbor->GetLabelL(kAbstractionLevel) == gNode->GetLabelL(kAbstractionLevel)-1)
419  {
420  // same level
421  for (unsigned int x = 0; x < gChildren.size(); x++)
422  {
423  edge *e;
424  if ((e = aGraph->FindEdge(aChildren[x]->GetNum(), GetRealNode(gNeighbor)->GetNum())) != 0)
425  {
426  g->AddEdge(new edge(gChildren[x]->GetNum(), gNeighbor->GetNum(), 1.0));
427  //(absGraph->GetAbstractionLevel(aChildren[0])==0)?e->GetWeight():1.5));
428  }
429  }
430  }
431  else if (gNeighbor->GetLabelL(kAbstractionLevel) < gNode->GetLabelL(kAbstractionLevel)-1)
432  { // neighbor is lower
433  for (unsigned int x = 0; x < aChildren.size(); x++)
434  {
435  if (ShouldAddEdge(GetRealNode(gNeighbor), aChildren[x]))
436  g->AddEdge(new edge(gChildren[x]->GetNum(), gNeighbor->GetNum(), 1.0));
437  }
438  }
439  else { // neighbor is higher
440  for (unsigned int x = 0; x < aChildren.size(); x++)
441  {
442  if (ShouldAddEdge(aChildren[x], GetRealNode(gNeighbor)))
443  g->AddEdge(new edge(gChildren[x]->GetNum(), gNeighbor->GetNum(), 1.0));
444  }
445  }
446  }
447 
448  // last thing we do!
449  g->RemoveNode(gNode);
450 }
451 
453 {
455 }
456 
457 bool IRDijkstra::ShouldAddEdge(node *aLowerNode, node *aHigherNode)
458 {
459  neighbor_iterator ni = aLowerNode->getNeighborIter();
460  for (int next = aLowerNode->nodeNeighborNext(ni); next != -1; next = aLowerNode->nodeNeighborNext(ni))
461  {
462  node *aNeighbor = absGraph->GetAbstractGraph(absGraph->GetAbstractionLevel(aLowerNode))->GetNode(next);
463  if (absGraph->IsParentOf(aHigherNode, aNeighbor))
464  return true;
465  }
466  return false;
467 }
468 
470 {
471  if ((g == 0) || (g->GetNumNodes() == 0))
472  {
473  return;
474  }
475 
476  glLineWidth(3.0);
477  glBegin(GL_LINES);
478  glNormal3f(0, 1, 0);
479  edge_iterator ei = g->getEdgeIter();
480  for (edge *e = g->edgeIterNext(ei); e; e = g->edgeIterNext(ei))
481  {
482  node *n;
483  n = g->GetNode(e->getFrom());
484  if (q.peek().n == n)
485  glColor3f(1.0, 0.0, 1.0);
486  else if (n == gStart)
487  glColor3f(0, 0, 1);
488  else if (n == gGoal)
489  glColor3f(0, 1, 0);
490  else if (closedList.find(n->GetNum()) != closedList.end()) // on closed list
491  glColor3f(1.0, 1.0, 0);
492  else if (q.IsIn(GNode(n)))
493  glColor3f(0.5, 0.5, 0.5);
494  else
495  glColor3f(1, 1, 1);
496 
498  glVertex3f(rv.x, rv.y, rv.z);
499 
500  n = g->GetNode(e->getTo());
501  if (q.peek().n == n)
502  glColor3f(1.0, 0.0, 1.0);
503  else if (n == gStart)
504  glColor3f(0, 0, 1);
505  else if (n == gGoal)
506  glColor3f(0, 1, 0);
507  else if (closedList.find(n->GetNum()) != closedList.end()) // on closed list
508  glColor3f(1.0, 1.0, 0);
509  else if (q.IsIn(GNode(n)))
510  glColor3f(0.5, 0.5, 0.5);
511  else
512  glColor3f(1, 1, 1);
513 
514  rv = absGraph->GetNodeLoc(GetRealNode(n));
515 
516  glVertex3f(rv.x, rv.y, rv.z);
517  }
518 
519  glEnd();
520  glLineWidth(1.0);
521 
522 }
523 
IRDijkstraConstants::GNode::n
node * n
Definition: IRDijkstra.h:36
IRDijkstra::aStart
node * aStart
Definition: IRDijkstra.h:98
Graph::AddNode
int AddNode(node *)
Definition: Graph.cpp:136
GraphAbstraction
A generic class for basic operations on Graph abstractions.
Definition: GraphAbstraction.h:63
node::SetLabelL
void SetLabelL(unsigned int index, long val) const
Definition: Graph.cpp:702
node::SetLabelF
void SetLabelF(unsigned int index, double val) const
Definition: Graph.cpp:687
Graph::RemoveNode
node * RemoveNode(node *, unsigned int &)
Definition: Graph.cpp:356
IRDijkstra::closedList
IRDijkstraConstants::NodeLookupTable closedList
Definition: IRDijkstra.h:97
IRDijkstra::gGoal
node * gGoal
Definition: IRDijkstra.h:99
Graph::FindEdge
edge * FindEdge(unsigned int from, unsigned int to)
Finds an edge between nodes with ids from and to, no matter which direction.
Definition: Graph.cpp:230
recVec
A generic vector (essentially the same as a point, but offers normalization)
Definition: GLUtil.h:78
neighbor_iterator
unsigned int neighbor_iterator
Definition: Graph.h:34
GraphAbstraction::GetAbstractGraph
Graph * GetAbstractGraph(int level)
return the abstract Graph at the given level
Definition: GraphAbstraction.h:74
recVec::z
GLdouble z
Definition: GLUtil.h:98
IRDijkstra::done
bool done
Definition: IRDijkstra.h:103
OpenClosedList::DecreaseKey
void DecreaseKey(OBJ val)
Indicate that the key for a particular object has decreased.
Definition: OpenClosedList.h:96
Graph::AddEdge
void AddEdge(edge *)
Definition: Graph.cpp:170
IRDijkstra::FindTopLevelNode
node * FindTopLevelNode(node *one, node *two, GraphAbstraction *aMap)
Definition: IRDijkstra.cpp:113
edge_iterator
std::vector< edge * >::const_iterator edge_iterator
Definition: Graph.h:30
IRDijkstra::g
Graph * g
Definition: IRDijkstra.h:101
SearchAlgorithm::nodesTouched
uint32_t nodesTouched
Definition: SearchAlgorithm.h:37
OpenClosedList::top
OBJ top()
Definition: OpenClosedList.h:39
IRDijkstra::gStart
node * gStart
Definition: IRDijkstra.h:99
GraphAbstraction::GetNthChild
node * GetNthChild(node *which, int n)
Definition: GraphAbstraction.h:88
OpenClosedList::IsIn
bool IsIn(const OBJ val) const
Returns true if the object is in the OpenClosedList.
Definition: OpenClosedList.h:121
Graph
A generic Graph class.
Definition: Graph.h:66
IRDijkstra.h
Graph::GetNode
node * GetNode(unsigned long num)
Definition: Graph.cpp:152
Graph::edgeIterNext
edge * edgeIterNext(edge_iterator &) const
Definition: Graph.cpp:320
IRDijkstra::ShouldAddEdge
bool ShouldAddEdge(node *aLowerNode, node *aHigherNode)
Definition: IRDijkstra.cpp:457
GraphAbstraction::GetAbstractionLevel
long GetAbstractionLevel(node *which)
Definition: GraphAbstraction.h:92
IRDijkstra::aGoal
node * aGoal
Definition: IRDijkstra.h:98
IRDijkstraConstants
Definition: IRDijkstra.h:21
Graph::getEdgeIter
edge_iterator getEdgeIter() const
Definition: Graph.cpp:315
OpenClosedList::Add
void Add(OBJ val)
Add object into OpenClosedList.
Definition: OpenClosedList.h:77
IRDijkstra::IRDijkstra
IRDijkstra()
Definition: IRDijkstra.cpp:15
fless
bool fless(double a, double b)
Definition: FPUtil.h:28
GraphAbstraction::GetNumChildren
long GetNumChildren(node *which)
Definition: GraphAbstraction.h:87
IRDijkstra::q
IRDijkstraConstants::PQueue q
Definition: IRDijkstra.h:96
SearchAlgorithm::nodesExpanded
uint32_t nodesExpanded
Definition: SearchAlgorithm.h:36
GraphAbstractionConstants::kAbstractionLevel
@ kAbstractionLevel
Definition: GraphAbstraction.h:25
OpenClosedList::pop
void pop()
Definition: OpenClosedList.h:37
IRDijkstra::DoOneSearchStep
path * DoOneSearchStep()
Definition: IRDijkstra.cpp:43
IRDijkstra::OpenGLDraw
void OpenGLDraw() const
Definition: IRDijkstra.cpp:469
fgreater
bool fgreater(double a, double b)
Definition: FPUtil.h:29
Graph::GetNumNodes
int GetNumNodes()
Definition: Graph.cpp:403
CFOptimalRefinementConstants::kGCost
@ kGCost
Definition: CFOptimalRefinement.h:27
CFOptimalRefinementConstants::kCorrespondingNode
@ kCorrespondingNode
Definition: CFOptimalRefinement.h:26
IRDijkstra::absGraph
GraphAbstraction * absGraph
Definition: IRDijkstra.h:100
IRDijkstraConstants::GNode
Definition: IRDijkstra.h:33
node::nodeNeighborNext
int nodeNeighborNext(neighbor_iterator &) const
Definition: Graph.cpp:807
IRDijkstra::InitializeSearch
bool InitializeSearch(GraphAbstraction *aMap, node *from, node *to)
Definition: IRDijkstra.cpp:88
GraphAbstraction::getNumAbstractGraphs
unsigned int getNumAbstractGraphs()
return the total number of graphs in the hierarchy
Definition: GraphAbstraction.h:76
path
std::vector< xyLoc > path
Definition: Sample.cpp:43
IRDijkstra::ExtractAndRefinePath
path * ExtractAndRefinePath()
Definition: IRDijkstra.cpp:190
node::GetLabelF
double GetLabelF(unsigned int index) const
Definition: Graph.h:215
IRDijkstra::RefineNode
void RefineNode(node *gNode)
Definition: IRDijkstra.cpp:373
IRDijkstra::~IRDijkstra
virtual ~IRDijkstra()
Definition: IRDijkstra.cpp:21
IRDijkstra::nodesRefined
int nodesRefined
Definition: IRDijkstra.h:102
node::GetNum
unsigned int GetNum() const
Definition: Graph.h:176
IRDijkstra::GetName
virtual const char * GetName()
Definition: IRDijkstra.cpp:25
IRDijkstra::GetSolution
path * GetSolution(node *gNode)
Definition: IRDijkstra.cpp:251
reservationProvider
Definition: ReservationProvider.h:33
SearchAlgorithm
A generic algorithm which can be used for pathfinding.
Definition: SearchAlgorithm.h:25
GraphAbstraction::IsParentOf
bool IsParentOf(node *parent, node *child)
return true if the first node is a parent of or is equal two the second node
Definition: GraphAbstraction.cpp:78
GraphAbstraction::GetNodeLoc
virtual recVec GetNodeLoc(node *) const
Definition: GraphAbstraction.h:120
path::next
path * next
Definition: Path.h:23
node::GetLabelL
long GetLabelL(unsigned int index) const
Definition: Graph.h:220
path
A linked list of nodes which form a continuous path.
Definition: Path.h:20
node::getNeighborIter
neighbor_iterator getNeighborIter() const
Definition: Graph.cpp:802
IRDijkstra::ExpandNeighbors
void ExpandNeighbors(node *gNode)
Definition: IRDijkstra.cpp:164
recVec::y
GLdouble y
Definition: GLUtil.h:98
Graph::findDirectedEdge
edge * findDirectedEdge(unsigned int from, unsigned int to)
Definition: Graph.cpp:189
fequal
bool fequal(double a, double b, double tolerance=TOLERANCE)
Definition: FPUtil.h:32
OpenClosedList::size
unsigned size()
Definition: OpenClosedList.h:42
GraphAbstraction::GetParent
node * GetParent(node *which)
Definition: GraphAbstraction.h:86
recVec::x
GLdouble x
Definition: GLUtil.h:98
OpenClosedList::peek
const OBJ peek() const
Definition: OpenClosedList.h:38
OpenClosedList::reset
void reset()
Remove all objects from queue.
Definition: OpenClosedList.h:67
IRDijkstra::GetRealNode
node * GetRealNode(node *gNode) const
Definition: IRDijkstra.cpp:452
IRDijkstra::SetInitialValues
void SetInitialValues(node *gNewNode, node *aRealNode, node *gParent)
Definition: IRDijkstra.cpp:136
node
Nodes to be stored within a Graph.
Definition: Graph.h:170
IRDijkstra::GetAllSolutionNodes
void GetAllSolutionNodes(node *goal, std::vector< node * > &nodes)
Definition: IRDijkstra.cpp:223
IRDijkstra::GetPath
virtual path * GetPath(GraphAbstraction *aMap, node *from, node *to, reservationProvider *rp=0)
Definition: IRDijkstra.cpp:30
edge
Edge class for connections between node in a Graph.
Definition: Graph.h:129