Loading...
Searching...
No Matches
ompl::base::RejectionInfSampler Class Reference

A default rejection sampling scheme that samples uniformly from the entire planning domain. Samples are rejected until one is found that has a heuristic solution estimate that is less than the current solution. In general, direct sampling of the informed subset is much better, but this is a general default. More...

#include <ompl/base/samplers/informed/RejectionInfSampler.h>

Inheritance diagram for ompl::base::RejectionInfSampler:

Public Member Functions

 RejectionInfSampler (const ProblemDefinitionPtr &probDefn, unsigned int maxNumberCalls)
 Construct a rejection sampler that only generates states with a heuristic solution estimate that is less than the cost of the current solution.
 
bool sampleUniform (State *statePtr, const Cost &maxCost) override
 Sample uniformly in the subset of the state space whose heuristic solution estimates are less than the provided cost, i.e. in the interval [0, maxCost). Returns false if such a state was not found in the specified number of iterations.
 
bool sampleUniform (State *statePtr, const Cost &minCost, const Cost &maxCost) override
 Sample uniformly in the subset of the state space whose heuristic solution estimates are between the provided costs, [minCost, maxCost). Returns false if such a state was not found in the specified number of iterations.
 
bool hasInformedMeasure () const override
 Whether the sampler can provide a measure of the informed subset.
 
double getInformedMeasure (const Cost &) const override
 The measure of the subset of the state space defined by the current solution cost that is being searched. As rejection sampling has no closed-form knowledge of the informed subset, the measure of the informed space is always the measure of the entire space.
 
double getInformedMeasure (const Cost &, const Cost &) const override
 The measure of the subset of the state space defined by the current solution cost that is being searched. As rejection sampling has no closed-form knowledge of the informed subset, the measure of the informed space is always the measure of the entire space.
 
- Public Member Functions inherited from ompl::base::InformedSampler
 InformedSampler (const InformedSampler &)=delete
 
InformedSampleroperator= (const InformedSampler &)=delete
 
 InformedSampler (const ProblemDefinitionPtr &probDefn, unsigned int maxNumberCalls)
 Construct a sampler that only generates states with a heuristic solution estimate that is less than the cost of the current solution. Requires a function pointer to a method to query the cost of the current solution. If iteration is required, only maxNumberCalls are attempted, to assure that the function returns.
 
virtual bool sampleUniform (State *statePtr, const Cost &maxCost)=0
 Sample uniformly in the subset of the state space whose heuristic solution estimates are less than the provided cost, i.e. in the interval [0, maxCost). Returns false if such a state was not found in the specified number of iterations.
 
virtual bool sampleUniform (State *statePtr, const Cost &minCost, const Cost &maxCost)=0
 Sample uniformly in the subset of the state space whose heuristic solution estimates are between the provided costs, [minCost, maxCost). Returns false if such a state was not found in the specified number of iterations.
 
virtual bool hasInformedMeasure () const =0
 Whether the sampler can provide a measure of the informed subset.
 
virtual double getInformedMeasure (const Cost &currentCost) const =0
 The measure of the subset of the state space defined by the current solution cost that is being searched. Does not consider problem boundaries but returns the measure of the entire space if no solution has been found or if a closed form expression for the measure does not exist.
 
virtual double getInformedMeasure (const Cost &minCost, const Cost &maxCost) const
 The measure of the subset of the state space defined by the current solution cost that is being searched. Does not consider problem boundaries but returns the measure of the entire space if no solution has been found or if a closed form expression for the measure does not exist. By default calls the 1-argument overloaded version with the min and max costs and subtracts the differences; however, there may be more efficient ways to do this for some cost functions.
 
virtual Cost heuristicSolnCost (const State *statePtr) const
 A helper function to calculate the heuristic estimate of the solution cost for a given state using the optimization objective stored in the problem definition.
 
ProblemDefinitionPtr getProblemDefn () const
 
unsigned int getMaxNumberOfIters () const
 

Additional Inherited Members

- Protected Attributes inherited from ompl::base::InformedSampler
ProblemDefinitionPtr probDefn_
 A copy of the problem definition.
 
OptimizationObjectivePtr opt_
 A copy of the optimization objective.
 
StateSpacePtr space_
 A copy of the state space.
 
unsigned int numIters_
 The number of iterations I'm allowed to attempt.
 

Detailed Description

A default rejection sampling scheme that samples uniformly from the entire planning domain. Samples are rejected until one is found that has a heuristic solution estimate that is less than the current solution. In general, direct sampling of the informed subset is much better, but this is a general default.

Definition at line 53 of file RejectionInfSampler.h.

Constructor & Destructor Documentation

◆ RejectionInfSampler()

ompl::base::RejectionInfSampler::RejectionInfSampler ( const ProblemDefinitionPtr probDefn,
unsigned int  maxNumberCalls 
)

Construct a rejection sampler that only generates states with a heuristic solution estimate that is less than the cost of the current solution.

Definition at line 45 of file RejectionInfSampler.cpp.

Member Function Documentation

◆ getInformedMeasure() [1/2]

double ompl::base::RejectionInfSampler::getInformedMeasure ( const Cost ) const
overridevirtual

The measure of the subset of the state space defined by the current solution cost that is being searched. As rejection sampling has no closed-form knowledge of the informed subset, the measure of the informed space is always the measure of the entire space.

Implements ompl::base::InformedSampler.

Definition at line 107 of file RejectionInfSampler.cpp.

◆ getInformedMeasure() [2/2]

double ompl::base::RejectionInfSampler::getInformedMeasure ( const Cost ,
const Cost  
) const
overridevirtual

The measure of the subset of the state space defined by the current solution cost that is being searched. As rejection sampling has no closed-form knowledge of the informed subset, the measure of the informed space is always the measure of the entire space.

Reimplemented from ompl::base::InformedSampler.

Definition at line 112 of file RejectionInfSampler.cpp.

◆ hasInformedMeasure()

bool ompl::base::RejectionInfSampler::hasInformedMeasure ( ) const
overridevirtual

Whether the sampler can provide a measure of the informed subset.

Implements ompl::base::InformedSampler.

Definition at line 102 of file RejectionInfSampler.cpp.

◆ sampleUniform() [1/2]

bool ompl::base::RejectionInfSampler::sampleUniform ( State statePtr,
const Cost maxCost 
)
overridevirtual

Sample uniformly in the subset of the state space whose heuristic solution estimates are less than the provided cost, i.e. in the interval [0, maxCost). Returns false if such a state was not found in the specified number of iterations.

Implements ompl::base::InformedSampler.

Definition at line 60 of file RejectionInfSampler.cpp.

◆ sampleUniform() [2/2]

bool ompl::base::RejectionInfSampler::sampleUniform ( State statePtr,
const Cost minCost,
const Cost maxCost 
)
overridevirtual

Sample uniformly in the subset of the state space whose heuristic solution estimates are between the provided costs, [minCost, maxCost). Returns false if such a state was not found in the specified number of iterations.

Implements ompl::base::InformedSampler.

Definition at line 70 of file RejectionInfSampler.cpp.


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