root/bdm/estim/libPF.h @ 14

Revision 14, 1.5 kB (checked in by smidl, 16 years ago)

restructuring

  • Property svn:eol-style set to native
Line 
1/*!
2  \file
3  \brief Bayesian Filtering using stochastic sampling (Particle Filters)
4  \author Vaclav Smidl.
5
6  -----------------------------------
7  BDM++ - C++ library for Bayesian Decision Making under Uncertainty
8
9  Using IT++ for numerical operations
10  -----------------------------------
11*/
12
13#ifndef PF_H
14#define PF_H
15
16#include <itpp/itbase.h>
17#include "libBM.h"
18#include "libDC.h"
19
20using namespace itpp;
21
22enum RESAMPLING_METHOD { MULTINOMIAL = 0, STRATIFIED = 1, SYSTEMATIC = 3 };
23
24/*!
25* \brief A Particle Filter prototype
26
27Bayesian Filtering equations hold.
28*/
29class PF : public BM { 
30protected:
31        int n; //number of particles
32        vec w; //particle weights
33        Uniform_RNG URNG; //used for resampling
34       
35public:
36        //! Returns indexes of particles that should be resampled. The ordering MUST guarantee inplace replacement. (Important for MPF.)
37        ivec resample(RESAMPLING_METHOD method = SYSTEMATIC);
38        PF (vec w);
39        //TODO remove or implement bayes()!
40        void bayes(const vec &dt, bool evell){};
41};
42
43/*!
44* \brief Trivial particle filter with proposal density that is not conditioned on the data.
45
46
47*/
48
49class TrivialPF : public PF {
50        Array<vec> ptcls;
51       
52        bool is_proposal;
53        mpdf *prop;
54        mpdf *par;
55        mpdf *obs;
56       
57        public:
58        TrivialPF(mpdf &par, mpdf &obs, mpdf &prop, int n0);
59        TrivialPF(mpdf &par, mpdf &obs, int n0);
60        void bayes(const vec &dt, bool evalll);
61};
62
63class MPF : public TrivialPF {
64        Array<BM> Bms;
65        public:
66        MPF(BM &B, mpdf &prop, mpdf &obs, mpdf &par);
67        void bayes(vec &dt);   
68};
69
70#endif // KF_H
71
Note: See TracBrowser for help on using the browser.