Batch Informed Trees (BIT*) More...

`#include <ompl/geometric/planners/bitstar/BITstar.h>`

## Classes | |

class | CostHelper |

A helper class to handle the various heuristic functions in one place. More... | |

class | IdGenerator |

An ID generator class for vertex IDs. More... | |

class | ImplicitGraph |

A conceptual representation of samples as an edge-implicit random geometric graph. More... | |

class | SearchQueue |

A queue of edges to be processed that integrates both the expansion of Vertices and the ordering of the resulting edges. More... | |

class | Vertex |

The vertex of the underlying graphs in BIT*. More... | |

## Public Types | |

typedef std::shared_ptr< Vertex > | VertexPtr |

A vertex shared pointer. | |

typedef std::shared_ptr< const Vertex > | VertexConstPtr |

A constant vertex shared pointer. | |

typedef std::weak_ptr< Vertex > | VertexWeakPtr |

A vertex weak pointer. | |

typedef std::vector< VertexPtr > | VertexPtrVector |

A vector of shared pointers. | |

typedef std::vector< VertexConstPtr > | VertexConstPtrVector |

A vector of shared const pointers. | |

typedef unsigned int | VertexId |

The vertex id type. | |

typedef std::pair< VertexPtr, VertexPtr > | VertexPtrPair |

A pair of vertices, i.e., an edge. | |

typedef std::pair< VertexConstPtr, VertexConstPtr > | VertexConstPtrPair |

A pair of const vertices, i.e., an edge. | |

typedef std::vector< VertexPtrPair > | VertexPtrPairVector |

A vector of pairs of vertices, i.e., a vector of edges. | |

typedef std::vector< VertexConstPtrPair > | VertexConstPtrPairVector |

A vector of pairs of const vertices, i.e., a vector of edges. | |

typedef std::shared_ptr< NearestNeighbors< VertexPtr > > | VertexPtrNNPtr |

The OMPL::NearestNeighbors structure. | |

typedef std::shared_ptr< CostHelper > | CostHelperPtr |

A cost helper shared pointer. | |

typedef std::shared_ptr< ImplicitGraph > | ImplicitGraphPtr |

An implicit graph shared pointer. | |

typedef std::shared_ptr< SearchQueue > | SearchQueuePtr |

An search queue shared pointer. | |

typedef std::function< std::string()> | NameFunc |

A utility functor for ImplicitGraph and SearchQueue. | |

Public Types inherited from ompl::base::Planner | |

typedef std::function< std::string()> | PlannerProgressProperty |

Definition of a function which returns a property about the planner's progress that can be queried by a benchmarking routine. | |

typedef std::map< std::string, PlannerProgressProperty > | PlannerProgressProperties |

A dictionary which maps the name of a progress property to the function to be used for querying that property. | |

## Public Member Functions | |

BITstar (const base::SpaceInformationPtr &si, const std::string &name="BITstar") | |

Construct! | |

~BITstar () override=default | |

Destruct! | |

void | setup () override |

Setup. | |

void | clear () override |

Clear. | |

base::PlannerStatus | solve (const base::PlannerTerminationCondition &ptc) override |

Solve. | |

void | getPlannerData (base::PlannerData &data) const override |

Get results. | |

std::pair< const ompl::base::State *, const ompl::base::State * > | getNextEdgeInQueue () |

Get the next edge to be processed. Causes vertices in the queue to be expanded (if necessary) and therefore effects the run timings of the algorithm, but helpful for some videos and debugging. | |

ompl::base::Cost | getNextEdgeValueInQueue () |

Get the value of the next edge to be processed. Causes vertices in the queue to be expanded (if necessary) and therefore effects the run timings of the algorithm, but helpful for some videos and debugging. | |

void | getEdgeQueue (VertexConstPtrPairVector *edgesInQueue) |

Get the whole messy set of edges in the queue. Expensive but helpful for some videos. | |

void | getVertexQueue (VertexConstPtrVector *verticesInQueue) |

Get the whole set of vertices to be expanded. Expensive but helpful for some videos. | |

unsigned int | numIterations () const |

Get the number of iterations completed. | |

ompl::base::Cost | bestCost () const |

Retrieve the best exact-solution cost found. | |

unsigned int | numBatches () const |

Retrieve the number of batches processed as the raw data. (numBatches_) | |

void | setRewireFactor (double rewireFactor) |

Set the rewiring scale factor, s, such that r_rrg = s r_rrg*. | |

double | getRewireFactor () const |

Get the rewiring scale factor. | |

void | setSamplesPerBatch (unsigned int n) |

Set the number of samplers per batch. | |

unsigned int | getSamplesPerBatch () const |

Get the number of samplers per batch. | |

void | setUseKNearest (bool useKNearest) |

Enable a k-nearest search for instead of an r-disc search. | |

bool | getUseKNearest () const |

Get whether a k-nearest search is being used. | |

void | setStrictQueueOrdering (bool beStrict) |

Enable "strict sorting" of the edge queue. Rewirings can change the position in the queue of an edge. When strict sorting is enabled, the effected edges are resorted immediately, while disabling strict sorting delays this resorting until the end of the batch. | |

bool | getStrictQueueOrdering () const |

Get whether strict queue ordering is in use. | |

void | setPruning (bool prune) |

Enable pruning of vertices/samples that CANNOT improve the current solution. When a vertex in the graph is pruned, it's descendents are also pruned (if they also cannot improve the solution) or placed back in the set of free samples (if they could improve the solution). This assures that a uniform density is maintained. | |

bool | getPruning () const |

Get whether graph and sample pruning is in use. | |

void | setPruneThresholdFraction (double fractionalChange) |

Set the fractional change in the solution cost AND problem measure necessary for pruning to occur. | |

double | getPruneThresholdFraction () const |

Get the fractional change in the solution cost AND problem measure necessary for pruning to occur. | |

void | setDelayRewiringUntilInitialSolution (bool delayRewiring) |

Delay the consideration of rewiring edges until an initial solution is found. When multiple batches are required to find an initial solution, this can improve the time required to do so, by delaying improvements in the cost-to-come to a connected vertex. As the rewiring edges are considered once an initial solution is found, this has no effect on the theoretical asymptotic optimality of the planner. More... | |

bool | getDelayRewiringUntilInitialSolution () const |

Get whether BIT* is delaying rewiring until a solution is found. | |

void | setJustInTimeSampling (bool useJit) |

Delay the generation of samples until they are necessary. This only works when using an r-disc connection scheme, and is currently only implemented for problems seeking to minimize path length. This helps reduce the complexity of nearest-neighbour look ups, and can be particularly beneficial in unbounded planning problems where selecting an appropriate bounding box is difficult. With JIT sampling enabled, BIT* can solve planning problems whose state space has infinite boundaries. When enumerating outgoing edges from a vertex, BIT* uses JIT sampling to assure that the area within r of the vertex has been sampled during this batch. This is done in a way that maintains uniform sample distribution and has no effect on the theoretical asymptotic optimality of the planner. More... | |

bool | getJustInTimeSampling () const |

Get whether we're using just-in-time sampling. | |

void | setDropSamplesOnPrune (bool dropSamples) |

Drop all unconnected samples when pruning, regardless of their heuristic value. This provides a method for BIT* to remove samples that have not been connected to the graph and may be beneficial in problems where portions of the free space are unreachable (i.e., disconnected). BIT* calculates the connection radius for each batch from the underlying uniform distribution of states. The resulting larger connection radius may be detrimental in areas where the graph is dense, but maintains the theoretical asymptotic optimality of the planner. More... | |

bool | getDropSamplesOnPrune () const |

Get whether unconnected samples are dropped on pruning. | |

void | setStopOnSolnImprovement (bool stopOnChange) |

Stop the planner each time a solution improvement is found. Useful for examining the intermediate solutions found by BIT*. | |

bool | getStopOnSolnImprovement () const |

Get whether BIT* stops each time a solution is found. | |

void | setConsiderApproximateSolutions (bool findApproximate) |

Set BIT* to consider approximate solutions during its initial search. | |

bool | getConsiderApproximateSolutions () const |

Get whether BIT* is considering approximate solutions. | |

template<template< typename T > class NN> | |

void | setNearestNeighbors () |

Set a different nearest neighbours datastructure. | |

Public Member Functions inherited from ompl::base::Planner | |

Planner (const Planner &)=delete | |

Planner & | operator= (const Planner &)=delete |

Planner (SpaceInformationPtr si, std::string name) | |

Constructor. | |

virtual | ~Planner ()=default |

Destructor. | |

template<class T > | |

T * | as () |

Cast this instance to a desired type. More... | |

template<class T > | |

const T * | as () const |

Cast this instance to a desired type. More... | |

const SpaceInformationPtr & | getSpaceInformation () const |

Get the space information this planner is using. | |

const ProblemDefinitionPtr & | getProblemDefinition () const |

Get the problem definition the planner is trying to solve. | |

const PlannerInputStates & | getPlannerInputStates () const |

Get the planner input states. | |

virtual void | setProblemDefinition (const ProblemDefinitionPtr &pdef) |

Set the problem definition for the planner. The problem needs to be set before calling solve(). Note: If this problem definition replaces a previous one, it may also be necessary to call clear(). | |

PlannerStatus | solve (const PlannerTerminationConditionFn &ptc, double checkInterval) |

Same as above except the termination condition is only evaluated at a specified interval. | |

PlannerStatus | solve (double solveTime) |

Same as above except the termination condition is solely a time limit: the number of seconds the algorithm is allowed to spend planning. | |

const std::string & | getName () const |

Get the name of the planner. | |

void | setName (const std::string &name) |

Set the name of the planner. | |

const PlannerSpecs & | getSpecs () const |

Return the specifications (capabilities of this planner) | |

virtual void | checkValidity () |

Check to see if the planner is in a working state (setup has been called, a goal was set, the input states seem to be in order). In case of error, this function throws an exception. | |

bool | isSetup () const |

Check if setup() was called for this planner. | |

ParamSet & | params () |

Get the parameters for this planner. | |

const ParamSet & | params () const |

Get the parameters for this planner. | |

const PlannerProgressProperties & | getPlannerProgressProperties () const |

Retrieve a planner's planner progress property map. | |

virtual void | printProperties (std::ostream &out) const |

Print properties of the motion planner. | |

virtual void | printSettings (std::ostream &out) const |

Print information about the motion planner's settings. | |

## Additional Inherited Members | |

Protected Member Functions inherited from ompl::base::Planner | |

template<typename T , typename PlannerType , typename SetterType , typename GetterType > | |

void | declareParam (const std::string &name, const PlannerType &planner, const SetterType &setter, const GetterType &getter, const std::string &rangeSuggestion="") |

This function declares a parameter for this planner instance, and specifies the setter and getter functions. | |

template<typename T , typename PlannerType , typename SetterType > | |

void | declareParam (const std::string &name, const PlannerType &planner, const SetterType &setter, const std::string &rangeSuggestion="") |

This function declares a parameter for this planner instance, and specifies the setter function. | |

void | addPlannerProgressProperty (const std::string &progressPropertyName, const PlannerProgressProperty &prop) |

Add a planner progress property called progressPropertyName with a property querying function prop to this planner's progress property map. | |

Protected Attributes inherited from ompl::base::Planner | |

SpaceInformationPtr | si_ |

The space information for which planning is done. | |

ProblemDefinitionPtr | pdef_ |

The user set problem definition. | |

PlannerInputStates | pis_ |

Utility class to extract valid input states. | |

std::string | name_ |

The name of this planner. | |

PlannerSpecs | specs_ |

The specifications of the planner (its capabilities) | |

ParamSet | params_ |

A map from parameter names to parameter instances for this planner. This field is populated by the declareParam() function. | |

PlannerProgressProperties | plannerProgressProperties_ |

A mapping between this planner's progress property names and the functions used for querying those progress properties. | |

bool | setup_ |

Flag indicating whether setup() has been called. | |

## Detailed Description

Batch Informed Trees (BIT*)

BIT* (Batch Informed Trees) is an *anytime* asymptotically optimal sampling-based planning algorithm. It approaches problems by assuming that a *simple* solution exists and only goes onto consider *complex* solutions when that proves incorrect. It accomplishes this by using heuristics to search in order of decreasing potential solution quality.

Both a k-nearest and r-disc version are available, with the k-nearest selected by default. In general, the r-disc variant considers more connections than the k-nearest. For a small number of specific planning problems, this results in it finding solutions slower than k-nearest (hence the default choice). It is recommended that you try both variants, with the r-disc version being recommended *if* it finds an initial solution in a suitable amount of time (which it probably will). The difference in this number of connections considered is a RGG theory question, and certainly merits further review.

This implementation of BIT* can handle multiple starts, multiple goals, a variety of optimization objectives (e.g., path length), and with just-in-time sampling, infinite problem domains. Note that for some of optimization objectives, the user must specify a suitable heuristic and that when this heuristic is not specified, it will use the conservative/always admissible *zero-heuristic*.

This implementation also includes some new advancements, including the ability to prioritize exploration until an initial solution is found (Delayed rewiring), the ability to generate samples only when necessary (Just-in-time sampling), and the ability to periodically remove samples that have yet to be connected to the graph (Sample dropping). With just-in-time sampling, BIT* can even solve planning problems with infinite state space boundaries, i.e., (-inf, inf).

- Associated publication:

J. D. Gammell, S. S. Srinivasa, T. D. Barfoot, "Batch Informed Trees (BIT*): Sampling-based Optimal Planning via the Heuristically Guided Search of Implicit Random Geometric Graphs," In Proceedings of the IEEE International Conference on Robotics and Automation (ICRA). Seattle, WA, USA, 26-30 May 2015. DOI: 10.1109/ICRA.2015.7139620. Illustration video.

## Member Function Documentation

## ◆ setDelayRewiringUntilInitialSolution()

void ompl::geometric::BITstar::setDelayRewiringUntilInitialSolution | ( | bool | delayRewiring | ) |

Delay the consideration of rewiring edges until an initial solution is found. When multiple batches are required to find an initial solution, this can improve the time required to do so, by delaying improvements in the cost-to-come to a connected vertex. As the rewiring edges are considered once an initial solution is found, this has no effect on the theoretical asymptotic optimality of the planner.

Definition at line 1117 of file BITstar.cpp.

## ◆ setDropSamplesOnPrune()

void ompl::geometric::BITstar::setDropSamplesOnPrune | ( | bool | dropSamples | ) |

Drop *all* unconnected samples when pruning, regardless of their heuristic value. This provides a method for BIT* to remove samples that have not been connected to the graph and may be beneficial in problems where portions of the free space are unreachable (i.e., disconnected). BIT* calculates the connection radius for each batch from the underlying uniform distribution of states. The resulting larger connection radius may be detrimental in areas where the graph is dense, but maintains the theoretical asymptotic optimality of the planner.

Definition at line 1137 of file BITstar.cpp.

## ◆ setJustInTimeSampling()

void ompl::geometric::BITstar::setJustInTimeSampling | ( | bool | useJit | ) |

Delay the generation of samples until they are *necessary*. This only works when using an r-disc connection scheme, and is currently only implemented for problems seeking to minimize path length. This helps reduce the complexity of nearest-neighbour look ups, and can be particularly beneficial in unbounded planning problems where selecting an appropriate bounding box is difficult. With JIT sampling enabled, BIT* can solve planning problems whose state space has *infinite* *boundaries*. When enumerating outgoing edges from a vertex, BIT* uses JIT sampling to assure that the area within r of the vertex has been sampled during this batch. This is done in a way that maintains uniform sample distribution and has no effect on the theoretical asymptotic optimality of the planner.

Definition at line 1127 of file BITstar.cpp.

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

- ompl/geometric/planners/bitstar/BITstar.h
- ompl/geometric/planners/bitstar/src/BITstar.cpp