00001 // $Id: particlesmoother.h 6736 2006-12-21 11:24:42Z tdelaet $ 00002 // Copyright (C) 2006 Tinne De Laet <first dot last at mech dot kuleuven dot be> 00003 // 00004 /*************************************************************************** 00005 * This library is free software; you can redistribute it and/or * 00006 * modify it under the terms of the GNU General Public * 00007 * License as published by the Free Software Foundation; * 00008 * version 2 of the License. * 00009 * * 00010 * As a special exception, you may use this file as part of a free * 00011 * software library without restriction. Specifically, if other files * 00012 * instantiate templates or use macros or inline functions from this * 00013 * file, or you compile this file and link it with other files to * 00014 * produce an executable, this file does not by itself cause the * 00015 * resulting executable to be covered by the GNU General Public * 00016 * License. This exception does not however invalidate any other * 00017 * reasons why the executable file might be covered by the GNU General * 00018 * Public License. * 00019 * * 00020 * This library is distributed in the hope that it will be useful, * 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00023 * Lesser General Public License for more details. * 00024 * * 00025 * You should have received a copy of the GNU General Public * 00026 * License along with this library; if not, write to the Free Software * 00027 * Foundation, Inc., 59 Temple Place, * 00028 * Suite 330, Boston, MA 02111-1307 USA * 00029 * * 00030 ***************************************************************************/ 00031 00032 00033 // implementation based on "A smoothing filter for condensation", by Isard and 00034 // Blake 00035 // (http://www.springerlink.com/content/?k=a+smoothing+filter+for+condensation) 00036 // The bacward stage version 00037 // @bug still needs extra testing! 00038 00039 #ifndef __PARTICLE_SMOOTHER__ 00040 #define __PARTICLE_SMOOTHER__ 00041 00042 #include "backwardfilter.h" 00043 #include "../pdf/conditionalpdf.h" 00044 #include "../pdf/mcpdf.h" 00045 00046 namespace BFL 00047 { 00048 00050 template <typename StateVar> class ParticleSmoother 00051 : public BackwardFilter<StateVar> 00052 { 00053 protected: 00054 virtual bool UpdateInternal(SystemModel<StateVar>* const sysmodel, 00055 const StateVar& u, Pdf<StateVar>* const filtered_post); 00056 00057 virtual void SysUpdate(SystemModel<StateVar>* const sysmodel, const StateVar& u , Pdf<StateVar>* const filtered_post); 00058 00060 vector<WeightedSample<StateVar> > _old_samples; 00062 vector<WeightedSample<StateVar> > _new_samples; 00064 vector<WeightedSample<StateVar> > _filtered_samples; 00066 typename vector<WeightedSample<StateVar> >::iterator _os_it; 00068 typename vector<WeightedSample<StateVar> >::iterator _ns_it; 00070 typename vector<WeightedSample<StateVar> >::iterator _fs_it; 00071 00072 public: 00074 ParticleSmoother(MCPdf<StateVar> * prior); 00075 00077 virtual ~ParticleSmoother(); 00078 00079 }; 00080 #include "particlesmoother.cpp" 00081 00082 } // End namespace BFL 00083 00084 #endif // __PARTICLE_FILTER__