class mrpt::bayes::CParticleFilterCapable

This virtual class defines the interface that any particles based PDF class must implement in order to be executed by a mrpt::bayes::CParticleFilter.

See the Particle Filter tutorial explaining how to use the particle filter-related classes.

See also:

CParticleFilter, CParticleFilterData

#include <mrpt/bayes/CParticleFilterCapable.h>

class CParticleFilterCapable
{
public:
    // structs

    struct TFastDrawAuxVars;

    // construction

    CParticleFilterCapable();

    //
methods

    virtual double getW(size_t i) const = 0;
    virtual void setW(size_t i, double w) = 0;
    virtual size_t particlesCount() const = 0;
    virtual void performSubstitution(const std::vector<size_t>& indx) = 0;
    virtual double normalizeWeights(double* out_max_log_w = nullptr) = 0;
    virtual double ESS() const = 0;
};

// direct descendants

template <class Derived, class particle_list_t>
struct CParticleFilterDataImpl;

Methods

virtual double getW(size_t i) const = 0

Access to i’th particle (logarithm) weight, where first one is index 0.

virtual void setW(size_t i, double w) = 0

Modifies i’th particle (logarithm) weight, where first one is index 0.

virtual size_t particlesCount() const = 0

Get the m_particles count.

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.

Parameters:

indx

The indices of current m_particles to be saved as the new m_particles set.

virtual double normalizeWeights(double* out_max_log_w = nullptr) = 0

Normalize the (logarithmic) weights, such as the maximum weight is zero.

Parameters:

out_max_log_w

If provided, will return with the maximum log_w before normalizing, such as new_weights = old_weights - max_log_w.

Returns:

The max/min ratio of weights (“dynamic range”)

virtual double ESS() const = 0

Returns the normalized ESS (Estimated Sample Size), in the range [0,1].

Note that you do NOT need to normalize the weights before calling this.