Go to the documentation of this file.
13 #define HEURISTIC_COLOR
14 #define MAX_HEURISTIC_VALUE 50.0
15 #define PATHMAX // Not necessary, but improves performance for inconsistent heuristics
134 if ((one == 0) || (two == 0))
145 if ((tmp == 0) && (one == two))
197 bool changedNodeH =
false;
306 std::vector<node*> nodes;
308 for (
unsigned int x = 0; x < nodes.size(); x++)
337 nodes.push_back(goal);
339 for (
unsigned int x = 0; x < nodes.size(); x++)
341 node *gNode = nodes[x];
356 nodes.push_back(gNeighbor);
380 return new path(gNode, 0);
394 std::vector<node *> aChildren;
395 std::vector<node *> gChildren;
403 for (
unsigned int x = 0; x < aChildren.size(); x++)
405 gChildren.push_back(
new node(
"child"));
415 for (
unsigned int x = 0; x < gChildren.size(); x++)
417 for (
unsigned int y = 0; y < gChildren.size(); y++)
422 if ((e = aGraph->
findDirectedEdge(aChildren[x]->GetNum(), aChildren[y]->GetNum())) != 0)
424 g->
AddEdge(
new edge(gChildren[x]->GetNum(), gChildren[y]->GetNum(), 1.0));
439 for (
unsigned int x = 0; x < gChildren.size(); x++)
451 for (
unsigned int x = 0; x < aChildren.size(); x++)
458 for (
unsigned int x = 0; x < aChildren.size(); x++)
502 #ifdef HEURISTIC_COLOR
529 glVertex3f(rv.
x, rv.
y, rv.
z);
558 glColor3f(1.0, 0.0, 1.0);
564 glColor3f(1.0, 1.0, 0);
566 glColor3f(0.5, 0.5, 0.5);
571 glVertex3f(rv.
x, rv.
y, rv.
z);
575 glColor3f(1.0, 0.0, 1.0);
581 glColor3f(1.0, 1.0, 0);
583 glColor3f(0.5, 0.5, 0.5);
590 glVertex3f(rv.
x, rv.
y, rv.
z);
601 NodeLookupTable::iterator ni ;
606 node * n = ni->second.n;
A generic class for basic operations on Graph abstractions.
void SetLabelL(unsigned int index, long val) const
void SetHCost(node *, double)
void ExpandNeighbors(node *gNode)
void SetLabelF(unsigned int index, double val) const
node * RemoveNode(node *, unsigned int &)
void GetAllSolutionNodes(node *goal, std::vector< node * > &nodes)
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
IRAStarConstants::Caching caching
double GetGCost(node *) const
void DecreaseKey(OBJ val)
Indicate that the key for a particular object has decreased.
GraphAbstraction * absGraph
#define MAX_HEURISTIC_VALUE
bool Inconsistent(node *gNode)
std::vector< edge * >::const_iterator edge_iterator
node * GetRealNode(node *gNode) const
node * GetNthChild(node *which, int n)
bool IsIn(const OBJ val) const
Returns true if the object is in the OpenClosedList.
node * GetNode(unsigned long num)
edge * edgeIterNext(edge_iterator &) const
void SetInitialValues(node *gNewNode, node *aRealNode, node *gParent)
double GetHCost(node *) const
virtual path * GetPath(GraphAbstraction *aMap, node *from, node *to, reservationProvider *rp=0)
double GetFCost(node *) const
long GetAbstractionLevel(node *which)
edge_iterator getEdgeIter() const
node * FindTopLevelNode(node *one, node *two, GraphAbstraction *aMap)
void Add(OBJ val)
Add object into OpenClosedList.
unsigned length(void)
returns the number of steps along the path
bool fless(double a, double b)
long GetNumChildren(node *which)
Caching
Definitions for the constructor.
void SetGCost(node *, double)
virtual const char * GetName()
bool InitializeSearch(GraphAbstraction *aMap, node *from, node *to)
bool fgreater(double a, double b)
int nodeNeighborNext(neighbor_iterator &) const
unsigned int getNumAbstractGraphs()
return the total number of graphs in the hierarchy
std::vector< xyLoc > path
path * GetSolution(node *gNode)
path * ExtractAndRefinePath()
double GetLabelF(unsigned int index) const
void RefineNode(node *gNode)
unsigned int GetNum() const
bool ShouldAddEdge(node *aLowerNode, node *aHigherNode)
A generic algorithm which can be used for pathfinding.
IRAStarConstants::PQueue q
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
IRAStar(IRAStarConstants::Caching caching=IRAStarConstants::P_G_CACHING)
edge * findDirectedEdge(unsigned int from, unsigned int to)
bool fequal(double a, double b, double tolerance=TOLERANCE)
node * GetParent(node *which)
std::vector< double > iterationLimits
void reset()
Remove all objects from queue.
IRAStarConstants::NodeLookupTable closedList
Nodes to be stored within a Graph.
Edge class for connections between node in a Graph.