################################################################################ # Scenarios scenario = {} # ------------------------------------------------------------------------------ sc = 1 # Do nothing print(f"Setting up scenario {sc}") scenario[sc] = {} scenario[sc]['parameters'] = copy.deepcopy(common_parameters) set_parameters(scenario[sc]['parameters']) scenario[sc]['model'] = CovidModel() np.random.seed(seed) setup_city_layout(scenario[sc]['model'], population_size) # ------------------------------------------------------------------------------ sc = 2 # complete lockdown print(f"Setting up scenario {sc}") scenario[sc] = {} scenario[sc]['parameters'] = copy.deepcopy(common_parameters) scenario[sc]['parameters'].params['social_policies'] = [ SocialPolicy.LOCKDOWN_OFFICE, SocialPolicy.LOCKDOWN_FACTORY, SocialPolicy.LOCKDOWN_RETAIL, SocialPolicy.LOCKDOWN_ELEMENTARY_SCHOOL, SocialPolicy.LOCKDOWN_MIDDLE_SCHOOL, SocialPolicy.LOCKDOWN_HIGH_SCHOOL, SocialPolicy.SOCIAL_DISTANCING
base.flip_coin("50") def test_random_selection(): random_numbers = np.random.rand(5) assert base.random_selection(random_numbers, 1) in random_numbers # Setting up parameters hospitalization_capacity = 0.05 parameters = base.SimulationParameters( hospitalization_capacity=hospitalization_capacity) base.set_parameters(parameters) model = base.CovidModel() population_size = 1000 setup_city_layout(model, population_size) def test_agent_base(): random_id = np.random.randint(50) sample_agent = base.AgentBase(random_id, model) assert sample_agent.id == random_id assert sample_agent in model.agents def test_initial_model_state(): # Assert initial model state assert model.agents assert model.reached_hospitalization_limit() is False assert isinstance(model.get_week_day(), WeekDay) assert model.is_week_day(WeekDay.MONDAY)