예제 #1
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
예제 #2
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
예제 #3
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
예제 #4
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
예제 #5
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