MRPT  2.0.4
List of all members | Public Types | Public Member Functions | Protected Member Functions
mrpt::bayes::CRejectionSamplingCapable< TStateSpace, STORAGE > Class Template Referenceabstract

Detailed Description

template<class TStateSpace, mrpt::bayes::particle_storage_mode STORAGE = mrpt::bayes::particle_storage_mode::POINTER>
class mrpt::bayes::CRejectionSamplingCapable< TStateSpace, STORAGE >

A base class for implementing rejection sampling in a generic state space.

See the main method CRejectionSamplingCapable::rejectionSampling To use this class, create your own class as a child of this one and implement the desired virtual methods, and add any required internal data.

Definition at line 29 of file CRejectionSamplingCapable.h.

#include <mrpt/bayes/CRejectionSamplingCapable.h>

Inheritance diagram for mrpt::bayes::CRejectionSamplingCapable< TStateSpace, STORAGE >:

Public Types

using TParticle = CProbabilityParticle< TStateSpace, STORAGE >
 

Public Member Functions

virtual ~CRejectionSamplingCapable ()=default
 Virtual destructor. More...
 
void rejectionSampling (size_t desiredSamples, std::vector< TParticle > &outSamples, size_t timeoutTrials=1000)
 Generates a set of N independent samples via rejection sampling. More...
 

Protected Member Functions

virtual void RS_drawFromProposal (TStateSpace &outSample)=0
 Generates one sample, drawing from some proposal distribution. More...
 
virtual double RS_observationLikelihood (const TStateSpace &x)=0
 Returns the NORMALIZED observation likelihood (linear, not exponential!!!) at a given point of the state space (values in the range [0,1]). More...
 

Member Typedef Documentation

◆ TParticle

template<class TStateSpace, mrpt::bayes::particle_storage_mode STORAGE = mrpt::bayes::particle_storage_mode::POINTER>
using mrpt::bayes::CRejectionSamplingCapable< TStateSpace, STORAGE >::TParticle = CProbabilityParticle<TStateSpace, STORAGE>

Definition at line 32 of file CRejectionSamplingCapable.h.

Constructor & Destructor Documentation

◆ ~CRejectionSamplingCapable()

template<class TStateSpace, mrpt::bayes::particle_storage_mode STORAGE = mrpt::bayes::particle_storage_mode::POINTER>
virtual mrpt::bayes::CRejectionSamplingCapable< TStateSpace, STORAGE >::~CRejectionSamplingCapable ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ rejectionSampling()

template<class TStateSpace, mrpt::bayes::particle_storage_mode STORAGE = mrpt::bayes::particle_storage_mode::POINTER>
void mrpt::bayes::CRejectionSamplingCapable< TStateSpace, STORAGE >::rejectionSampling ( size_t  desiredSamples,
std::vector< TParticle > &  outSamples,
size_t  timeoutTrials = 1000 
)
inline

Generates a set of N independent samples via rejection sampling.

Parameters
desiredSamplesThe number of desired samples to generate
outSamplesThe output samples.
timeoutTrialsThe maximum number of rejection trials for each generated sample (i.e. the maximum number of iterations). This can be used to set a limit to the time complexity of the algorithm for difficult probability densities. All will have equal importance weights (a property of rejection sampling), although those samples generated at timeout will have a different importance weights.

Definition at line 48 of file CRejectionSamplingCapable.h.

◆ RS_drawFromProposal()

template<class TStateSpace, mrpt::bayes::particle_storage_mode STORAGE = mrpt::bayes::particle_storage_mode::POINTER>
virtual void mrpt::bayes::CRejectionSamplingCapable< TStateSpace, STORAGE >::RS_drawFromProposal ( TStateSpace &  outSample)
protectedpure virtual

Generates one sample, drawing from some proposal distribution.

Implemented in mrpt::slam::CRejectionSamplingRangeOnlyLocalization.

Referenced by mrpt::bayes::CRejectionSamplingCapable< CPose2D >::rejectionSampling().

Here is the caller graph for this function:

◆ RS_observationLikelihood()

template<class TStateSpace, mrpt::bayes::particle_storage_mode STORAGE = mrpt::bayes::particle_storage_mode::POINTER>
virtual double mrpt::bayes::CRejectionSamplingCapable< TStateSpace, STORAGE >::RS_observationLikelihood ( const TStateSpace &  x)
protectedpure virtual

Returns the NORMALIZED observation likelihood (linear, not exponential!!!) at a given point of the state space (values in the range [0,1]).

Implemented in mrpt::slam::CRejectionSamplingRangeOnlyLocalization.

Referenced by mrpt::bayes::CRejectionSamplingCapable< CPose2D >::rejectionSampling().

Here is the caller graph for this function:



Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020