def __init__(self, t=TimeAlways()):
     super().__init__(t=t, name='rec-flu-gamma-proc')
     self.p_iter_0 = None
     self.p = lambda iter: gamma(a=5.0, loc=5.0, scale=25.0).pdf(
         iter - self.p_iter_0) * 125
     self.wave = var_frq_sine_wave(1, 0, 1, n_iter / 1000 + 2, 1,
                                   n_iter + 1)
     self.last_applied_iter = None
Example #2
0
 def __init__(self,
              var,
              tm,
              home,
              name='markov-chain',
              t=TimeAlways(),
              memo=None):
     super().__init__(var, tm)
     self.home = home
     self.t = t
Example #3
0
 def __init__(self, tx_matrix, t=TimeAlways(), memo=None):
     super().__init__('startup-growth', t, memo)
     # self.initial_population = tx_matrix.get("initial_population")
     self.round_seed_a = tx_matrix.get("round_seed_a")
     self.round_seed_failure = tx_matrix.get("round_seed_failure")
     self.round_a_b = tx_matrix.get("round_a_b")
     self.round_a_failure = tx_matrix.get("round_a_failure")
     self.round_b_c = tx_matrix.get("round_b_c")
     self.round_b_failure = tx_matrix.get("round_b_failure")
     self.round_c_success = tx_matrix.get("round_c_success")
     self.round_c_failure = tx_matrix.get("round_c_failure")
     self.round_success_success = tx_matrix.get("round_success_success")
     self.round_success_failure = tx_matrix.get("round_success_failure")
     self.round_failure_success = tx_matrix.get("round_failure_success")
     self.round_failure_failure = tx_matrix.get("round_failure_failure")
Example #4
0
    def __init__(self,
                 env_harshness,
                 env_harshness_death_mult=0.001,
                 migration_death_mult=0.05,
                 name='migration',
                 t=TimeAlways(),
                 i=IterAlways()):
        super().__init__(
            name,
            t,
            i,
            group_qry=GroupQry(
                cond=[lambda g: g.has_attr({'is-migrating': True})]))

        self.env_harshness = env_harshness  # [0=benign .. 1=harsh]

        self.env_harshness_death_mult = env_harshness_death_mult
        self.migration_death_mult = migration_death_mult
Example #5
0
    def __init__(self,
                 severity,
                 scale,
                 severity_death_mult=0.0001,
                 scale_migration_mult=0.01,
                 name='conflict',
                 t=TimeAlways(),
                 i=IterAlways()):
        super().__init__(
            name,
            t,
            i,
            group_qry=GroupQry(
                cond=[lambda g: g.has_attr({'is-migrating': False})]))

        self.severity = severity  # [0=benign .. 1=lethal]
        self.scale = scale  # [0=contained .. 1=wide-spread]

        self.severity_death_mult = severity_death_mult
        self.scale_migration_mult = scale_migration_mult
Example #6
0
def make_sir(beta, gamma, t=TimeAlways(), i=IterAlways(), dt=0.1):
    def f_sir_model(t, state):
        '''
        [1] Kermack WO & McKendrick AG (1927) A Contribution to the Mathematical Theory of Epidemics. Proceedings of the
            Royal Society A. 115(772), 700--721.

        http://www.public.asu.edu/~hnesse/classes/sir.html
        '''

        s, i, r = state
        n = s + i + r
        return [-beta * s * i / n, beta * s * i / n - gamma * i, gamma * i]

    return ODESystemMass(f_sir_model, [
        DotMap(attr={'flu': 's'}),
        DotMap(attr={'flu': 'i'}),
        DotMap(attr={'flu': 'r'})
    ],
                         t=t,
                         i=i,
                         dt=dt)
Example #7
0
 def __init__(self, t=TimeAlways(), memo=None):
     super().__init__('startup-location', t, memo)
Example #8
0
 def __init__(self, t=TimeAlways()):
     super().__init__(t=t, name='climate-calamity-proc')
Example #9
0
 def __init__(self, t=TimeAlways()):
     super().__init__(t=t, name='flu-gamma-proc')
     self.p = lambda iter: gamma(a=5.0, loc=5.0, scale=100.0).pdf(
         iter - 1000) * 500
Example #10
0
 def __init__(self, t=TimeAlways()):
     super().__init__(t=t, name='flu-exp-proc')
Example #11
0
 def __init__(self, t=TimeAlways()):
     super().__init__('attr-rule', t)
Example #12
0
 def __init__(self, t=TimeAlways()):
     super().__init__(t=t, name='prey-disease-evt')
Example #13
0
 def __init__(self, t=TimeAlways(), memo=None):
     super().__init__('valuation', t, memo)
Example #14
0
 def __init__(self):
     super().__init__('sir-time-compress-proc', TimeAlways())
     self.wave = var_frq_sine_wave(1, 0, 1, (n_iter / 1000) + 3, 1, n_iter + 1)
     self.last_applied_iter = None
 def __init__(self):
     super().__init__('flu-progress', TimeAlways())
Example #16
0
 def __init__(self, t=TimeAlways()):
     super().__init__(t=t, name='flu-spike-evt')
Example #17
0
 def __init__(self):
     super().__init__('tree-to-wood', TimeAlways())
Example #18
0
File: sim.py Project: momacs/pram
 def __init__(self, t=TimeAlways(), memo=None):
     super().__init__('progress-flu', t, memo)
Example #19
0
 def __init__(self):
     super().__init__('hour-rule', TimeAlways())
Example #20
0
 def __init__(self):
     super().__init__('wood-to-lumber', TimeAlways())
Example #21
0
 def __init__(self):
     super().__init__('double-incidence-of-ad', TimeAlways())
Example #22
0
 def __init__(self): super().__init__('flu-progress', TimeAlways())
 def apply(self, pop, group, iter, t):
 def __init__(self):
     super().__init__('flu-location', TimeAlways())
Example #24
0
 def __init__(self, p, sites):
     super().__init__(name="SimpleMallMovement", t=TimeAlways())
     self.sites = sites
     self.p = p
Example #25
0
 def __init__(self):
     super().__init__('flu-random-beta-proc', TimeAlways())
Example #26
0
 def __init__(self, p, move_p, sites):
     super().__init__(name="SimpleMallFlu", t=TimeAlways())
     self.p = p
     self.move_p = move_p
     self.sites = sites
Example #27
0
 def __init__(self, t=TimeAlways(), memo=None):
     super().__init__('startup-growth', t, memo)
Example #28
0
 def __init__(self):
     super().__init__('get-ad-prob', TimeAlways())