indii/ml/ode/EquilibriumSampler.hpp

00001 #ifndef INDII_ML_ODE_EquilibriumSampler_HPP
00002 #define INDII_ML_ODE_EquilibriumSampler_HPP
00003 
00004 #include "NumericalSolver.hpp"
00005 
00006 namespace indii {
00007   namespace ml {
00008     namespace ode {
00009 /**
00010  * Samples from equilibrium distribution of a stationary process.
00011  *
00012  * @author Lawrence Murray <lawrence@indii.org>
00013  * @version $Rev: 510 $
00014  * @date $Date: 2008-08-07 14:16:46 +0100 (Thu, 07 Aug 2008) $
00015  *
00016  * Produces samples from the equilibrium distribution of a stationary
00017  * stochastic process using Markov Chain Monte Carlo (MCMC).
00018  */
00019 class EquilibriumSampler {
00020 public:
00021   /**
00022    * Constructor.
00023    *
00024    * @param solver Numerical solver.
00025    * @param burn Projected time until equilibrium distribution is reached
00026    * from initial state.
00027    * @param interval Time between successive samples once equilibrium
00028    * distribution has been reached, assuming samples are approximately
00029    * independent when separated by this interval.
00030    */
00031   EquilibriumSampler(NumericalSolver* solver, const double burn,
00032       const double interval);
00033 
00034   /**
00035    * Destructor.
00036    */
00037   virtual ~EquilibriumSampler();
00038 
00039   /**
00040    * Sample from the equilibrium distribution.
00041    *
00042    * @return Sample from the equilibrium distribution.
00043    *
00044    * On the first call, advances the system by the given burn time to reach
00045    * the equilibrium distribution, then returns the state of the system as
00046    * the sample. On subsequent calls, advances the system by the given
00047    * interval time and returns the state of the system as the sample.
00048    */
00049   indii::ml::aux::vector sample();
00050   
00051 private:
00052   /**
00053    * Numerical solver.
00054    */
00055   NumericalSolver* solver;
00056   
00057   /**
00058    * Burn time.
00059    */
00060   const double burn;
00061   
00062   /**
00063    * Time between successive samples.
00064    */
00065   const double interval;
00066 
00067   /**
00068    * Number of samples taken.
00069    */
00070   unsigned int P;
00071   
00072 };
00073 
00074     }
00075   }
00076 }
00077 
00078 #endif
00079 

Generated on Wed Dec 17 15:11:57 2008 for dysii Dynamical Systems Library by  doxygen 1.5.3