Line data Source code
1 : /*******************************************************************************
2 : * *
3 : * Cosmos:(C)oncept et (O)utils (S)tatistique pour les (Mo)deles *
4 : * (S)tochastiques *
5 : * *
6 : * Copyright (C) 2009-2012 LSV & LACL *
7 : * Authors: Paolo Ballarini BenoƮt Barbot & Hilal Djafri *
8 : * Website: http://www.lsv.ens-cachan.fr/Software/cosmos *
9 : * *
10 : * This program is free software; you can redistribute it and/or modify *
11 : * it under the terms of the GNU General Public License as published by *
12 : * the Free Software Foundation; either version 3 of the License, or *
13 : * (at your option) any later version. *
14 : * *
15 : * This program is distributed in the hope that it will be useful, *
16 : * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 : * GNU General Public License for more details. *
19 : * *
20 : * You should have received a copy of the GNU General Public License along *
21 : * with this program; if not, write to the Free Software Foundation, Inc., *
22 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
23 : * file SimulatorRE.hpp created by Benoit Barbot on 09/11/11. *
24 : *******************************************************************************
25 : */
26 :
27 :
28 : #ifndef _SIMULATOR_RE_HPP
29 : #define _SIMULATOR_RE_HPP
30 :
31 :
32 : #include "Simulator.hpp"
33 : #include "stateSpace.hpp"
34 : #include "SPNBase.hpp"
35 :
36 : template <class S>
37 : class SPNBaseRE: public SPNBase<S,EventsQueue>, public REHandling{
38 : public:
39 : SPNBaseRE(bool doubleIS);
40 :
41 : bool rareEventEnabled;
42 :
43 : void initialize(stateSpace *muprob);
44 : void update(double ctime,size_t, const abstractBinding&,EventsQueue &,timeGen &);
45 : void InitialEventsQueue(EventsQueue &,timeGen &);
46 :
47 : double mu();
48 : const bool doubleIS_mode;
49 :
50 : double Rate_Sum;
51 : double Origine_Rate_Sum;
52 : std::vector <double> Rate_Table;
53 : std::vector <double> Origine_Rate_Table;
54 :
55 : /* private */
56 : stateSpace * muprob;
57 :
58 : void getParams(size_t,const abstractBinding&);
59 : double ComputeDistr(size_t i,const abstractBinding& , double origin_rate);
60 : };
61 :
62 : template <class S,class DEDS>
63 0 : class SimulatorREBase: public SimulatorBase<S,EventsQueue,DEDS>{
64 : public:
65 : SimulatorREBase(DEDS& N,LHA_orig<typename DEDS::stateType>&);
66 :
67 : void initVect();
68 :
69 : /* private */
70 :
71 : //TAB muprob; // mu(s) table
72 : stateSpace * muprob;
73 :
74 : void SimulateSinglePath();
75 : void returnResultTrue();
76 : //virtual void GenerateDummyEvent(Event &, size_t);
77 : void updateLikelihood(size_t);
78 : bool transitionSink(size_t);
79 : void reset();
80 : };
81 :
82 : class SPN_RE: public SPNBaseRE<SPN_RE>{
83 : public:
84 : SPN_RE(bool doubleIS):SPNBaseRE<SPN_RE>(doubleIS){};
85 : };
86 :
87 : template <class DEDS>
88 : class SimulatorRE:public SimulatorREBase<SimulatorRE<DEDS>, DEDS>{
89 : public:
90 : SimulatorRE(DEDS& deds,LHA_orig<typename DEDS::stateType>& lha):SimulatorREBase<SimulatorRE,DEDS>(deds, lha){};
91 : };
92 :
93 :
94 :
95 :
96 : #endif /* _SIMULATOR_RE_HPP */
97 :
|