HOG2
BidirectionalDijkstra.h
Go to the documentation of this file.
1 //
2 // BidirectionalDijkstra.h
3 // hog2 glut
4 //
5 // Created by Sneha Sawlani on 2/27/16.
6 // Copyright (c) 2016 University of Denver. All rights reserved.
7 //
8 
9 #ifndef hog2_glut_BidirectionalDijkstra_h
10 #define hog2_glut_BidirectionalDijkstra_h
11 
12 #include "AStarOpenClosed.h"
13 #include "FPUtil.h"
14 
15 template <class state>
16 struct BDCompare{
18  {
19  return fgreater(i1.g,i2.g); //low priority over high
20  }
21 
22 };
23 
24 template <class state, class action, class environment, class priorityQueue = AStarOpenClosed<state,BDCompare<state>> >
25 class BIdijkstra{
26  public:
27  BIdijkstra() { env = 0; ResetNodeCount(); countRegions = false; }
28  virtual ~BIdijkstra() {}
29  void GetPath(environment *env, const state& from, const state& to,std::vector<state> &thePath);
30  bool InitializeSearch(environment *env, const state& from, const state& to,std::vector<state> &thePath);
31  bool DoSingleSearchStep(std::vector<state> &thePath);
32  void ExtractPath(uint64_t node1,uint64_t node2,std::vector<state> &thePath);
33  void DoRegionAnalysis(environment* env, const state& from, const state& to, double optimalPathCost, uint64_t optimalPathLength);
34  inline void SetVersion(int v) { version = v;}
35  inline int GetVersion(){ return version; }
36  inline void SetEpsilon(double minedge){
37  epsilon=minedge;
38  }
39  inline double GetEpsilon(){
40  return epsilon;
41  }
42 
43  priorityQueue forwardQueue, backwardQueue;
44  state goal, start;
45 
46 
47  virtual const char *GetName() { return "Bidirectional Dijkstra"; }
48 
50 
51  inline const int GetNumForwardItems() { return forwardQueue.size(); }
52 
53  inline const int GetNumBackwardItems() { return backwardQueue.size(); }
54 
55  inline const AStarOpenClosedData<state> &GetForwardItem(unsigned int which) { return forwardQueue.Lookat(which); }
56 
57  inline const AStarOpenClosedData<state> &GetBackwardItem(unsigned int which) { return backwardQueue.Lookat(which); }
58 
59  uint64_t GetNodesExpanded() const { return nodesExpanded; }
60  uint64_t GetNodesTouched() const { return nodesTouched; }
61 
62  inline uint64_t GetNodesExpanded_NN_PathCost() const { return nodesExpanded_NN_PathCost; }
63  inline uint64_t GetNodesExpanded_NF_PathCost() const { return nodesExpanded_NF_PathCost; }
64  inline uint64_t GetNodesExpanded_FN_PathCost() const { return nodesExpanded_FN_PathCost; }
65  inline uint64_t GetNodesExpanded_FF_PathCost() const { return nodesExpanded_FF_PathCost; }
66  inline uint64_t GetNodesExpanded_RN_PathCost() const { return nodesExpanded_RN_PathCost; }
67  inline uint64_t GetNodesExpanded_RF_PathCost() const { return nodesExpanded_RF_PathCost; }
68 
69  inline uint64_t GetNodesExpanded_NN_PathLength() const { return nodesExpanded_NN_PathLength; }
70  inline uint64_t GetNodesExpanded_NF_PathLength() const { return nodesExpanded_NF_PathLength; }
71  inline uint64_t GetNodesExpanded_FN_PathLength() const { return nodesExpanded_FN_PathLength; }
72  inline uint64_t GetNodesExpanded_FF_PathLength() const { return nodesExpanded_FF_PathLength; }
73  inline uint64_t GetNodesExpanded_RN_PathLength() const { return nodesExpanded_RN_PathLength; }
74  inline uint64_t GetNodesExpanded_RF_PathLength() const { return nodesExpanded_RF_PathLength; }
75 
76  double GetPathCost() const { return optimalPathCost; } // path cost is the sum of all edges; path length is the number of edges
77  uint64_t GetPathLength() const { return optimalPathLength; }
78  state GetMeetingPoint() const { return forwardQueue.Lookat(middleNode).data; }
79  void OpenGLDraw() const;
80 
81 private:
82  void OpenGLDraw(const priorityQueue &queue) const;
83 
84  void Expand(priorityQueue &current,priorityQueue &opposite,const state &target);
85 
87 
88  uint64_t middleNode;
89  uint64_t middleNode2;
90  double currentCost;
91  std::vector<state> neighbors;
92  environment *env;
93  double epsilon;
94  int turn;
95  int version;
97 
99 
101 
105 };
106 
107 template <class state,class action,class environment,class priorityQueue>
108 void BIdijkstra<state,action,environment,priorityQueue>::GetPath(environment* env,const state& from,const state& to, std::vector<state> &thePath)
109 {
110 
111  if(InitializeSearch(env,from,to,thePath)==false)
112  return;
113 
114  while(!DoSingleSearchStep(thePath))
115  {}
116 }
117 
118 template<class state,class action,class environment,class priorityQueue>
119 bool BIdijkstra<state,action,environment,priorityQueue>::InitializeSearch(environment *env,const state& from,const state& to,std::vector<state> &thePath)
120 {
121  this->env=env;
122  currentCost=DBL_MAX;
123  forwardQueue.Reset();
124  backwardQueue.Reset();
125  ResetNodeCount();
126  thePath.resize(0);
127  start=from;
128  goal=to;
129 
130  turn = 0;
131 
132  if(start==goal)
133  return false;
134 
135  forwardQueue.AddOpenNode(start,env->GetStateHash(start),0,0);
136  backwardQueue.AddOpenNode(goal,env->GetStateHash(goal),0,0);
137 
138  return true;
139 }
140 
141 template<class state,class action,class environment,class priorityQueue>
143 {
144  if(forwardQueue.OpenSize()==0 && backwardQueue.OpenSize()==0)
145  {
146  thePath.resize(0);
147  return true;
148  }
149  if(forwardQueue.OpenSize()==0)
150  {
151  Expand(backwardQueue,forwardQueue,start);
152  }
153  else if(backwardQueue.OpenSize()==0)
154  {
155  Expand(forwardQueue,backwardQueue,goal);
156  }
157  else {
158  uint64_t forward = forwardQueue.Peek();
159  uint64_t backward = backwardQueue.Peek();
160 
161  const AStarOpenClosedData<state> &nextForward = forwardQueue.Lookat(forward);
162  const AStarOpenClosedData<state> &nextBackward = backwardQueue.Lookat(backward);
163 
164  double p1=nextForward.g;
165  double p2=nextBackward.g;
166 
167  switch(version)
168  {
169  case 1:
170  if(fless(p1,p2))
171  forwardDirection = true;
172  else
173  forwardDirection = false;
174  break;
175 
176  case 2:
177  if(turn == 0)
178  {
179  turn = 1;
180  forwardDirection = true;
181  }
182  else
183  {
184  turn = 0;
185  forwardDirection = false;
186  }
187  break;
188  case 3:
189  if(forwardQueue.size() <= backwardQueue.size())
190  {
191  forwardDirection = true;
192  }
193  else
194  {
195  forwardDirection = false;
196  }
197  }
198 
199  if(forwardDirection)
200  {
201  Expand(forwardQueue,backwardQueue,goal);
202  }
203  else
204  {
205  Expand(backwardQueue, forwardQueue, start);
206  }
207 
208  }
209 
210  //check if we can terminate
211 
212  if(fless(currentCost,DBL_MAX))
213  {
214  uint64_t fminID = forwardQueue.Peek();
215  uint64_t bminID = backwardQueue.Peek();
216 
217  const AStarOpenClosedData<state> &fmin = forwardQueue.Lookat(fminID);
218  const AStarOpenClosedData<state> &bmin = backwardQueue.Lookat(bminID);
219 
220  if (!fless((fmin.g+bmin.g+epsilon), currentCost))
221  {
222  optimalPathCost = currentCost;
223  ExtractPath(middleNode,middleNode2,thePath);
224  return true;
225  }
226  }
227 
228  return false;
229 
230 
231 }
232 
233 template<class state,class action,class environment,class priorityQueue>
234 void BIdijkstra<state,action,environment,priorityQueue>::ExtractPath(uint64_t node1,uint64_t node2,std::vector<state>& thePath)
235 {
236  while(forwardQueue.Lookup(node1).parentID != node1)
237  {
238  thePath.insert(thePath.begin(), forwardQueue.Lookup(node1).data);
239  node1 = forwardQueue.Lookup(node1).parentID;
240  }
241 
242  thePath.insert(thePath.begin(), forwardQueue.Lookup(node1).data);
243 
244  while(backwardQueue.Lookup(node2).parentID != node2)
245  {
246  thePath.push_back(backwardQueue.Lookup(node2).data);
247  node2 = backwardQueue.Lookup(node2).parentID;
248  }
249 
250  thePath.push_back(backwardQueue.Lookup(node2).data);
251 }
252 
253 template<class state,class action,class environment,class priorityQueue>
254 void BIdijkstra<state,action,environment,priorityQueue>::Expand(priorityQueue &current,priorityQueue &opposite,const state &target)
255 {
256  uint64_t nextID=current.Close();
257 
258 // if(countRegions)
259 // {
260 // double costFromStart;
261 // double costFromGoal;
262 //
263 // uint64_t lengthFromStart;
264 // uint64_t lengthFromGoal;
265 //
266 // BIdijkstra<state, action, environment> bidijkstra;
267 //
268 // bidijkstra.SetEpsilon(epsilon);
269 // bidijkstra.SetVersion(3);
270 //
271 // std::vector<state> path;
272 //
273 // if(forwardDirection)
274 // {
275 // costFromStart = current.Lookup(nextID).g;
276 // lengthFromStart = current.Lookup(nextID).gLength;
277 //
278 // bidijkstra.GetPath(env, current.Lookup(nextID).data, goal, path);
279 //
280 // costFromGoal = bidijkstra.GetPathCost();
281 // lengthFromGoal = path.size();
282 // }
283 // else
284 // {
285 // costFromGoal = current.Lookup(nextID).g;
286 // lengthFromGoal = current.Lookup(nextID).gLength;
287 //
288 // bidijkstra.GetPath(env, start, current.Lookup(nextID).data,path);
289 //
290 // costFromStart = bidijkstra.GetPathCost();
291 // lengthFromStart = path.size();
292 //
293 // }
294 //
295 // if(flessOrEqual(costFromStart, optimalPathCost/2) && flessOrEqual(costFromGoal, optimalPathCost/2))
296 // nodesExpanded_NN_PathCost++;
297 //
298 // else if(flessOrEqual(costFromStart, optimalPathCost/2) && fgreater(costFromGoal, optimalPathCost/2))
299 // nodesExpanded_NF_PathCost++;
300 //
301 // else if(flessOrEqual(costFromStart, optimalPathCost) && flessOrEqual(costFromGoal, optimalPathCost/2))
302 // nodesExpanded_FN_PathCost++;
303 //
304 // else if(flessOrEqual(costFromStart, optimalPathCost) && fgreater(costFromGoal, optimalPathCost/2))
305 // nodesExpanded_FF_PathCost++;
306 //
307 // else if(flessOrEqual(costFromGoal, optimalPathCost/2))
308 // nodesExpanded_RN_PathCost++;
309 //
310 // else
311 // nodesExpanded_RF_PathCost++;
312 //
313 //
314 // if(flessOrEqual(lengthFromStart, optimalPathLength/2) && flessOrEqual(lengthFromGoal, optimalPathLength/2))
315 // nodesExpanded_NN_PathLength++;
316 //
317 // else if(flessOrEqual(lengthFromStart, optimalPathLength/2) && fgreater(lengthFromGoal, optimalPathLength/2))
318 // nodesExpanded_NF_PathLength++;
319 //
320 // else if(flessOrEqual(lengthFromStart, optimalPathLength) && flessOrEqual(lengthFromGoal, optimalPathLength/2))
321 // nodesExpanded_FN_PathLength++;
322 //
323 // else if(flessOrEqual(lengthFromStart, optimalPathLength) && fgreater(lengthFromGoal, optimalPathLength/2))
324 // nodesExpanded_FF_PathLength++;
325 //
326 // else if(flessOrEqual(lengthFromGoal, optimalPathLength/2))
327 // nodesExpanded_RN_PathLength++;
328 //
329 // else
330 // nodesExpanded_RF_PathLength++;
331 //
332 //
333 // }
334 
335  nodesExpanded++;
336 
337  env->GetSuccessors(current.Lookup(nextID).data,neighbors);
338 
339  for(auto &succ : neighbors)
340  {
341  nodesTouched++;
342  uint64_t childID;
343 
344 
345  auto loc = current.Lookup(env->GetStateHash(succ), childID);
346 
347  switch(loc)
348  {
349  case kClosedList: //ignore
350  break;
351  case kOpenList: //update cost if needed
352  {
353  double edgeCost=env->GCost(current.Lookup(nextID).data,succ);
354 
355  if(fless(current.Lookup(nextID).g+edgeCost,current.Lookup(childID).g))
356  {
357  current.Lookup(childID).parentID=nextID;
358  current.Lookup(childID).g=current.Lookup(nextID).g+edgeCost;
359  current.KeyChanged(childID);
360 // current.Lookup(childID).gLength = current.Lookup(nextID).gLength + 1;
361 
362  //TODO: check if we improved the current solution?
363 
364  uint64_t reverseLoc;
365 
366  auto loc=opposite.Lookup(env->GetStateHash(succ),reverseLoc);
367 
368  if(loc==kOpenList)
369  {
370  if(fless(current.Lookup(nextID).g+edgeCost+opposite.Lookup(reverseLoc).g,currentCost))
371  {
372  //TODO: store current solution
373  //printf("Potential updated solution found,cost: %1.2f + %1.2f = %1.2f\n",current.Lookup(nextID).g+edgeCost,opposite.Lookup(reverseLoc).g,current.Lookup(nextID).g+edgeCost+opposite.Lookup(reverseLoc).g);
374 
375  currentCost = current.Lookup(nextID).g+edgeCost + opposite.Lookup(reverseLoc).g;
376 
377  if(forwardDirection)
378  {
379  middleNode = nextID;
380  middleNode2 = reverseLoc;
381  }
382  else
383  {
384  middleNode = reverseLoc;
385  middleNode2 = nextID;
386  }
387 
388 
389  }
390  }
391  }
392  }
393  break;
394  case kNotFound:
395  {
396  double edgeCost=env->GCost(current.Lookup(nextID).data,succ);
397 
398  current.AddOpenNode(succ,env->GetStateHash(succ),current.Lookup(nextID).g+edgeCost,0,nextID);
399 
400  //check for solution
401 
402  uint64_t reverseLoc;
403  auto loc = opposite.Lookup(env->GetStateHash(succ), reverseLoc);
404 
405  if (loc == kOpenList)
406  {
407  if (fless(current.Lookup(nextID).g+edgeCost + opposite.Lookup(reverseLoc).g, currentCost))
408  {
409  // TODO: store current solution
410  /*printf("Potential solution found, cost: %1.2f + %1.2f = %1.2f\n",
411  current.Lookup(nextID).g+edgeCost,
412  opposite.Lookup(reverseLoc).g,
413  current.Lookup(nextID).g+edgeCost+opposite.Lookup(reverseLoc).g);*/
414  currentCost = current.Lookup(nextID).g+edgeCost + opposite.Lookup(reverseLoc).g;
415 
416  if(forwardDirection)
417  {
418  middleNode = nextID;
419  middleNode2 = reverseLoc;
420  }
421  else
422  {
423  middleNode = reverseLoc;
424  middleNode2 = nextID;
425  }}
426  }
427 
428  }
429  }
430  }
431 }
432 
433 
434 template<class state,class action,class environment,class priorityQueue>
436 {
437  OpenGLDraw(forwardQueue);
438  OpenGLDraw(backwardQueue);
439 }
440 
441  template<class state,class action,class environment,class priorityQueue>
443  {
444  double transparency=0.9;
445  if(queue.size()==0)
446  return;
447  uint64_t top=-1;
448 
449  if (queue.OpenSize() > 0)
450  {
451  top = queue.Peek();
452  }
453  for (unsigned int x = 0; x < queue.size(); x++)
454  {
455  const AStarOpenClosedData<state> &data = queue.Lookat(x);
456  if (x == top)
457  {
458  env->SetColor(1.0, 1.0, 0.0, transparency);
459  env->OpenGLDraw(data.data);
460  }
461  if ((data.where == kOpenList) && (data.reopened))
462  {
463  env->SetColor(0.0, 0.5, 0.5, transparency);
464  env->OpenGLDraw(data.data);
465  }
466  else if (data.where == kOpenList)
467  {
468  env->SetColor(0.0, 1.0, 0.0, transparency);
469  env->OpenGLDraw(data.data);
470  }
471  else if ((data.where == kClosedList) && (data.reopened))
472  {
473  env->SetColor(0.5, 0.0, 0.5, transparency);
474  env->OpenGLDraw(data.data);
475  }
476  else if (data.where == kClosedList)
477  {
478  env->SetColor(1.0, 0.0, 0.0, transparency);
479  env->OpenGLDraw(data.data);
480  }
481  }
482 
483  }
484 
485 template<class state, class action, class environment, class priorityQueue>
486 void BIdijkstra<state, action, environment, priorityQueue>::DoRegionAnalysis(environment* env, const state& from, const state& to, double optimalPathCost, uint64_t optimalPathLength)
487 {
488  countRegions = true;
489 
490  nodesExpanded_NN_PathCost = nodesExpanded_NF_PathCost = nodesExpanded_FN_PathCost = nodesExpanded_FF_PathCost = nodesExpanded_RN_PathCost = nodesExpanded_RF_PathCost = 0;
491 
492  nodesExpanded_NN_PathLength = nodesExpanded_NF_PathLength = nodesExpanded_FN_PathLength = nodesExpanded_FF_PathLength = nodesExpanded_RN_PathLength = nodesExpanded_RF_PathLength = 0;
493 
494  this->optimalPathCost = optimalPathCost;
495  this->optimalPathLength = optimalPathLength;
496 
497  std::vector<state> thePath;
498 
499  GetPath(env, from, to, thePath);
500 
501  countRegions = false;
502 }
503 
504 
505 
506 
507 
508 
509 
510 #endif
BIdijkstra::nodesExpanded_RN_PathCost
uint64_t nodesExpanded_RN_PathCost
Definition: BidirectionalDijkstra.h:98
BIdijkstra::GetNodesExpanded_RN_PathCost
uint64_t GetNodesExpanded_RN_PathCost() const
Definition: BidirectionalDijkstra.h:66
BIdijkstra::nodesExpanded_NN_PathLength
uint64_t nodesExpanded_NN_PathLength
Definition: BidirectionalDijkstra.h:100
BIdijkstra::nodesExpanded_RF_PathCost
uint64_t nodesExpanded_RF_PathCost
Definition: BidirectionalDijkstra.h:98
AStarOpenClosedData::reopened
bool reopened
Definition: AStarOpenClosed.h:68
BIdijkstra::GetMeetingPoint
state GetMeetingPoint() const
Definition: BidirectionalDijkstra.h:78
AStarOpenClosedData::data
state data
Definition: AStarOpenClosed.h:57
BIdijkstra::ExtractPath
void ExtractPath(uint64_t node1, uint64_t node2, std::vector< state > &thePath)
Definition: BidirectionalDijkstra.h:234
BIdijkstra::middleNode
uint64_t middleNode
Definition: BidirectionalDijkstra.h:88
BIdijkstra::SetEpsilon
void SetEpsilon(double minedge)
Definition: BidirectionalDijkstra.h:36
AStarOpenClosed.h
BIdijkstra::GetForwardItem
const AStarOpenClosedData< state > & GetForwardItem(unsigned int which)
Definition: BidirectionalDijkstra.h:55
BIdijkstra::GetNodesExpanded_NN_PathCost
uint64_t GetNodesExpanded_NN_PathCost() const
Definition: BidirectionalDijkstra.h:62
BIdijkstra::ResetNodeCount
void ResetNodeCount()
Definition: BidirectionalDijkstra.h:49
BIdijkstra::GetNodesTouched
uint64_t GetNodesTouched() const
Definition: BidirectionalDijkstra.h:60
BIdijkstra::GetNodesExpanded_NF_PathCost
uint64_t GetNodesExpanded_NF_PathCost() const
Definition: BidirectionalDijkstra.h:63
BIdijkstra::middleNode2
uint64_t middleNode2
Definition: BidirectionalDijkstra.h:89
BIdijkstra::currentCost
double currentCost
Definition: BidirectionalDijkstra.h:90
BDCompare
Definition: BidirectionalDijkstra.h:16
BIdijkstra::GetNodesExpanded_RN_PathLength
uint64_t GetNodesExpanded_RN_PathLength() const
Definition: BidirectionalDijkstra.h:73
BIdijkstra::GetNodesExpanded_NF_PathLength
uint64_t GetNodesExpanded_NF_PathLength() const
Definition: BidirectionalDijkstra.h:70
BIdijkstra::GetNumForwardItems
const int GetNumForwardItems()
Definition: BidirectionalDijkstra.h:51
BIdijkstra::nodesExpanded_NN_PathCost
uint64_t nodesExpanded_NN_PathCost
Definition: BidirectionalDijkstra.h:98
FPUtil.h
BIdijkstra::backwardQueue
priorityQueue backwardQueue
Definition: BidirectionalDijkstra.h:43
AStarOpenClosedData::where
dataLocation where
Definition: AStarOpenClosed.h:69
BIdijkstra::nodesTouched
uint64_t nodesTouched
Definition: BidirectionalDijkstra.h:86
BIdijkstra::nodesExpanded_FN_PathCost
uint64_t nodesExpanded_FN_PathCost
Definition: BidirectionalDijkstra.h:98
BIdijkstra::optimalPathCost
double optimalPathCost
Definition: BidirectionalDijkstra.h:102
BIdijkstra::SetVersion
void SetVersion(int v)
Definition: BidirectionalDijkstra.h:34
AStarOpenClosedData::g
double g
Definition: AStarOpenClosed.h:64
BIdijkstra::nodesExpanded_RN_PathLength
uint64_t nodesExpanded_RN_PathLength
Definition: BidirectionalDijkstra.h:100
BIdijkstra::GetNodesExpanded_FN_PathCost
uint64_t GetNodesExpanded_FN_PathCost() const
Definition: BidirectionalDijkstra.h:64
BIdijkstra::nodesExpanded_FN_PathLength
uint64_t nodesExpanded_FN_PathLength
Definition: BidirectionalDijkstra.h:100
BIdijkstra
Definition: BidirectionalDijkstra.h:25
BIdijkstra::GetNodesExpanded_RF_PathLength
uint64_t GetNodesExpanded_RF_PathLength() const
Definition: BidirectionalDijkstra.h:74
loc
Definition: MapGenerators.cpp:296
BIdijkstra::countRegions
bool countRegions
Definition: BidirectionalDijkstra.h:96
BIdijkstra::GetNodesExpanded_FN_PathLength
uint64_t GetNodesExpanded_FN_PathLength() const
Definition: BidirectionalDijkstra.h:71
BIdijkstra::nodesExpanded_FF_PathCost
uint64_t nodesExpanded_FF_PathCost
Definition: BidirectionalDijkstra.h:98
BIdijkstra::nodesExpanded_RF_PathLength
uint64_t nodesExpanded_RF_PathLength
Definition: BidirectionalDijkstra.h:100
BIdijkstra::nodesExpanded_NF_PathLength
uint64_t nodesExpanded_NF_PathLength
Definition: BidirectionalDijkstra.h:100
BIdijkstra::GetName
virtual const char * GetName()
Definition: BidirectionalDijkstra.h:47
BIdijkstra::GetVersion
int GetVersion()
Definition: BidirectionalDijkstra.h:35
BIdijkstra::GetNodesExpanded_NN_PathLength
uint64_t GetNodesExpanded_NN_PathLength() const
Definition: BidirectionalDijkstra.h:69
BIdijkstra::OpenGLDraw
void OpenGLDraw() const
Definition: BidirectionalDijkstra.h:435
BIdijkstra::nodesExpanded_NF_PathCost
uint64_t nodesExpanded_NF_PathCost
Definition: BidirectionalDijkstra.h:98
BIdijkstra::GetEpsilon
double GetEpsilon()
Definition: BidirectionalDijkstra.h:39
BIdijkstra::forwardDirection
bool forwardDirection
Definition: BidirectionalDijkstra.h:104
fless
bool fless(double a, double b)
Definition: FPUtil.h:28
BIdijkstra::~BIdijkstra
virtual ~BIdijkstra()
Definition: BidirectionalDijkstra.h:28
AStarOpenClosedData
Definition: AStarOpenClosed.h:52
BDCompare::operator()
bool operator()(const AStarOpenClosedData< state > &i1, const AStarOpenClosedData< state > &i2) const
Definition: BidirectionalDijkstra.h:17
BIdijkstra::start
state start
Definition: BidirectionalDijkstra.h:44
BIdijkstra::nodesExpanded_FF_PathLength
uint64_t nodesExpanded_FF_PathLength
Definition: BidirectionalDijkstra.h:100
BIdijkstra::DoSingleSearchStep
bool DoSingleSearchStep(std::vector< state > &thePath)
Definition: BidirectionalDijkstra.h:142
BIdijkstra::turn
int turn
Definition: BidirectionalDijkstra.h:94
BIdijkstra::env
environment * env
Definition: BidirectionalDijkstra.h:92
BIdijkstra::InitializeSearch
bool InitializeSearch(environment *env, const state &from, const state &to, std::vector< state > &thePath)
Definition: BidirectionalDijkstra.h:119
fgreater
bool fgreater(double a, double b)
Definition: FPUtil.h:29
BIdijkstra::BIdijkstra
BIdijkstra()
Definition: BidirectionalDijkstra.h:27
BIdijkstra::GetNodesExpanded
uint64_t GetNodesExpanded() const
Definition: BidirectionalDijkstra.h:59
BIdijkstra::GetPathCost
double GetPathCost() const
Definition: BidirectionalDijkstra.h:76
kOpenList
@ kOpenList
Definition: AStarOpenClosed.h:28
BIdijkstra::DoRegionAnalysis
void DoRegionAnalysis(environment *env, const state &from, const state &to, double optimalPathCost, uint64_t optimalPathLength)
Definition: BidirectionalDijkstra.h:486
BIdijkstra::GetNumBackwardItems
const int GetNumBackwardItems()
Definition: BidirectionalDijkstra.h:53
BIdijkstra::Expand
void Expand(priorityQueue &current, priorityQueue &opposite, const state &target)
Definition: BidirectionalDijkstra.h:254
BIdijkstra::GetNodesExpanded_FF_PathLength
uint64_t GetNodesExpanded_FF_PathLength() const
Definition: BidirectionalDijkstra.h:72
BIdijkstra::GetNodesExpanded_RF_PathCost
uint64_t GetNodesExpanded_RF_PathCost() const
Definition: BidirectionalDijkstra.h:67
BIdijkstra::goal
state goal
Definition: BidirectionalDijkstra.h:44
BIdijkstra::epsilon
double epsilon
Definition: BidirectionalDijkstra.h:93
BIdijkstra::GetBackwardItem
const AStarOpenClosedData< state > & GetBackwardItem(unsigned int which)
Definition: BidirectionalDijkstra.h:57
BIdijkstra::optimalPathLength
double optimalPathLength
Definition: BidirectionalDijkstra.h:103
BIdijkstra::GetNodesExpanded_FF_PathCost
uint64_t GetNodesExpanded_FF_PathCost() const
Definition: BidirectionalDijkstra.h:65
kNotFound
@ kNotFound
Definition: AStarOpenClosed.h:30
BIdijkstra::version
int version
Definition: BidirectionalDijkstra.h:95
BIdijkstra::neighbors
std::vector< state > neighbors
Definition: BidirectionalDijkstra.h:91
BIdijkstra::GetPathLength
uint64_t GetPathLength() const
Definition: BidirectionalDijkstra.h:77
BIdijkstra::GetPath
void GetPath(environment *env, const state &from, const state &to, std::vector< state > &thePath)
Definition: BidirectionalDijkstra.h:108
kClosedList
@ kClosedList
Definition: AStarOpenClosed.h:29
BIdijkstra::forwardQueue
priorityQueue forwardQueue
Definition: BidirectionalDijkstra.h:43
BIdijkstra::nodesExpanded
uint64_t nodesExpanded
Definition: BidirectionalDijkstra.h:86