Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# AStarSearch< N, P, U > Class Template Reference

An abstract implementation of the A* search algorithm. More...

`#include <AStarSearch.h>`

Collaboration diagram for AStarSearch< N, P, U >:

[legend]
List of all members.

## Public Member Functions
| AStarSearch (long minCacheSize, long maxTreeSize, P parameterSet)
| Constructor.
N | search (const N &start, const N &goal, const P &parameterSet, U &pathLength)
| The main search function.
## Private Member Functions
unsigned int | findIndexOfNextNode ()
| Finds the next node to be expanded.
int | testNewNodesAgainstGoal (unsigned int firstNode, unsigned int lastNode, const N &goal)
| Tests if any node has reached the goal.
N | backtraceNode (unsigned int indexOfBestNode, U &pathLength)
| Backtraces the best node found to the first node after the start node.
void | draw (unsigned int indexOfBestNode)
| Draw all expanded paths and the selected path on the RobotControl field view.
## Private Attributes
std::vector< N > | searchTree
| A container for all nodes.
std::vector< unsigned int > | expandedNodes
| Indizes of all expanded nodes.
long | maxTreeSize
| The maximum number of nodes to expand.
P | parameterSet
| The parameter set.

## 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,
|  | P | 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.

## Member Function Documentation

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. Referenced by Motionfield::getFieldVecFromAStarSearch().

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. Referenced by AStarSearch< PotentialfieldAStarNode, PotentialfieldAStarParameterSet, double >::search().

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. Referenced by AStarSearch< PotentialfieldAStarNode, PotentialfieldAStarParameterSet, double >::search().

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. Referenced by AStarSearch< PotentialfieldAStarNode, PotentialfieldAStarParameterSet, double >::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. Referenced by AStarSearch< PotentialfieldAStarNode, PotentialfieldAStarParameterSet, double >::search().

## Member Data Documentation

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.

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.

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.

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.

The documentation for this class was generated from the following file:

- Tools/PotentialFields/AStarSearch.h