Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members

plBayesianFilter.h

00001 /*=============================================================================
00002  * Product        : OpenPL 
00003  * File           : plBayesianFilter.h
00004  * Author         : Kamel Mekhnacha
00005  * Creation       : Fri Apr 16 15:28:11 2004
00006  *
00007  *=============================================================================
00008  *     (c) Copyright 2000, Centre National de la Recherche Scientifique,
00009  *                              all rights reserved
00010  *=============================================================================
00011  *
00012  *------------------------- Description ---------------------------------------
00013  *   
00014  *   
00015  *-----------------------------------------------------------------------------
00016  */
00017 
00018 
00019 
00020 #ifndef _plBayesianFilter_h
00021 #define _plBayesianFilter_h
00022 
00023 #include <plCndKernel.h>
00024 #include <plDataValues.h>
00025 #include <plMutableKernel.h>
00026 #include <plKernel.h>
00027 #include <plVariablesConjunction.h>
00028 #include <plObject.h>
00029 
00030 class plValues;
00031 
00032 class kplProbMap;
00033 class kplComputableObject;
00034 
00042 class plBayesianFilter :public plObject
00043 {
00044 public:
00047   plBayesianFilter(const plKernel &InitialState, 
00048            const plCndKernel &SystemModel,
00049            const plCndKernel &ObservationModel,
00050            const plVariablesConjunction &action_vars);
00051                    
00053   plBayesianFilter(const plKernel &InitialState, 
00054            const plVariablesConjunction &old_state_vars,
00055            const plCndKernel &SystemModel,
00056            const plVariablesConjunction &state_vars,
00057            const plCndKernel &ObservationModel,
00058            const plVariablesConjunction &obs_vars,
00059            const plVariablesConjunction &action_vars);
00060                                    
00061                      
00064   plBayesianFilter(const plKernel &InitialState, 
00065            const plCndKernel &SystemModel,
00066            const plCndKernel &ObservationModel);
00067                    
00069   plBayesianFilter(const plKernel &InitialState, 
00070            const plVariablesConjunction &old_state_vars,
00071            const plCndKernel &SystemModel,
00072            const plVariablesConjunction &state_vars,
00073            const plCndKernel &ObservationModel,
00074            const plVariablesConjunction &obs_vars);
00075                                    
00076                      
00079   plBayesianFilter(const plKernel &InitialState, 
00080            const plCndKernel &ObservationModel,
00081            const plVariablesConjunction &action_vars);
00082                      
00085   plBayesianFilter(const plKernel &InitialState,
00086            const plCndKernel &ObservationModel);
00087         
00089   ~plBayesianFilter();
00090     
00092   void setAction(const plValues &act);
00093     
00094   // Prediction
00096   void prediction();
00097 
00099   void n_prediction(unsigned long int nsamples);
00100     
00102   void time_prediction(double time_in_sec);
00103     
00104     
00105   // Observation
00108   void observation(const plValues &obs);
00109     
00111   void addMeasurement(const plValues &act, const plValues &obs)
00112   {
00113     setAction(act);
00114     prediction();
00115     observation(obs);
00116   }
00117     
00119   void n_addMeasurement(unsigned long int nsamples, const plValues &act, const plValues &obs)
00120   {
00121     setAction(act);
00122     n_prediction(nsamples);
00123     observation(obs);
00124   }
00125     
00127   void time_addMeasurement(double time_in_sec, const plValues &act, const plValues &obs)
00128   {
00129     setAction(act);
00130     time_prediction(time_in_sec);
00131     observation(obs);
00132   }
00133     
00134         
00136   void addMeasurement(const plValues &obs)
00137   {
00138     prediction();
00139     observation(obs);
00140   }
00141     
00143   void n_addMeasurement(unsigned long int nsamples, const plValues &obs)
00144   {
00145     n_prediction(nsamples);
00146     observation(obs);
00147   }
00148     
00150   void time_addMeasurement(double time_in_sec, const plValues &obs)
00151   {
00152     time_prediction(time_in_sec);
00153     observation(obs);
00154   }
00155     
00157   plKernel getEstimation()const
00158   {
00159     plKernel PSestim = _PoldS; 
00160     PSestim.rename(_state_variables);
00161     return PSestim;
00162   }
00163 
00164 protected:
00165   void init(const plVariablesConjunction &state_vars,
00166         const plVariablesConjunction &old_state_vars,
00167         const plVariablesConjunction &obs_vars,
00168         const plVariablesConjunction &action_vars);
00169               
00170   void init_without_syst_model(const plVariablesConjunction &state_vars,
00171                    const plVariablesConjunction &obs_vars,
00172                    const plVariablesConjunction &action_vars);
00173 protected:
00174 
00175   // P(S_)
00176   plMutableKernel _PoldS;
00177   
00178   // Observation model P(O | S A)
00179   plCndKernel _PO__SA;
00180   // P(O | S A) at kernel
00181   kplComputableObject *_PO__SAatKenel;
00182   
00183   // System model P(S | S_ A)
00184   plCndKernel _PS__oldSA;
00185   
00186   // prediction P(S | A)
00187   plCndKernel _PS__A;
00188   // instantiate prediction P(S | A = a)
00189   plKernel _PS__a;
00190   // P(S | A = a) compiled as map 
00191   plKernel _PS__a_map;
00192   
00193   kplProbMap *_PS__a_map_at_kernel;
00194   
00195   
00196   // a posteriori P(S | A = a  O = o)
00197   plKernel _PS_ao;
00198   kplProbMap *_PS__ao_map;
00199   
00200   
00201   // P(O = o | S A = a) compiled as a map
00202   //kplProbMap *_Po__Sa_map; 
00203   
00204   plVariablesConjunction _state_variables;
00205   plVariablesConjunction _old_state_variables;
00206   list <kplVariable*> _action_variables_at_kernel;
00207   list <kplVariable*> _observation_variables_at_kernel;
00208   //list <kplVariable*> _action_obs_vars;
00209   
00210   plDataValues _action;
00211   plDataValues _action_obs_values;
00212   
00213   bool _has_action;
00214   bool _system_model_is_id;
00215 };
00216 
00217 #endif

Generated on Fri Apr 1 10:58:11 2005 for ProBT by  doxygen 1.4.1