def runCoexistence(self, N, r, d, K, b1, b2): timeUntilDeath = 0 survivor = 0 population = Population(0, mutationON=False) population.addIndividual(r, d, N, b1, K, resident=True) population.addIndividual(r, d, N, b2, K, resident=False) while population.residentinvaderPresent(): population.updatePopulation(1) timeUntilDeath += 1 if population.residentPresent(): survivor = 1 if population.invaderPresent(): survivor = 2 return ma.log10(timeUntilDeath), survivor
def runInvasion(self, repetitions, delay, dataTime, N1, N2, r, d, K, b1, b2): #: Function for running the invasion #: @param repetitions: repetitions #: @return: returns the fraction of runs in which the invader was successful invasion = 0 for rep in range(0,repetitions): population = Population(0, mutationON=False) population.addIndividual(r, d, N1, b1, K, resident=True) population.updatePopulation(delay) population.addIndividual(r, d, N2, b2, K, resident=False) population.updatePopulation(dataTime) if population.invaderPresent(): invasion += 1.0 return invasion / repetitions