Bayesian Filtering Library  Generated from SVN r
particlesmoother.h
1 // $Id: particlesmoother.h 6736 2006-12-21 11:24:42Z tdelaet $
2 // Copyright (C) 2006 Tinne De Laet <first dot last at mech dot kuleuven dot be>
3 //
4  /***************************************************************************
5  * This library is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU General Public *
7  * License as published by the Free Software Foundation; *
8  * version 2 of the License. *
9  * *
10  * As a special exception, you may use this file as part of a free *
11  * software library without restriction. Specifically, if other files *
12  * instantiate templates or use macros or inline functions from this *
13  * file, or you compile this file and link it with other files to *
14  * produce an executable, this file does not by itself cause the *
15  * resulting executable to be covered by the GNU General Public *
16  * License. This exception does not however invalidate any other *
17  * reasons why the executable file might be covered by the GNU General *
18  * Public License. *
19  * *
20  * This library is distributed in the hope that it will be useful, *
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
23  * Lesser General Public License for more details. *
24  * *
25  * You should have received a copy of the GNU General Public *
26  * License along with this library; if not, write to the Free Software *
27  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
28  * Boston, MA 02110-1301 USA *
29  * *
30  ***************************************************************************/
31 
32 
33 // implementation based on "A smoothing filter for condensation", by Isard and
34 // Blake
35 // (http://www.springerlink.com/content/?k=a+smoothing+filter+for+condensation)
36 // The bacward stage version
37 // @bug still needs extra testing!
38 
39 #ifndef __PARTICLE_SMOOTHER__
40 #define __PARTICLE_SMOOTHER__
41 
42 #include "backwardfilter.h"
43 #include "../pdf/conditionalpdf.h"
44 #include "../pdf/mcpdf.h"
45 
46 namespace BFL
47 {
48 
50  template <typename StateVar> class ParticleSmoother
51  : public BackwardFilter<StateVar>
52  {
53  protected:
54  virtual bool UpdateInternal(SystemModel<StateVar>* const sysmodel,
55  const StateVar& u, Pdf<StateVar>* const filtered_post);
56 
57  virtual void SysUpdate(SystemModel<StateVar>* const sysmodel, const StateVar& u , Pdf<StateVar>* const filtered_post);
58 
60  vector<WeightedSample<StateVar> > _old_samples;
62  vector<WeightedSample<StateVar> > _new_samples;
64  vector<WeightedSample<StateVar> > _filtered_samples;
66  typename vector<WeightedSample<StateVar> >::iterator _os_it;
68  typename vector<WeightedSample<StateVar> >::iterator _ns_it;
70  typename vector<WeightedSample<StateVar> >::iterator _fs_it;
71 
72  public:
74  ParticleSmoother(MCPdf<StateVar> * prior);
75 
77  virtual ~ParticleSmoother();
78 
79  };
80 #include "particlesmoother.cpp"
81 
82 } // End namespace BFL
83 
84 #endif // __PARTICLE_FILTER__
BFL::ParticleSmoother::_ns_it
vector< WeightedSample< StateVar > >::iterator _ns_it
Iterator for new list of samples.
Definition: particlesmoother.h:120
BFL::ParticleSmoother::UpdateInternal
virtual bool UpdateInternal(SystemModel< StateVar > *const sysmodel, const StateVar &u, Pdf< StateVar > *const filtered_post)
Actual implementation of Update, varies along filters.
BFL::ParticleSmoother::~ParticleSmoother
virtual ~ParticleSmoother()
Destructor.
BFL::ParticleSmoother::_fs_it
vector< WeightedSample< StateVar > >::iterator _fs_it
Iterator for list of filtered samples.
Definition: particlesmoother.h:122
BFL::ParticleSmoother::_old_samples
vector< WeightedSample< StateVar > > _old_samples
While updating store list of old samples.
Definition: particlesmoother.h:112
BFL::ParticleSmoother::ParticleSmoother
ParticleSmoother(MCPdf< StateVar > *prior)
Constructor.
BFL::ParticleSmoother::_new_samples
vector< WeightedSample< StateVar > > _new_samples
While updating store list of new samples.
Definition: particlesmoother.h:114
BFL::ParticleSmoother::_os_it
vector< WeightedSample< StateVar > >::iterator _os_it
Iterator for old list of samples.
Definition: particlesmoother.h:118
BFL::ParticleSmoother::_filtered_samples
vector< WeightedSample< StateVar > > _filtered_samples
While updating store list of filtered samples.
Definition: particlesmoother.h:116