p_condensation.h

Go to the documentation of this file.
00001 #ifndef MMVL_P_CONDENSATION_HH
00002 #define MMVL_P_CONDENSATION_HH
00003 
00004 #include "condensation.h"
00005 
00006 namespace mimas{
00007   namespace hf{
00008 
00014     template<typename Hypothesis_T>    
00015     class p_condensation: public condensation<Hypothesis_T>
00016     {
00017     public:
00018       
00032       void partial_reset(const Hypothesis_T &init, float proportion, float weight_discrimination, float weight_initialization, bool drift_switch = true)
00033       {
00034   unsigned int number_particle_to_relocate =  (unsigned int)(condensation<Hypothesis_T>::hypotheses_CD.size() * proportion); 
00035   
00036   unsigned int i = 0;
00037   unsigned int exit_safety = 0;
00038   while(i < number_particle_to_relocate)
00039     {
00040       if(exit_safety >= condensation<Hypothesis_T>::hypotheses_CD.size())
00041         {
00042     break;
00043     std::cerr<<"Apparently their is not enough hypothesis with a lower weight to be reinitialised"<<std::endl;
00044         }
00045       int j = int(Dice::uniform_random() * condensation<Hypothesis_T>::hypotheses_CD.size());
00046       if( (condensation<Hypothesis_T>::hypotheses_CD.at( j ) ).weight < Dice::uniform_random() * weight_discrimination){ //to take preferably low weighted particles.
00047         if(drift_switch)
00048     condensation<Hypothesis_T>::hypotheses_CD.at( j ) = init.drift();
00049         else
00050     condensation<Hypothesis_T>::hypotheses_CD.at( j ) = init;
00051         (condensation<Hypothesis_T>::hypotheses_CD.at( j ) ).weight = weight_initialization; //to have less chance to take this particle again
00052         //and to have more chance to pick this at the filter stage.
00053         i++;
00054       }
00055       else
00056         exit_safety++;
00057     }   
00058       }
00059 
00060     protected:
00061       
00062       p_condensation(std::vector<Hypothesis_T> &hypotheses)
00063     :condensation<Hypothesis_T>(hypotheses){}
00064 
00065     };
00066 
00067   }
00068 }
00069 #endif

[GNU/Linux] [Qt] [Mesa] [STL] [Lapack] [Boost] [Magick++] [Xalan-C and Xerces-C] [doxygen] [graphviz] [FFTW] [popt] [xine] [Gnuplot] [gnu-arch] [gcc] [gstreamer] [autoconf/automake/make] [freshmeat.net] [opensource.org] [sourceforge.net] [MMVL]
mimas 2.1 - Copyright Mon Oct 30 11:31:17 2006, Bala Amavasai, Stuart Meikle, Arul Selvan, Fabio Caparrelli, Jan Wedekind, Manuel Boissenin, ...