Go to the documentation of this file.
27 return "CFOptimalRefinement";
49 printf(
"Analyzing %d next\n", gNext->
GetNum());
50 std::cout << *gNext << std::endl;
53 printf(
"Updating node %d\n", gNext->
GetNum());
57 printf(
"Refining node %d\n", gNext->
GetNum());
92 if ((one == 0) || (two == 0))
103 if ((tmp == 0) && (one == two))
131 std::cout <<
"Assigning start to " << *gNewNode << std::endl;
136 std::cout <<
"Assigning goal to " << *gNewNode << std::endl;
144 std::cout <<
"After UpdateH " << *gNode << std::endl;
146 std::cout <<
"After UpdateG " << *gNode << std::endl;
148 std::cout <<
"After UpdateOptH " << *gNode << std::endl;
155 double minH = DBL_MAX;
163 if (
fless(tmpH, minH))
178 double minG = DBL_MAX;
186 if (
fless(tmpG, minG))
247 std::vector<node *> aChildren;
248 std::vector<node *> gChildren;
256 for (
unsigned int x = 0; x < aChildren.size(); x++)
258 gChildren.push_back(
new node(
"child"));
266 for (
unsigned int x = 0; x < gChildren.size(); x++)
268 for (
unsigned int y = 0; y < gChildren.size(); y++)
273 if ((e = aGraph->
findDirectedEdge(aChildren[x]->GetNum(), aChildren[y]->GetNum())) != 0)
275 g->
AddEdge(
new edge(gChildren[x]->GetNum(), gChildren[y]->GetNum(),
290 for (
unsigned int x = 0; x < gChildren.size(); x++)
302 for (
unsigned int x = 0; x < aChildren.size(); x++)
309 for (
unsigned int x = 0; x < aChildren.size(); x++)
354 glColor3f(1.0, 0.0, 1.0);
357 else if (n1 ==
gGoal)
360 glColor3f(1.0, 1.0, 0);
362 glColor3f(0.6, 0.6, 0);
364 glColor3f(0.5, 0.5, 0.5);
368 node *n = 0; assert(
false);
370 glVertex3f(rv.
x, rv.
y, rv.
z);
374 glColor3f(1.0, 0.0, 1.0);
380 glColor3f(1.0, 1.0, 0);
382 glColor3f(0.6, 0.6, 0);
384 glColor3f(0.5, 0.5, 0.5);
389 glVertex3f(rv.
x, rv.
y, rv.
z);
A generic class for basic operations on Graph abstractions.
void SetLabelL(unsigned int index, long val) const
void SetLabelF(unsigned int index, double val) const
node * RemoveNode(node *, unsigned int &)
void RefineNode(node *gNode)
edge * FindEdge(unsigned int from, unsigned int to)
Finds an edge between nodes with ids from and to, no matter which direction.
A generic vector (essentially the same as a point, but offers normalization)
unsigned int neighbor_iterator
Graph * GetAbstractGraph(int level)
return the abstract Graph at the given level
void UpdateH(node *gNode)
virtual path * GetPath(GraphAbstraction *aMap, node *from, node *to, reservationProvider *rp=0)
void DecreaseKey(OBJ val)
Indicate that the key for a particular object has decreased.
void UpdateNode(node *gNode)
std::vector< edge * >::const_iterator edge_iterator
node * GetNthChild(node *which, int n)
node * GetNode(unsigned long num)
edge * edgeIterNext(edge_iterator &) const
bool InitializeSearch(GraphAbstraction *aMap, node *from, node *to)
void MakeNeighborsOpen(node *gNode)
long GetAbstractionLevel(node *which)
virtual double h(node *a, node *b)=0
heuristic cost between any two nodes
edge_iterator getEdgeIter() const
void SetInitialValues(node *gNewNode, node *aRealNode, node *gParent)
void Add(OBJ val)
Add object into OpenClosedList.
bool fless(double a, double b)
long GetNumChildren(node *which)
virtual const char * GetName()
bool fgreater(double a, double b)
int nodeNeighborNext(neighbor_iterator &) const
void UpdateOptH(node *gNode)
void UpdateG(node *gNode)
unsigned int getNumAbstractGraphs()
return the total number of graphs in the hierarchy
std::vector< xyLoc > path
bool ShouldAddEdge(node *aLowerNode, node *aHigherNode)
double GetLabelF(unsigned int index) const
unsigned int GetNum() const
A generic algorithm which can be used for pathfinding.
virtual ~CFOptimalRefinement()
bool IsParentOf(node *parent, node *child)
return true if the first node is a parent of or is equal two the second node
virtual recVec GetNodeLoc(node *) const
long GetLabelL(unsigned int index) const
A linked list of nodes which form a continuous path.
neighbor_iterator getNeighborIter() const
GraphAbstraction * absGraph
edge * findDirectedEdge(unsigned int from, unsigned int to)
bool fequal(double a, double b, double tolerance=TOLERANCE)
node * GetParent(node *which)
node * FindTopLevelNode(node *one, node *two, GraphAbstraction *aMap)
node * GetRealNode(node *gNode) const
Nodes to be stored within a Graph.
Edge class for connections between node in a Graph.