Bayesian Filtering Library Generated from SVN r
|
00001 // $Id: filter.h 29830 2009-01-14 15:10:41Z kgadeyne $ 00002 // Copyright (C) 2002 Klaas Gadeyne <first dot last at gmail dot com> 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 #ifndef __FILTER__ 00033 #define __FILTER__ 00034 00035 #include "../model/systemmodel.h" 00036 #include "../model/measurementmodel.h" 00037 #include "../pdf/pdf.h" 00038 00039 namespace BFL 00040 { 00041 using namespace std; 00042 00044 00077 template <typename StateVar, typename MeasVar> class Filter 00078 { 00079 protected: 00080 00082 Pdf<StateVar> * _prior; 00083 00085 00095 Pdf<StateVar> * _post; 00096 00098 00100 int _timestep; 00101 00103 00109 virtual bool UpdateInternal(SystemModel<StateVar>* const sysmodel, 00110 const StateVar& u, 00111 MeasurementModel<MeasVar,StateVar>* const measmodel, 00112 const MeasVar& z, 00113 const StateVar& s)=0; 00114 00115 public: 00117 00120 Filter(Pdf<StateVar> * prior); 00121 00123 00125 Filter(const Filter<StateVar,MeasVar>& filt); 00126 00128 virtual ~Filter(); 00129 00131 virtual void Reset(Pdf<StateVar> * prior); 00132 00134 00140 virtual bool Update(SystemModel<StateVar>* const sysmodel, 00141 const StateVar& u, 00142 MeasurementModel<MeasVar,StateVar>* const measmodel, 00143 const MeasVar& z, 00144 const StateVar& s); 00145 00147 00154 virtual bool Update(SystemModel<StateVar>* const sysmodel, 00155 MeasurementModel<MeasVar,StateVar>* const measmodel, 00156 const MeasVar& z, 00157 const StateVar& s); 00159 00165 virtual bool Update(SystemModel<StateVar>* const sysmodel, 00166 MeasurementModel<MeasVar,StateVar>* const measmodel, 00167 const MeasVar& z); 00169 00175 virtual bool Update(SystemModel<StateVar>* const sysmodel, 00176 const StateVar& u, 00177 MeasurementModel<MeasVar,StateVar>* const measmodel, 00178 const MeasVar& z); 00179 00181 00184 virtual bool Update(SystemModel<StateVar>* const sysmodel, 00185 const StateVar& u); 00187 00189 virtual bool Update(SystemModel<StateVar>* const sysmodel); 00190 00192 00197 virtual bool Update(MeasurementModel<MeasVar,StateVar>* const measmodel, 00198 const MeasVar& z, 00199 const StateVar& s); 00201 00205 virtual bool Update(MeasurementModel<MeasVar,StateVar>* const measmodel, 00206 const MeasVar& z); 00207 00209 00212 virtual Pdf<StateVar> * PostGet(); 00213 00215 00218 int TimeStepGet() const; 00219 }; 00220 00221 // For template instantiation 00222 #include "filter.cpp" 00223 00224 } // End namespace BFL 00225 00226 #endif // __FILTER__