AStarSearch< N, P, U > Class Template Reference

#include <AStarSearch.h>

List of all members.

Public Member Functions

 AStarSearch (long minCacheSize, long maxTreeSize, P parameterSet)
search (const N &start, const N &goal, const P &parameterSet, U &pathLength)

Private Member Functions

unsigned int findIndexOfNextNode ()
int testNewNodesAgainstGoal (unsigned int firstNode, unsigned int lastNode, const N &goal)
backtraceNode (unsigned int indexOfBestNode, U &pathLength)
void draw (unsigned int indexOfBestNode)

Private Attributes

std::vector< N > searchTree
std::vector< unsigned int > expandedNodes
long maxTreeSize
parameterSet


Detailed Description

template<class N, class P, class U>
class AStarSearch< N, P, U >

An abstract implementation of the A* search algorithm. Works with any appropriate type N of nodes, type P of parameter sets and type U of unit

Definition at line 241 of file AStarSearch.h.


Constructor & Destructor Documentation

template<class N, class P, class U>
AStarSearch< N, P, U >::AStarSearch ( long  minCacheSize,
long  maxTreeSize,
parameterSet 
) [inline]

Constructor

Parameters:
minCacheSize The number of nodes to allocate memory for
maxTreeSize The maximum number of nodes to expand
parameterSet A parameter set to check the maximum number of nodes to expand

Definition at line 249 of file AStarSearch.h.

References AStarSearch< N, P, U >::expandedNodes, and AStarSearch< N, P, U >::searchTree.


Member Function Documentation

template<class N, class P, class U>
N AStarSearch< N, P, U >::backtraceNode ( unsigned int  indexOfBestNode,
U &  pathLength 
) [inline, private]

Backtraces the best node found to the first node after the start node

Parameters:
indexOfBestNode The index of the best node found
pathLength Returns the length of the backtraced path
Returns:
The root node of the path to the node

Definition at line 379 of file AStarSearch.h.

References AStarSearch< N, P, U >::searchTree.

Referenced by AStarSearch< N, P, U >::search().

template<class N, class P, class U>
void AStarSearch< N, P, U >::draw ( unsigned int  indexOfBestNode  )  [inline, private]

Draw all expanded paths and the selected path on the RobotControl field view

Parameters:
indexOfBestNode The index of the last expanded node

Definition at line 395 of file AStarSearch.h.

References LARGE_DOT, LINE, AStarSearch< N, P, U >::parameterSet, PfPose::pos, Drawings::ps_solid, Drawings::red, AStarSearch< N, P, U >::searchTree, PfVec::x, PfVec::y, and Drawings::yellow.

Referenced by AStarSearch< N, P, U >::search().

template<class N, class P, class U>
unsigned int AStarSearch< N, P, U >::findIndexOfNextNode (  )  [inline, private]

Finds the next node to be expanded

Returns:
The index of the node

Definition at line 333 of file AStarSearch.h.

References AStarSearch< N, P, U >::searchTree.

Referenced by AStarSearch< N, P, U >::search().

template<class N, class P, class U>
N AStarSearch< N, P, U >::search ( const N &  start,
const N &  goal,
const P &  parameterSet,
U &  pathLength 
) [inline]

The main search function

Parameters:
start The starting node
goal The goal node
parameterSet The current parameter set
pathLength Returns the length of the path to the goal
Returns:
The next node to go to

Definition at line 274 of file AStarSearch.h.

References AStarSearch< N, P, U >::backtraceNode(), COMPLEX_DRAWING, DEBUG_DRAWING_FINISHED, AStarSearch< N, P, U >::draw(), AStarSearch< N, P, U >::expandedNodes, AStarSearch< N, P, U >::findIndexOfNextNode(), int(), AStarSearch< N, P, U >::maxTreeSize, AStarSearch< N, P, U >::searchTree, and AStarSearch< N, P, U >::testNewNodesAgainstGoal().

Referenced by Motionfield::getFieldVecFromAStarSearch().

template<class N, class P, class U>
int AStarSearch< N, P, U >::testNewNodesAgainstGoal ( unsigned int  firstNode,
unsigned int  lastNode,
const N &  goal 
) [inline, private]

Tests if any node has reached the goal

Parameters:
firstNode The first node to test
lastNode The last node to test
goal The goal to test against
Returns:
-1, if no node has reached the goal, the number of the node otherwise

Definition at line 360 of file AStarSearch.h.

References AStarSearch< N, P, U >::parameterSet, and AStarSearch< N, P, U >::searchTree.

Referenced by AStarSearch< N, P, U >::search().


Member Data Documentation

template<class N, class P, class U>
std::vector<unsigned int> AStarSearch< N, P, U >::expandedNodes [private]

Indizes of all expanded nodes

Definition at line 323 of file AStarSearch.h.

Referenced by AStarSearch< N, P, U >::AStarSearch(), and AStarSearch< N, P, U >::search().

template<class N, class P, class U>
long AStarSearch< N, P, U >::maxTreeSize [private]

The maximum number of nodes to expand

Definition at line 325 of file AStarSearch.h.

Referenced by AStarSearch< N, P, U >::search().

template<class N, class P, class U>
P AStarSearch< N, P, U >::parameterSet [private]

The parameter set

Definition at line 327 of file AStarSearch.h.

Referenced by AStarSearch< N, P, U >::draw(), and AStarSearch< N, P, U >::testNewNodesAgainstGoal().

template<class N, class P, class U>
std::vector<N> AStarSearch< N, P, U >::searchTree [private]

A container for all nodes

Definition at line 321 of file AStarSearch.h.

Referenced by AStarSearch< N, P, U >::AStarSearch(), AStarSearch< N, P, U >::backtraceNode(), AStarSearch< N, P, U >::draw(), AStarSearch< N, P, U >::findIndexOfNextNode(), AStarSearch< N, P, U >::search(), and AStarSearch< N, P, U >::testNewNodesAgainstGoal().


The documentation for this class was generated from the following file:
Generated on Thu Dec 7 01:18:51 2006 for DT2005.panorama by  doxygen 1.4.7