lundi 12 janvier 2015

Time complexity of algorithm with random component (Gillespie Algorithm)

I'm trying to find the time complexity of the Gillespie Algorithm.


General algorithm can be found: Here


More extended version: Here


The assumption is that the number of reactions and the number of proteins is constant. This might allow me to calculate the time complexity by the time variable alone.


But I get stuck since the time increase each iteration is based on a random value. Let me elaborate (removed non relevant code):


So this is the general loop, each iteration the reactions are updated, then the currentTime is updated.



currentTime = 0.0;
while(currentTime < timeEnd)
{
reactions->calcHazard();
currentTime += this->getNextTime();
}


The function getNextTime calculates a new time.



double Gillespie::getNextTime()
{
double randVal;

randVal = ((double) rand() / (double)(RAND_MAX));
while ( randVal == 0)
{
randVal = ((double) rand() / (double)(RAND_MAX));
}
return ((1.0/reactions->getSum())*(log(1.0/randVal)));
}


The calculation of a the new time size is based on a random value R. The other variable component here is the result of reactions->getsum. The return value of this function is



sum(k*A(t))


Where k and A(t) are both vectors, k is the probability for each reaction and A(t) is the number of proteins at time t.


Better explanation about the time increase might be provided by page 7 of previous link.


Is it possible to say anything about the time complexity of this (iteration from tStart -> tEnd)? Or is this impossible without also including information about about #proteins and #reactions?





Aucun commentaire:

Enregistrer un commentaire