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 LHA_orig.hpp created by Benoit Barbot on 026/08/15. *
24 : *******************************************************************************
25 : */
26 :
27 : #ifndef Cosmos_LHA_orig_h
28 : #define Cosmos_LHA_orig_h
29 :
30 : #include "LHA.hpp"
31 :
32 : /**
33 : * Class implementing the Linear Hybrid Automaton.
34 : * Part of the implementation is generated at runtime for efficiency.
35 : */
36 : template<class DEDState>
37 45 : class LHA_orig : public LHA<DEDState> {
38 : public:
39 :
40 : /*
41 : * Curent likelihood.
42 : * Use only for importance sampling
43 : */
44 : double Likelihood;
45 :
46 : /**
47 : * Copy the state of an other LHA.
48 : * It only copy pointer thus is in constant time.
49 : */
50 : void copyState(LHA_orig*);
51 :
52 : //! fire an autonomous transition of an LHA
53 : void fireAutonomous(int,const DEDState&);
54 :
55 : /**
56 : * \brief Synchronized the execution of the LHA with a transition of the SPN.
57 : */
58 : virtual int synchroniseWith(size_t, const DEDState&,const abstractBinding&);
59 :
60 : /**
61 : * \brief Return an autonomous edge for a given marking.
62 : */
63 : virtual AutEdge GetEnabled_A_Edges(const DEDState&);
64 :
65 : //! update value in the LHA by elapsing time
66 : virtual void updateLHA(double DeltaT, const DEDState &);
67 :
68 : //! test if the automaton is in a final state
69 45138508 : virtual bool isFinal()const{return (this->FinalLoc[this->CurrentLocation]);};
70 :
71 : /**
72 : * reset the automata to its initial state according to the
73 : * marking of the SPN.
74 : */
75 : virtual void reset(const DEDState&);
76 :
77 : virtual void getFinalValues(const DEDState&,vector<double>&,vector<bool>&);
78 :
79 : protected:
80 :
81 : //! fire the transition of an LHA
82 : void fireLHA(int,const DEDState&, const abstractBinding&);
83 :
84 : /**
85 : * \brief Set the initial location of the LHA for a marking
86 : * Loop over the set of initial location to find one enabled.
87 : */
88 : virtual void setInitLocation(const DEDState&);
89 :
90 : /**
91 : * \brief Return a synchronized edge for a given transition of the SPN.
92 : */
93 : int GetEnabled_S_Edges(size_t, const DEDState&,const abstractBinding&);
94 :
95 : void resetLinForms();
96 : };
97 :
98 :
99 :
100 :
101 : #endif
|