LCOV - code coverage report
Current view: top level - builds/barbot/Cosmos/src/Simulator/RareEvents - SimulatorBoundedRE.hpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 24 0.0 %
Date: 2021-06-16 15:43:28 Functions: 0 6 0.0 %

          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 SimulatorBoundedRE.hpp created by Benoit Barbot on 06/12/11.           *
      24             :  *******************************************************************************
      25             :  */
      26             : 
      27             : /* This class inherit the class of Simulator and modify
      28             :  * several intern function to implement rare event acceleration.
      29             :  */
      30             : 
      31             : #include "SimulatorRE.hpp"
      32             : #include "numericalSolver.hpp"
      33             : #include "marking.hpp"
      34             : #include <vector>
      35             : 
      36             : #ifndef _SIMULATOR_BOUNDED_RE_HPP
      37             : #define _SIMULATOR_BOUNDED_RE_HPP
      38             : 
      39             : template <class S, class EQT>
      40             : class simulationState{
      41             : private:
      42             :         abstractMarking marking;
      43             :         EQT *EQ;
      44             :         LHA_orig<typeof marking> lhaState;
      45             :     
      46             :         //rare event variable
      47             :         vector <double> Rate_Table;
      48             :         vector <double> Origine_Rate_Table;
      49             :         double Rate_Sum;
      50             :         double Origine_Rate_Sum;
      51             :         
      52             :         
      53             : public:
      54             :     int maxStep;
      55           0 :         simulationState(){
      56             :                 //EQ = new EventsQueue(n);
      57           0 :         maxStep=0;
      58           0 :         };
      59           0 :         ~simulationState(){};
      60             :         
      61           0 :         void saveState(S* N,LHA_orig<typeof marking>* A,EQT** EQsim){
      62           0 :                 marking.swap(N->Marking);
      63             :                 //AE = *AEsim;
      64           0 :                 EQ = *EQsim; //new EventsQueue(*EQsim);
      65             :                 
      66           0 :                 lhaState.copyState(A);
      67             :         
      68           0 :                 Rate_Table.swap(N->Rate_Table);
      69           0 :                 Origine_Rate_Table.swap(N->Origine_Rate_Table);
      70           0 :                 Rate_Sum = N->Rate_Sum;
      71           0 :                 Origine_Rate_Sum = N-> Origine_Rate_Sum;
      72             :                 
      73           0 :         };
      74           0 :         void loadState(S* N,LHA_orig<typeof marking>* A,EQT** EQsim){
      75             :                 
      76           0 :                 N->Marking.swap(marking);
      77             :                 //*AEsim = AE;
      78           0 :                 *EQsim = EQ;
      79             :                 
      80           0 :                 A->copyState(&lhaState);
      81             :                 
      82           0 :                 N->Rate_Table.swap(Rate_Table);
      83           0 :                 N->Origine_Rate_Table.swap(Origine_Rate_Table);
      84           0 :                 N->Rate_Sum = Rate_Sum;
      85           0 :                 N->Origine_Rate_Sum = Origine_Rate_Sum ;
      86           0 :         };
      87             :         
      88             : };
      89             : 
      90             : template<class S>
      91             : class SPNBaseBoundedRE: public SPNBaseRE<S>{
      92             : public:
      93           0 :     SPNBaseBoundedRE(bool doubleIS):SPNBaseRE<S>(doubleIS){};
      94             : 
      95             :     void update(double ctime,size_t, const abstractBinding&,EventsQueue &, timeGen &);
      96             :     void getParams(size_t, const abstractBinding&);
      97             :     double mu();
      98             :     double ComputeDistr(size_t i,const abstractBinding&, double origin_rate);
      99             : };
     100             : 
     101             : template<class S,class DEDS>
     102             : class SimulatorBoundedREBase: public SimulatorREBase<S,DEDS>{
     103             : public:
     104             :         //SimulatorBoundedRE();
     105             :     SimulatorBoundedREBase(DEDS& N,LHA_orig<typename DEDS::stateType>&,int m);
     106             :         BatchR RunBatch();
     107             :         using SimulatorREBase<S,DEDS>::initVect;
     108             :     void initVect(int T);
     109             : 
     110             :     /* private */
     111             :         numericalSolver* numSolv;
     112             :         double lambda;
     113             : };
     114             : 
     115             : class SPN_BoundedRE: public SPNBaseBoundedRE<SPN_BoundedRE>{
     116             :     public:
     117             :   SPN_BoundedRE(bool doubleIS):SPNBaseBoundedRE<SPN_BoundedRE>(doubleIS){};
     118             : };
     119             : 
     120             : template <class DEDS>
     121             : class SimulatorBoundedRE:public SimulatorBoundedREBase<SimulatorBoundedRE<DEDS>, DEDS>{
     122             : public:
     123           0 :     SimulatorBoundedRE(DEDS& deds,LHA_orig<typename DEDS::stateType>& lha,int m):SimulatorBoundedREBase<SimulatorBoundedRE<DEDS>, DEDS>(deds, lha, m){};
     124             : };
     125             : 
     126             : 
     127             : 
     128             : #endif  /* _SIMULATOR_BOUNDED_RE_HPP */

Generated by: LCOV version 1.13