9 #ifndef CPARTICLEFILTERCAPABLE_H 10 #define CPARTICLEFILTERCAPABLE_H 21 #define INVALID_LIKELIHOOD_VALUE \ 22 (-1e300) // An invalid log-likelihood value, used to signal non-initialized 142 virtual double getW(
size_t i)
const = 0;
146 virtual void setW(
size_t i,
double w) = 0;
169 virtual double ESS()
const = 0;
185 size_t out_particle_count = 0);
200 const std::vector<double>& in_logWeights,
201 std::vector<size_t>& out_indexes,
size_t out_particle_count = 0);
208 const std::vector<double>& in_logWeights,
209 std::vector<double>& out_linWeights);
std::vector< uint32_t > vector_uint
std::vector< double > CDF
size_t alreadyDrawnNextOne
static void log2linearWeights(const std::vector< double > &in_logWeights, std::vector< double > &out_linWeights)
A static method to compute the linear, normalized (the sum the unity) weights from log-weights...
virtual void setW(size_t i, double w)=0
Modifies i'th particle (logarithm) weight, where first one is index 0.
vector_uint alreadyDrawnIndexes
Auxiliary vectors, see CParticleFilterCapable::prepareFastDrawSample for more information.
GLubyte GLubyte GLubyte GLubyte w
virtual double normalizeWeights(double *out_max_log_w=nullptr)=0
Normalize the (logarithmic) weights, such as the maximum weight is zero.
virtual size_t particlesCount() const =0
Get the m_particles count.
std::function< double(size_t index)> TParticleProbabilityEvaluator
A callback function type for evaluating the probability of m_particles of being selected, used in "fastDrawSample".
TParticleResamplingAlgorithm
Defines the different resampling algorithms.
virtual double getW(size_t i) const =0
Access to i'th particle (logarithm) weight, where first one is index 0.
virtual ~CParticleFilterCapable()
Virtual destructor.
void prepareFastDrawSample(const bayes::CParticleFilter::TParticleFilterOptions &PF_options) const
The default evaluator function, which simply returns the particle weight.
This virtual class defines the interface that any particles based PDF class must implement in order t...
std::vector< double > PDF
This class acts as a common interface to the different interfaces (see CParticleFilter::TParticleFilt...
virtual void performSubstitution(const std::vector< size_t > &indx)=0
Performs the substitution for internal use of resample in particle filter algorithm, don't call it directly.
virtual double ESS() const =0
Returns the normalized ESS (Estimated Sample Size), in the range [0,1].
TFastDrawAuxVars m_fastDrawAuxiliary
Auxiliary vectors, see CParticleFilterCapable::prepareFastDrawSample for more information.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
The configuration of a particle filter.
void performResampling(const bayes::CParticleFilter::TParticleFilterOptions &PF_options, size_t out_particle_count=0)
Performs a resample of the m_particles, using the method selected in the constructor.
static const unsigned PARTICLE_FILTER_CAPABLE_FAST_DRAW_BINS
static void computeResampling(CParticleFilter::TParticleResamplingAlgorithm method, const std::vector< double > &in_logWeights, std::vector< size_t > &out_indexes, size_t out_particle_count=0)
A static method to perform the computation of the samples resulting from resampling a given set of pa...
size_t fastDrawSample(const bayes::CParticleFilter::TParticleFilterOptions &PF_options) const
Draws a random sample from the particle filter, in such a way that each particle has a probability pr...