ToPS
PhasedRunLengthDistribution.hpp
00001 /*
00002  *       PhasedRunLengthDistribution.hpp
00003  *
00004  *       Copyright 2011 Andre Yoshiaki Kashiwabara <akashiwabara@usp.br>
00005  *                      Ígor Bonádio <ibonadio@ime.usp.br>
00006  *                      Vitor Onuchic <vitoronuchic@gmail.com>
00007  *                      Alan Mitchell Durham <aland@usp.br>
00008  *
00009  *       This program is free software; you can redistribute it and/or modify
00010  *       it under the terms of the GNU  General Public License as published by
00011  *       the Free Software Foundation; either version 3 of the License, or
00012  *       (at your option) any later version.
00013  *
00014  *       This program is distributed in the hope that it will be useful,
00015  *       but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  *       GNU General Public License for more details.
00018  *
00019  *       You should have received a copy of the GNU General Public License
00020  *       along with this program; if not, write to the Free Software
00021  *       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00022  *       MA 02110-1301, USA.
00023  */
00024 
00025 #ifndef PHASED_RUN_LENGTH_DISTRIBUTION_HPP
00026 #define PHASED_RUN_LENGTH_DISTRIBUTION_HPP
00027 
00028 #include "crossplatform.hpp"
00029 
00030 #include "ProbabilisticModelDecorator.hpp"
00031 #include "DiscreteIIDModel.hpp"
00032 namespace tops {
00034   class DLLEXPORT PhasedRunLengthDistribution : public ProbabilisticModelDecorator {
00035   private:
00036     int _delta;
00037     int _iphase;
00038     int _ophase;
00039     int _nphases;
00040     double _normfactor;
00041     std::string _submodelname;
00042   public:
00043     PhasedRunLengthDistribution(ProbabilisticModelPtr m) : ProbabilisticModelDecorator(m) {};
00044     virtual ~PhasedRunLengthDistribution(){};
00045     virtual void initialize(int delta, int input_phase, int output_phase, int nphases);
00046     virtual double choose() const;
00047     virtual double evaluate(const Sequence & s, unsigned int begin, unsigned int end) const;
00048     virtual double  log_probability_of(int s) const;
00049     virtual Sequence & choose(Sequence & h, int size) const;
00050       virtual int size() const ;
00051     virtual ProbabilisticModelParameters parameters() const ;
00052     virtual void initialize(const ProbabilisticModelParameters & p) ;
00053 
00054 
00055 #if 0
00056     virtual Sequence & choose(Sequence &h, int initial_phase, int size) const;
00057     virtual Sequence & choose(Sequence & h, Sequence & path,  int size) const;
00058     virtual Sequence & choose(Sequence & h, Sequence & path,  int i, int size) const;
00059     virtual Sequence & chooseWithHistory(Sequence & h, int i,  int size) const;
00060     virtual Sequence & chooseWithHistory(Sequence & h, int i,  int phase, int size) const;
00061 #endif;
00062     virtual std::string str() const;
00063     std::string model_name () const;
00064   };
00065   typedef boost::shared_ptr<PhasedRunLengthDistribution> PhasedRunLengthDistributionPtr;
00066 }
00067 
00068 #endif