Beispiel #1
0
def simulation_contact_tracing(n, p, times):
    interventions = []
    mapping = {
        'S':  'QS',
        'E':  'QE',
        'I1': 'Q1',
        'I2': 'Q2',
        'I3': 'Q3',
        'R':  'R',
        'D':  'D',
        'Q1': 'Q1',
        'Q2': 'Q2',
        'Q3': 'Q3',
        'QS': 'QS',
        'QE': 'QE'
    }
    for time in times:
        interventions.append(
            ContactTracingIntervention(["I1", "I2", "I3"], mapping, p, time,)
        )
    LG = setup_LG(n)
    M = QuorontracingModel(0, 0, 0)
    c_observer = CountObserver(quolor_palette.keys())
    observers = [c_observer]
    M.init_states(LG, 5)
    simulate(LG, M, interventions, 50, observers)  # scale x -axis
    return c_observer.data
Beispiel #2
0
def simulation_age_model(n, b_kids, g_kids, p_kids, b_normal, g_normal, p_normal, b_risk, g_risk, p_risk):
    LG = setup_LG(n)
    AM = AgeModel(b_kids, g_kids, p_kids, b_normal, g_normal, p_normal,
                  b_risk, g_risk, p_risk)
    c_observer = CountObserver(kolor_palette.keys())
    AM.init_states(LG, 5)
    simulate(LG, AM, set(), 50, [c_observer])
    return c_observer.data
Beispiel #3
0
def simulation_max_class(n, class_size, degree, p):
    if degree is None and p is None:
        LG, CH = setup_CH(n, classsize=class_size)
    else:
        LG, CH = setup_CH(n, classsize=class_size, degree=degree, p=p)
    CH.init_states(LG, 5)
    c_observer = CountObserver(color_palette.keys())
    simulate(LG, CH, set(), 50, [c_observer])
    return c_observer.data
Beispiel #4
0
def simulation_max_quarantine_rates(n, q1, q2, q3):
    LG = setup_LG(n)
    CH = CoronaQuarantineModel(q1, q2, q3)
    # Observer
    c_observer = CountObserver(qolor_palette.keys())
    observers = [c_observer]
    # Simulation
    CH.init_states(LG, 5)
    simulate(LG, CH, set(), 50, observers)
    return c_observer.data
Beispiel #5
0
def simulation_age_max_class(n, class_size, degree, p):
    if degree is None and p is None:
        LG = setup_LG(n, classsize=class_size)
    else:
        LG = setup_LG(n, classsize=class_size, degree=degree, p=p)
    AM = AgeModel(B_KIDS, G_KIDS, P_KIDS, B_NORMAL, G_NORMAL, P_NORMAL,
                  B_NORMAL, G_NORMAL, P_NORMAL)
    AM.init_states(LG, 5)
    c_observer = CountObserver(kolor_palette.keys())
    simulate(LG, AM, set(), 50, [c_observer])
    return c_observer.data
Beispiel #6
0
def simulation_max_time(n, t):
    LG, CH = setup_CH(n)
    # Interventions
    layernames_to_p = {
        "Households": 1, "Schools": 0, "Workplaces": 0.01,
        "R_Workplaces": 0, "Social": 0, "parties": 0.00, "basic": 0.1}
    um_intervention1 = UpdateMultipleLayerIntervention(layernames_to_p, t)
    # Observer
    c_observer = CountObserver(color_palette.keys())
    observers = [c_observer]
    # Simulation
    CH.init_states(LG, 5)
    simulate(LG, CH, {um_intervention1}, 50, observers)
    return c_observer.data
Beispiel #7
0
def simulation_second_wave():
    LG, CH = setup_CH(N)
    # Interventions
    layernames_to_p1 = {
        "Households": 0.5, "Schools": 0, "Workplaces": 0.01,
        "R_Workplaces": 0, "Social": 0.01, "parties": 0.00,
        "basic": 0.01
    }
    layernames_to_p2 = {
        "Households": 1, "Schools": 1, "Workplaces": 1,
        "R_Workplaces": 1, "Social": 1, "parties": 1,
        "basic": 1
    }
    um_intervention1 = UpdateMultipleLayerIntervention(layernames_to_p1, 6)
    # 7.8
    um_intervention2 = UpdateMultipleLayerIntervention(layernames_to_p2, 28.7)
    # 29.7
    # Observer
    c_observer = CountObserver(color_palette.keys())
    # Simulation
    CH.init_states(LG, 5)
    interventions = {um_intervention1, um_intervention2}
    simulate(LG, CH, interventions, 50, [c_observer])
    return c_observer.data
Beispiel #8
0
def simulation_no_intervention(n):
    LG, CH = setup_CH(n)
    c_observer = CountObserver(color_palette.keys())
    CH.init_states(LG, 5)
    simulate(LG, CH, set(), 50, [c_observer])
    return c_observer.data
Beispiel #9
0
def simulation_half_edges():
    LG, CH = setup_CH(N, p=0.5)
    c_observer = CountObserver(color_palette.keys())
    CH.init_states(LG, 5)
    simulate(LG, CH, set(), 50, [c_observer])
    return c_observer.data