COPASI API  4.16.103
CTauLeapMethod.h
Go to the documentation of this file.
1 /* Begin CVS Header
2  $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/trajectory/CTauLeapMethod.h,v $
3  $Revision: 1.16 $
4  $Name: $
5  $Author: shoops $
6  $Date: 2011/03/07 19:34:14 $
7  End CVS Header */
8 
9 // Copyright (C) 2011 - 2010 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
15 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
16 // and The University of Manchester.
17 // All rights reserved.
18 
19 // Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
20 // Properties, Inc. and EML Research, gGmbH.
21 // All rights reserved.
22 
23 #ifndef COPASI_CTauLeapMethod
24 #define COPASI_CTauLeapMethod
25 
26 /* INCLUDES ******************************************************************/
29 #include "copasi/model/CState.h"
30 
31 /* DEFINE ********************************************************************/
32 #define TAU 0.01
33 #define EPS 0.03
34 #define USE_RANDOM_SEED false
35 #define RANDOM_SEED 1
36 #define INT_EPSILON 0.1
37 
38 /* CLASSES *******************************************************************/
39 class CTrajectoryProblem;
40 class CState;
41 class CReaction;
42 class CHybridBalance;
43 class CModel;
44 class CMetab;
45 class CRandom;
46 
48 {
49  friend CTrajectoryMethod *
51 
53  {
54  public:
55  // Operations
56  /**
57  * Default constructor
58  */
60 
61  /**
62  * Copy constructor
63  * @param const CReactionDependencies & src
64  */
66 
67  /**
68  * Destructor
69  */
71 
72  /**
73  * Assignment operator
74  * @param const CReactionDependencies & rhs
75  * @return CReactionDependencies &
76  */
78 
79  // Attributes
80 
81  /**
82  * Vector of multiplier to calculate the new state
83  */
85 
86  /**
87  * Vector of indexes of the species for method internal calculations
88  */
90 
91  /**
92  * Vector of pointers to method internal species values to calculate the new state.
93  */
95 
96  /**
97  * Vector of pointers to model species values to calculate the new state.
98  */
100 
101  /**
102  * Vector of multiplier to calculate the new propensity.
103  */
105 
106  /**
107  * Vector of pointers to method internal species values to calculate the new propensity.
108  */
110 
111  /**
112  * Vector of pointers to model species values to calculate the new propensity.
113  */
115 
116  /**
117  * A pointer to the particle flux of the reaction.
118  */
120  };
121 
122  /* PUBLIC METHODS ************************************************************/
123 
124 public:
125  /**
126  * Copy constructor
127  * @param const CTauLeapMethod & src
128  * @param const CCopasiContainer * pParent (default: NULL)
129  */
130  CTauLeapMethod(const CTauLeapMethod & src,
131  const CCopasiContainer * pParent = NULL);
132 
133  /**
134  * Destructor.
135  */
136  ~CTauLeapMethod();
137 
138  /**
139  * This methods must be called to elevate subgroups to
140  * derived objects. The default implementation does nothing.
141  * @return bool success
142  */
143  virtual bool elevateChildren();
144 
145  /**
146  * This instructs the method to calculate a time step of deltaT
147  * starting with the current state, i.e., the result of the previous
148  * step.
149  * The new state (after deltaT) is expected in the current state.
150  * The return value is the actual timestep taken.
151  * @param "const double &" deltaT
152  * @return Status status
153  */
154  virtual Status step(const double & deltaT);
155 
156  /**
157  * This instructs the method to prepare for integration
158  * starting with the initialState given.
159  * @param "const CState *" initialState
160  */
161  virtual void start(const CState * initialState);
162 
163  /**
164  * Check if the method is suitable for this problem
165  * @return bool suitability of the method
166  */
167  virtual bool isValidProblem(const CCopasiProblem * pProblem);
168 
169  /* PROTECTED METHODS *********************************************************/
170 
171 protected:
172  /**
173  * Default constructor.
174  * @param const CCopasiContainer * pParent (default: NULL)
175  */
176  CTauLeapMethod(const CCopasiContainer * pParent = NULL);
177 
178  /**
179  * Cleans up memory, etc.
180  */
181  void cleanup();
182 
183  /**
184  * Simulates the system over the next interval of time. The timestep
185  * is given as argument.
186  *
187  * @param ds A C_FLOAT64 specifying the timestep
188  */
190 
191  /**
192  * Calculate the propensities for all reactions
193  */
194  void updatePropensities();
195 
196  /**
197  * Calculate one of the propensities
198  * @param const size_t & index
199  * @return const C_FLOAT64 & amu
200  */
201  const C_FLOAT64 & calculateAmu(const size_t & index);
202 
203  /**
204  * Updates the system according to the probabilistic
205  * number of firings mK[i] of each reaction i
206  */
207  bool updateSystem();
208 
209  /* VARIABLES *****************************************************************/
210 
211 private:
212  /**
213  * Initialize the method parameter
214  */
215  void initializeParameter();
216 
217 protected:
218 
219  /**
220  * Pointer to the model.
221  */
223 
224  /**
225  * The method internal state which contains particle rounded particle numbers.
226  */
228 
229  /**
230  * Number of reactions.
231  */
233 
234  /**
235  * A vector containing dependency information to minimize the required updates.
236  */
237  std::vector< CReactionDependencies > mReactionDependencies;
238 
239  /**
240  * Number of variable metabolites.
241  */
243 
244  /**
245  * A vector of reaction propensities
246  */
248 
249  /**
250  * Total propensity (sum over mAmu[i])
251  */
253 
254  /**
255  * The k-values of the reactions, that is the
256  * probabilistic number of firings within one leap.
257  */
259 
260  /**
261  * For tau-selection method
262  */
264 
265  /**
266  * For tau-selection method
267  */
269 
270  /**
271  * The tolerance ratio x(t+t')< eps*x(t)
272  */
274 
275  /**
276  * The maximum number of tau leap steps allowed for an integrations step
277  */
278  unsigned C_INT32 mMaxSteps;
279 
280  /**
281  * Specifies if the mRandomSeed should be used.
282  * otherwise a randomly chosen seed is used.
283  */
285 
286  /**
287  * The random seed to use.
288  */
290 
291  /**
292  * The random number generator.
293  */
295 
296  /**
297  * indicates if the correction N^2 -> N*(N-1) should be performed
298  */
300 
301  /**
302  * index of first species in a CState
303  */
305 };
306 
307 #endif // COPASI_CTauLeapMethod
C_FLOAT64 mEpsilon
CVector< C_FLOAT64 > mSpeciesMultiplier
CVector< C_FLOAT64 * > mMethodSubstrates
void initializeParameter()
CVector< C_FLOAT64 > mK
Definition: CState.h:305
size_t mFirstReactionSpeciesIndex
CReactionDependencies & operator=(const CReactionDependencies &rhs)
CVector< C_FLOAT64 * > mMethodSpecies
C_FLOAT64 doSingleStep(C_FLOAT64 ds)
#define C_INT32
Definition: copasi.h:90
Definition: CMetab.h:178
const C_FLOAT64 & calculateAmu(const size_t &index)
std::vector< CReactionDependencies > mReactionDependencies
unsigned C_INT32 mMaxSteps
CVector< C_FLOAT64 > mAmu
virtual Status step(const double &deltaT)
CTauLeapMethod(const CTauLeapMethod &src, const CCopasiContainer *pParent=NULL)
static CTrajectoryMethod * createMethod(CCopasiMethod::SubType subType=CCopasiMethod::deterministic)
CRandom * mpRandomGenerator
CVector< C_FLOAT64 > mSigDX
CVector< C_FLOAT64 * > mModelSubstrates
#define C_FLOAT64
Definition: copasi.h:92
size_t mNumReactionSpecies
CVector< C_FLOAT64 > mAvgDX
Definition: CModel.h:50
unsigned C_INT32 mRandomSeed
virtual bool elevateChildren()
virtual bool isValidProblem(const CCopasiProblem *pProblem)
CVector< C_FLOAT64 > mSubstrateMultiplier
virtual void start(const CState *initialState)
CVector< C_FLOAT64 * > mModelSpecies