From 4fe7faaa4543d278eb9bd7cc1def89fbdca7397d Mon Sep 17 00:00:00 2001 From: Khoa Nguyen <4763945+khoanguyen-dev@users.noreply.github.com> Date: Sat, 16 Dec 2023 16:46:36 +0100 Subject: [PATCH 1/4] Renaming age group variables to use lower-case letters --- cpp/examples/abm_history_object.cpp | 28 +- cpp/models/abm/README.md | 4 +- cpp/simulations/abm.cpp | 302 +++++++++--------- cpp/simulations/abm_braunschweig.cpp | 284 ++++++++-------- cpp/tests/abm_helpers.h | 20 +- cpp/tests/test_abm_household.cpp | 32 +- cpp/tests/test_abm_infection.cpp | 46 +-- cpp/tests/test_abm_location.cpp | 62 ++-- cpp/tests/test_abm_lockdown_rules.cpp | 64 ++-- cpp/tests/test_abm_masks.cpp | 14 +- cpp/tests/test_abm_migration_rules.cpp | 188 +++++------ cpp/tests/test_abm_person.cpp | 66 ++-- cpp/tests/test_abm_simulation.cpp | 20 +- cpp/tests/test_abm_testing_strategy.cpp | 26 +- cpp/tests/test_abm_world.cpp | 196 ++++++------ cpp/tests/test_json_serializer.cpp | 10 +- .../memilio/simulation_test/test_abm.py | 10 +- 17 files changed, 686 insertions(+), 686 deletions(-) diff --git a/cpp/examples/abm_history_object.cpp b/cpp/examples/abm_history_object.cpp index 3f6b6bfbfc..9b8be77c5a 100644 --- a/cpp/examples/abm_history_object.cpp +++ b/cpp/examples/abm_history_object.cpp @@ -61,14 +61,14 @@ int main() { // This is a minimal example with children and adults < 60y. // We divided them into 4 different age groups, which are defined as follows: - const size_t NUM_AGE_GROUPS = 4; - const auto AGE_GROUP_0_TO_4 = mio::AgeGroup(NUM_AGE_GROUPS - 4); - const auto AGE_GROUP_5_TO_14 = mio::AgeGroup(NUM_AGE_GROUPS - 3); - const auto AGE_GROUP_15_TO_34 = mio::AgeGroup(NUM_AGE_GROUPS - 2); - const auto AGE_GROUP_35_TO_59 = mio::AgeGroup(NUM_AGE_GROUPS - 1); + const size_t num_age_groups = 4; + const auto age_groups_0_to_4 = mio::AgeGroup(num_age_groups - 4); + const auto age_groups_5_to_14 = mio::AgeGroup(num_age_groups - 3); + const auto age_groups_15_to_34 = mio::AgeGroup(num_age_groups - 2); + const auto age_groups_35_to_59 = mio::AgeGroup(num_age_groups - 1); // Create the world with 4 age groups. - auto world = mio::abm::World(NUM_AGE_GROUPS); + auto world = mio::abm::World(num_age_groups); // Set same infection parameter for all age groups. For example, the incubation period is 4 days. world.parameters.get() = 4.; @@ -77,13 +77,13 @@ int main() int n_households = 3; // For more than 1 family households we need families. These are parents and children and randoms (which are distributed like the data we have for these households). - auto child = mio::abm::HouseholdMember(NUM_AGE_GROUPS); // A child is 50/50% 0-4 or 5-14. - child.set_age_weight(AGE_GROUP_0_TO_4, 1); - child.set_age_weight(AGE_GROUP_5_TO_14, 1); + auto child = mio::abm::HouseholdMember(num_age_groups); // A child is 50/50% 0-4 or 5-14. + child.set_age_weight(age_groups_0_to_4, 1); + child.set_age_weight(age_groups_5_to_14, 1); - auto parent = mio::abm::HouseholdMember(NUM_AGE_GROUPS); // A parent is 50/50% 15-34 or 35-59. - parent.set_age_weight(AGE_GROUP_15_TO_34, 1); - parent.set_age_weight(AGE_GROUP_35_TO_59, 1); + auto parent = mio::abm::HouseholdMember(num_age_groups); // A parent is 50/50% 15-34 or 35-59. + parent.set_age_weight(age_groups_15_to_34, 1); + parent.set_age_weight(age_groupsP_35_to_59, 1); // Two-person household with one parent and one child. auto twoPersonHousehold_group = mio::abm::HouseholdGroup(); @@ -152,10 +152,10 @@ int main() person.set_assigned_location(hospital); person.set_assigned_location(icu); //assign work/school to people depending on their age - if (person.get_age() == AGE_GROUP_5_TO_14) { + if (person.get_age() == age_groups_5_to_14) { person.set_assigned_location(school); } - if (person.get_age() == AGE_GROUP_15_TO_34 || person.get_age() == AGE_GROUP_35_TO_59) { + if (person.get_age() == age_groups_15_to_34 || person.get_age() == age_groups_35_to_59) { person.set_assigned_location(work); } } diff --git a/cpp/models/abm/README.md b/cpp/models/abm/README.md index 405f68bb7c..70ec2fdca4 100644 --- a/cpp/models/abm/README.md +++ b/cpp/models/abm/README.md @@ -82,8 +82,8 @@ child.set_age_weight(age_group_0_to_4, 1); child.set_age_weight(age_group_0_to_4, 1); auto parent = mio::abm::HouseholdMember(num_age_groups); -parent.set_age_weight(AGE_GROUP_15_TO_34, 1); -parent.set_age_weight(AGE_GROUP_35_TO_59, 1); +parent.set_age_weight(age_groups_15_to_34, 1); +parent.set_age_weight(age_groups_35_to_59, 1); // Two-person household with one parent and one child. auto twoPersonHousehold_group = mio::abm::HouseholdGroup(); diff --git a/cpp/simulations/abm.cpp b/cpp/simulations/abm.cpp index ba1cb50e9c..496e9adfd4 100644 --- a/cpp/simulations/abm.cpp +++ b/cpp/simulations/abm.cpp @@ -29,12 +29,12 @@ namespace fs = boost::filesystem; // Assign the name to general age group. size_t num_age_groups = 6; -const auto AGE_GROUP_0_TO_4 = mio::AgeGroup(num_age_groups - 6); -const auto AGE_GROUP_5_TO_14 = mio::AgeGroup(num_age_groups - 5); -const auto AGE_GROUP_15_TO_34 = mio::AgeGroup(num_age_groups - 4); -const auto AGE_GROUP_35_TO_59 = mio::AgeGroup(num_age_groups - 3); -const auto AGE_GROUP_60_TO_79 = mio::AgeGroup(num_age_groups - 2); -const auto AGE_GROUP_80_PLUS = mio::AgeGroup(num_age_groups - 1); +const auto age_group_0_to_4 = mio::AgeGroup(num_age_groups - 6); +const auto age_group_5_to_14 = mio::AgeGroup(num_age_groups - 5); +const auto age_group_15_to_34 = mio::AgeGroup(num_age_groups - 4); +const auto age_group_35_to_59 = mio::AgeGroup(num_age_groups - 3); +const auto age_group_60_to_79 = mio::AgeGroup(num_age_groups - 2); +const auto age_group_80_plus = mio::AgeGroup(num_age_groups - 1); /** * Set a value and distribution of an UncertainValue. @@ -185,12 +185,12 @@ void create_world_from_statistical_data(mio::abm::World& world) // Refugee auto refugee = mio::abm::HouseholdMember(num_age_groups); - refugee.set_age_weight(AGE_GROUP_0_TO_4, 25); - refugee.set_age_weight(AGE_GROUP_5_TO_14, 12); - refugee.set_age_weight(AGE_GROUP_15_TO_34, 25); - refugee.set_age_weight(AGE_GROUP_35_TO_59, 9); - refugee.set_age_weight(AGE_GROUP_60_TO_79, 1); - refugee.set_age_weight(AGE_GROUP_80_PLUS, 1); + refugee.set_age_weight(age_group_0_to_4, 25); + refugee.set_age_weight(age_group_5_to_14, 12); + refugee.set_age_weight(age_group_15_to_34, 25); + refugee.set_age_weight(age_group_35_to_59, 9); + refugee.set_age_weight(age_group_60_to_79, 1); + refugee.set_age_weight(age_group_80_plus, 1); int refugee_number_of_people = 74; int refugee_number_of_households = 12; auto refugeeGroup = make_uniform_households(refugee, refugee_number_of_people, refugee_number_of_households); @@ -199,12 +199,12 @@ void create_world_from_statistical_data(mio::abm::World& world) // Disabled auto disabled = mio::abm::HouseholdMember(num_age_groups); - disabled.set_age_weight(AGE_GROUP_0_TO_4, 2); - disabled.set_age_weight(AGE_GROUP_5_TO_14, 6); - disabled.set_age_weight(AGE_GROUP_15_TO_34, 13); - disabled.set_age_weight(AGE_GROUP_35_TO_59, 42); - disabled.set_age_weight(AGE_GROUP_60_TO_79, 97); - disabled.set_age_weight(AGE_GROUP_80_PLUS, 32); + disabled.set_age_weight(age_group_0_to_4, 2); + disabled.set_age_weight(age_group_5_to_14, 6); + disabled.set_age_weight(age_group_15_to_34, 13); + disabled.set_age_weight(age_group_35_to_59, 42); + disabled.set_age_weight(age_group_60_to_79, 97); + disabled.set_age_weight(age_group_80_plus, 32); int disabled_number_of_people = 194; int disabled_number_of_households = 8; @@ -214,10 +214,10 @@ void create_world_from_statistical_data(mio::abm::World& world) // Retirement auto retired = mio::abm::HouseholdMember(num_age_groups); - retired.set_age_weight(AGE_GROUP_15_TO_34, 1); - retired.set_age_weight(AGE_GROUP_35_TO_59, 30); - retired.set_age_weight(AGE_GROUP_60_TO_79, 185); - retired.set_age_weight(AGE_GROUP_80_PLUS, 530); + retired.set_age_weight(age_group_15_to_34, 1); + retired.set_age_weight(age_group_35_to_59, 30); + retired.set_age_weight(age_group_60_to_79, 185); + retired.set_age_weight(age_group_80_plus, 530); int retirement_number_of_people = 744; int retirement_number_of_households = 16; @@ -228,12 +228,12 @@ void create_world_from_statistical_data(mio::abm::World& world) // Others auto other = mio::abm::HouseholdMember(num_age_groups); - other.set_age_weight(AGE_GROUP_0_TO_4, 30); - other.set_age_weight(AGE_GROUP_5_TO_14, 40); - other.set_age_weight(AGE_GROUP_15_TO_34, 72); - other.set_age_weight(AGE_GROUP_35_TO_59, 40); - other.set_age_weight(AGE_GROUP_60_TO_79, 30); - other.set_age_weight(AGE_GROUP_80_PLUS, 10); + other.set_age_weight(age_group_0_to_4, 30); + other.set_age_weight(age_group_5_to_14, 40); + other.set_age_weight(age_group_15_to_34, 72); + other.set_age_weight(age_group_35_to_59, 40); + other.set_age_weight(age_group_60_to_79, 30); + other.set_age_weight(age_group_80_plus, 10); int others_number_of_people = 222; int others_number_of_households = 20; @@ -243,10 +243,10 @@ void create_world_from_statistical_data(mio::abm::World& world) // One Person Household (we have exact age data about this) auto one_person_household_member = mio::abm::HouseholdMember(num_age_groups); - one_person_household_member.set_age_weight(AGE_GROUP_15_TO_34, 4364); - one_person_household_member.set_age_weight(AGE_GROUP_35_TO_59, 7283); - one_person_household_member.set_age_weight(AGE_GROUP_60_TO_79, 4100); - one_person_household_member.set_age_weight(AGE_GROUP_80_PLUS, 1800); + one_person_household_member.set_age_weight(age_group_15_to_34, 4364); + one_person_household_member.set_age_weight(age_group_35_to_59, 7283); + one_person_household_member.set_age_weight(age_group_60_to_79, 4100); + one_person_household_member.set_age_weight(age_group_80_plus, 1800); int one_person_number_of_people = 15387; int one_person_number_of_households = 15387; @@ -257,22 +257,22 @@ void create_world_from_statistical_data(mio::abm::World& world) // For more than 1 family households we need families. These are parents and children and randoms (which are distributed like the data we have for these households). auto child = mio::abm::HouseholdMember(num_age_groups); // A child is 50/50% 0-4 or 5-14. - child.set_age_weight(AGE_GROUP_0_TO_4, 1); - child.set_age_weight(AGE_GROUP_5_TO_14, 1); + child.set_age_weight(age_group_0_to_4, 1); + child.set_age_weight(age_group_5_to_14, 1); auto parent = mio::abm::HouseholdMember(num_age_groups); // A child is 40/40/20% 15-34, 35-59 or 60-79. - parent.set_age_weight(AGE_GROUP_15_TO_34, 2); - parent.set_age_weight(AGE_GROUP_35_TO_59, 2); - parent.set_age_weight(AGE_GROUP_60_TO_79, 1); + parent.set_age_weight(age_group_15_to_34, 2); + parent.set_age_weight(age_group_35_to_59, 2); + parent.set_age_weight(age_group_60_to_79, 1); auto random = mio::abm::HouseholdMember(num_age_groups); // Randoms are distributed according to the left over persons. - random.set_age_weight(AGE_GROUP_0_TO_4, 5000); - random.set_age_weight(AGE_GROUP_5_TO_14, 6000); - random.set_age_weight(AGE_GROUP_15_TO_34, 14943); - random.set_age_weight(AGE_GROUP_35_TO_59, 22259); - random.set_age_weight(AGE_GROUP_60_TO_79, 11998); - random.set_age_weight(AGE_GROUP_80_PLUS, 5038); + random.set_age_weight(age_group_0_to_4, 5000); + random.set_age_weight(age_group_5_to_14, 6000); + random.set_age_weight(age_group_15_to_34, 14943); + random.set_age_weight(age_group_35_to_59, 22259); + random.set_age_weight(age_group_60_to_79, 11998); + random.set_age_weight(age_group_80_plus, 5038); // Two person households int two_person_full_families = 11850; @@ -387,11 +387,11 @@ void create_assign_locations(mio::abm::World& world) person.set_assigned_location(hospital); person.set_assigned_location(icu); //assign work/school to people depending on their age - if (person.get_age() == AGE_GROUP_5_TO_14) { + if (person.get_age() == age_group_5_to_14) { person.set_assigned_location(school); counter_school++; } - if (person.get_age() == AGE_GROUP_15_TO_34 || person.get_age() == AGE_GROUP_35_TO_59) { + if (person.get_age() == age_group_15_to_34 || person.get_age() == age_group_35_to_59) { person.set_assigned_location(work); counter_work++; } @@ -470,153 +470,153 @@ void set_parameters(mio::abm::Parameters params) }; //0-4 - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.276; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.092; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.142; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.001; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.186; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.015; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.143; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.001; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.276; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.092; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.142; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.001; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.186; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.015; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.143; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.001; //5-14 - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.276; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.276; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.092; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.142; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.001; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.186; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.015; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.143; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.001; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.142; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.001; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.186; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.015; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.143; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.001; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.; //15-34 - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.315; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.079; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.139; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.003; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.157; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.013; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.126; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.021; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.139; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.003; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.157; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.013; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.126; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.021; //35-59 - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.315; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.079; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.136; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.009; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.113; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.02; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.05; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.008; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.136; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.009; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.113; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.02; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.05; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.008; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.; //60-79 - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.315; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.079; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.123; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.024; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.083; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.035; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.035; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.023; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.123; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.024; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.083; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.035; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.035; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.023; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.; //80+ - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.315; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.315; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.079; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.115; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.033; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.055; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.036; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.035; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.052; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.115; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.033; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.055; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.036; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.035; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.052; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.; // Set each parameter for vaccinated people including personal infection and vaccine protection levels. // Summary: https://doi.org/10.1038/s41577-021-00550-x, //0-4 - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.161; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.132; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.143; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.001; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.186; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.015; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.143; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.001; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.0; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.161; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.132; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.143; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.001; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.186; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.015; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.143; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.001; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.0; //5-14 - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.161; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.161; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.132; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.143; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.001; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.186; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.015; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.143; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.001; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.0; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.143; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.001; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.186; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.015; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.143; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.001; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.0; //15-34 - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.179; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.126; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.142; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.001; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.157; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.013; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.126; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.021; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.0; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.142; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.001; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.157; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.013; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.126; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.021; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.0; //35-59 - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.179; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.126; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.141; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.003; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.113; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.02; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.05; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.008; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.0; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.141; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.003; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.113; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.02; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.05; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.008; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.0; //60-79 - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.179; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.126; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.136; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.009; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.083; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.035; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.035; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.023; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.0; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.136; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.009; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.083; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.035; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.035; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.023; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.0; //80+ - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.179; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.179; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.126; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.133; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.012; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.055; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.036; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.035; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.052; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.0; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.133; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.012; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.055; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.036; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.035; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.052; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.0; } /** diff --git a/cpp/simulations/abm_braunschweig.cpp b/cpp/simulations/abm_braunschweig.cpp index d9480ed15f..734f0e7ae9 100644 --- a/cpp/simulations/abm_braunschweig.cpp +++ b/cpp/simulations/abm_braunschweig.cpp @@ -34,12 +34,12 @@ namespace fs = boost::filesystem; // Assign the name to general age group. size_t num_age_groups = 6; -const auto AGE_GROUP_0_TO_4 = mio::AgeGroup(num_age_groups - 6); -const auto AGE_GROUP_5_TO_14 = mio::AgeGroup(num_age_groups - 5); -const auto AGE_GROUP_15_TO_34 = mio::AgeGroup(num_age_groups - 4); -const auto AGE_GROUP_35_TO_59 = mio::AgeGroup(num_age_groups - 3); -const auto AGE_GROUP_60_TO_79 = mio::AgeGroup(num_age_groups - 2); -const auto AGE_GROUP_80_PLUS = mio::AgeGroup(num_age_groups - 1); +const auto age_group_0_to_4 = mio::AgeGroup(num_age_groups - 6); +const auto age_group_5_to_14 = mio::AgeGroup(num_age_groups - 5); +const auto age_group_15_to_34 = mio::AgeGroup(num_age_groups - 4); +const auto age_group_35_to_59 = mio::AgeGroup(num_age_groups - 3); +const auto age_group_60_to_79 = mio::AgeGroup(num_age_groups - 2); +const auto age_group_80_plus = mio::AgeGroup(num_age_groups - 1); /** * Set a value and distribution of an UncertainValue. @@ -166,22 +166,22 @@ mio::abm::LocationType get_location_type(uint32_t acitivity_end) mio::AgeGroup determine_age_group(uint32_t age) { if (age <= 4) { - return AGE_GROUP_0_TO_4; + return age_group_0_to_4; } else if (age <= 14) { - return AGE_GROUP_5_TO_14; + return age_group_5_to_14; } else if (age <= 34) { - return AGE_GROUP_15_TO_34; + return age_group_15_to_34; } else if (age <= 59) { - return AGE_GROUP_35_TO_59; + return age_group_35_to_59; } else if (age <= 79) { - return AGE_GROUP_60_TO_79; + return age_group_60_to_79; } else { - return AGE_GROUP_80_PLUS; + return age_group_80_plus; } } @@ -398,93 +398,93 @@ void set_parameters(mio::abm::Parameters params) }; //0-4 - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.276; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.092; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.142; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.001; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.186; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.015; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.143; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.001; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.276; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.092; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.142; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.001; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.186; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.015; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.143; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.001; //5-14 - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.276; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.276; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.092; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.142; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.001; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.186; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.015; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.143; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.001; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.142; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.001; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.186; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.015; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.143; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.001; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.; //15-34 - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.315; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.079; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.139; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.003; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.157; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.013; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.126; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.021; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.139; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.003; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.157; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.013; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.126; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.021; //35-59 - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.315; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.079; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.136; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.009; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.113; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.02; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.05; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.008; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.136; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.009; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.113; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.02; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.05; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.008; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.; //60-79 - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.315; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.079; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.123; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.024; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.083; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.035; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.035; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.023; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.123; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.024; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.083; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.035; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.035; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.023; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.; //80+ - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.315; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.315; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.079; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.115; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.033; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.055; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.036; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.035; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.052; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.115; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.033; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.055; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.036; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.035; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.052; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.; // Set each parameter for vaccinated people including personal infection and vaccine protection levels. // Summary: https://doi.org/10.1038/s41577-021-00550-x, //0-4 - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.161; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.132; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.143; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.001; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.186; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.015; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.143; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.001; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.0; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.161; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.132; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.143; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.001; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.186; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.015; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.143; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.001; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.0; // Protection of reinfection is the same for all age-groups, based on: // https://doi.org/10.1016/S0140-6736(22)02465-5, https://doi.org/10.1038/s41591-021-01377-8 - params.get()[{mio::abm::ExposureType::NaturalInfection, AGE_GROUP_0_TO_4, + params.get()[{mio::abm::ExposureType::NaturalInfection, age_group_0_to_4, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set({{0, 0.852}, @@ -502,7 +502,7 @@ void set_parameters(mio::abm::Parameters params) days); }; // Information is based on: https://doi.org/10.1016/S0140-6736(21)02183-8 - params.get()[{mio::abm::ExposureType::GenericVaccine, AGE_GROUP_0_TO_4, + params.get()[{mio::abm::ExposureType::GenericVaccine, age_group_0_to_4, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set( @@ -511,7 +511,7 @@ void set_parameters(mio::abm::Parameters params) // Set up age-related severe protection levels, based on: // https://doi.org/10.1016/S0140-6736(22)02465-5 - params.get()[{mio::abm::ExposureType::NaturalInfection, AGE_GROUP_0_TO_4, + params.get()[{mio::abm::ExposureType::NaturalInfection, age_group_0_to_4, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set({{0, 0.967}, @@ -531,7 +531,7 @@ void set_parameters(mio::abm::Parameters params) days); }; // Information is based on: https://doi.org/10.1016/S0140-6736(21)02183-8 - params.get()[{mio::abm::ExposureType::GenericVaccine, AGE_GROUP_0_TO_4, + params.get()[{mio::abm::ExposureType::GenericVaccine, age_group_0_to_4, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set( @@ -539,19 +539,19 @@ void set_parameters(mio::abm::Parameters params) }; //5-14 - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.161; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.161; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.132; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.143; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.001; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.186; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.015; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.143; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.001; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 0.0; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.143; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.001; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.186; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.015; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.143; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.001; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 0.0; // Protection of reinfection is the same for all age-groups, based on: // https://doi.org/10.1016/S0140-6736(22)02465-5, https://doi.org/10.1038/s41591-021-01377-8 - params.get()[{mio::abm::ExposureType::NaturalInfection, AGE_GROUP_5_TO_14, + params.get()[{mio::abm::ExposureType::NaturalInfection, age_group_5_to_14, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set({{0, 0.852}, @@ -569,7 +569,7 @@ void set_parameters(mio::abm::Parameters params) days); }; // Information is based on: https://doi.org/10.1016/S0140-6736(21)02183-8 - params.get()[{mio::abm::ExposureType::GenericVaccine, AGE_GROUP_5_TO_14, + params.get()[{mio::abm::ExposureType::GenericVaccine, age_group_5_to_14, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set( @@ -577,7 +577,7 @@ void set_parameters(mio::abm::Parameters params) }; // Set up age-related severe protection levels, based on: // https://doi.org/10.1016/S0140-6736(22)02465-5 - params.get()[{mio::abm::ExposureType::NaturalInfection, AGE_GROUP_5_TO_14, + params.get()[{mio::abm::ExposureType::NaturalInfection, age_group_5_to_14, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set({{0, 0.967}, @@ -597,7 +597,7 @@ void set_parameters(mio::abm::Parameters params) days); }; // Information is based on: https://doi.org/10.1016/S0140-6736(21)02183-8 - params.get()[{mio::abm::ExposureType::GenericVaccine, AGE_GROUP_5_TO_14, + params.get()[{mio::abm::ExposureType::GenericVaccine, age_group_5_to_14, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set( @@ -605,19 +605,19 @@ void set_parameters(mio::abm::Parameters params) }; //15-34 - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.179; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.126; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.142; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.001; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.157; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.013; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.126; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.021; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = 0.0; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.142; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.001; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.157; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.013; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.126; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.021; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 0.0; // Set up personal infection and vaccine protection levels, based on: https://doi.org/10.1038/s41577-021-00550-x, https://doi.org/10.1038/s41591-021-01377-8 - params.get()[{mio::abm::ExposureType::NaturalInfection, AGE_GROUP_15_TO_34, + params.get()[{mio::abm::ExposureType::NaturalInfection, age_group_15_to_34, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set({{0, 0.852}, @@ -635,7 +635,7 @@ void set_parameters(mio::abm::Parameters params) days); }; // Information is based on: https://doi.org/10.1016/S0140-6736(21)02183-8 - params.get()[{mio::abm::ExposureType::GenericVaccine, AGE_GROUP_15_TO_34, + params.get()[{mio::abm::ExposureType::GenericVaccine, age_group_15_to_34, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set( @@ -643,7 +643,7 @@ void set_parameters(mio::abm::Parameters params) }; // Set up age-related severe protection levels, based on: // https://doi.org/10.1016/S0140-6736(22)02465-5 - params.get()[{mio::abm::ExposureType::NaturalInfection, AGE_GROUP_15_TO_34, + params.get()[{mio::abm::ExposureType::NaturalInfection, age_group_15_to_34, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set({{0, 0.967}, @@ -663,7 +663,7 @@ void set_parameters(mio::abm::Parameters params) days); }; // Information is from: https://doi.org/10.1016/S0140-6736(21)02183-8 - params.get()[{mio::abm::ExposureType::GenericVaccine, AGE_GROUP_15_TO_34, + params.get()[{mio::abm::ExposureType::GenericVaccine, age_group_15_to_34, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set( @@ -671,20 +671,20 @@ void set_parameters(mio::abm::Parameters params) }; //35-59 - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.179; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.126; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.141; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.003; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.113; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.02; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.05; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.008; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = 0.0; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.141; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.003; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.113; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.02; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.05; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.008; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.0; // Protection of reinfection is the same for all age-groups, based on: // https://doi.org/10.1016/S0140-6736(22)02465-5, https://doi.org/10.1038/s41591-021-01377-8 - params.get()[{mio::abm::ExposureType::NaturalInfection, AGE_GROUP_35_TO_59, + params.get()[{mio::abm::ExposureType::NaturalInfection, age_group_35_to_59, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set({{0, 0.852}, @@ -702,7 +702,7 @@ void set_parameters(mio::abm::Parameters params) days); }; // Information is based on: https://doi.org/10.1016/S0140-6736(21)02183-8 - params.get()[{mio::abm::ExposureType::GenericVaccine, AGE_GROUP_35_TO_59, + params.get()[{mio::abm::ExposureType::GenericVaccine, age_group_35_to_59, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set( @@ -710,7 +710,7 @@ void set_parameters(mio::abm::Parameters params) }; // Set up age-related severe protection levels, based on: // https://doi.org/10.1016/S0140-6736(22)02465-5 - params.get()[{mio::abm::ExposureType::NaturalInfection, AGE_GROUP_35_TO_59, + params.get()[{mio::abm::ExposureType::NaturalInfection, age_group_35_to_59, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set({{0, 0.967}, @@ -730,7 +730,7 @@ void set_parameters(mio::abm::Parameters params) days); }; // Information is from: https://doi.org/10.1016/S0140-6736(21)02183-8 - params.get()[{mio::abm::ExposureType::GenericVaccine, AGE_GROUP_35_TO_59, + params.get()[{mio::abm::ExposureType::GenericVaccine, age_group_35_to_59, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set( @@ -738,20 +738,20 @@ void set_parameters(mio::abm::Parameters params) }; //60-79 - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.179; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.126; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.136; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.009; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.083; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.035; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.035; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.023; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.0; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.136; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.009; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.083; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.035; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.035; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.023; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.0; // Protection of reinfection is the same for all age-groups, based on: // https://doi.org/10.1016/S0140-6736(22)02465-5, https://doi.org/10.1038/s41591-021-01377-8 - params.get()[{mio::abm::ExposureType::NaturalInfection, AGE_GROUP_60_TO_79, + params.get()[{mio::abm::ExposureType::NaturalInfection, age_group_60_to_79, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set({{0, 0.852}, @@ -769,7 +769,7 @@ void set_parameters(mio::abm::Parameters params) days); }; // Information is based on: https://doi.org/10.1016/S0140-6736(21)02183-8 - params.get()[{mio::abm::ExposureType::GenericVaccine, AGE_GROUP_60_TO_79, + params.get()[{mio::abm::ExposureType::GenericVaccine, age_group_60_to_79, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set( @@ -778,7 +778,7 @@ void set_parameters(mio::abm::Parameters params) // Set up personal severe protection levels. // Protection of severe infection of age group 65 + is different from other age group, based on: // https://doi.org/10.1016/S0140-6736(22)02465-5 - params.get()[{mio::abm::ExposureType::NaturalInfection, AGE_GROUP_60_TO_79, + params.get()[{mio::abm::ExposureType::NaturalInfection, age_group_60_to_79, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set({{0, 0.967}, @@ -797,7 +797,7 @@ void set_parameters(mio::abm::Parameters params) {360, 0.5}}, days); }; - params.get()[{mio::abm::ExposureType::GenericVaccine, AGE_GROUP_60_TO_79, + params.get()[{mio::abm::ExposureType::GenericVaccine, age_group_60_to_79, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set( @@ -805,19 +805,19 @@ void set_parameters(mio::abm::Parameters params) }; //80+ - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.179; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.179; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.126; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.133; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.012; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.055; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.036; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.035; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.052; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_80_PLUS}] = 0.0; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.133; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.012; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.055; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.036; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.035; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.052; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_80_plus}] = 0.0; // Protection of reinfection is the same for all age-groups, based on: // https://doi.org/10.1016/S0140-6736(22)02465-5, https://doi.org/10.1038/s41591-021-01377-8 - params.get()[{mio::abm::ExposureType::NaturalInfection, AGE_GROUP_80_PLUS, + params.get()[{mio::abm::ExposureType::NaturalInfection, age_group_80_plus, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set({{0, 0.852}, @@ -835,7 +835,7 @@ void set_parameters(mio::abm::Parameters params) days); }; // Information is from: https://doi.org/10.1016/S0140-6736(21)02183-8 - params.get()[{mio::abm::ExposureType::GenericVaccine, AGE_GROUP_80_PLUS, + params.get()[{mio::abm::ExposureType::GenericVaccine, age_group_80_plus, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set( @@ -844,7 +844,7 @@ void set_parameters(mio::abm::Parameters params) // Set up personal severe protection levels. // Protection of severe infection of age group 65 + is different from other age group, based on: // https://doi.org/10.1016/S0140-6736(22)02465-5 - params.get()[{mio::abm::ExposureType::NaturalInfection, AGE_GROUP_0_TO_4, + params.get()[{mio::abm::ExposureType::NaturalInfection, age_group_0_to_4, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set({{0, 0.967}, @@ -864,7 +864,7 @@ void set_parameters(mio::abm::Parameters params) days); }; // Information is based on: https://doi.org/10.1016/S0140-6736(21)02183-8 - params.get()[{mio::abm::ExposureType::GenericVaccine, AGE_GROUP_80_PLUS, + params.get()[{mio::abm::ExposureType::GenericVaccine, age_group_80_plus, mio::abm::VirusVariant::Wildtype}] = [](ScalarType days) -> ScalarType { return mio::linear_interpolation_of_data_set( diff --git a/cpp/tests/abm_helpers.h b/cpp/tests/abm_helpers.h index b9ff281401..360b1b07fb 100644 --- a/cpp/tests/abm_helpers.h +++ b/cpp/tests/abm_helpers.h @@ -30,13 +30,13 @@ #include // Assign the name to general age group. -const size_t NUM_AGE_GROUPS = 6; -const auto AGE_GROUP_0_TO_4 = mio::AgeGroup(NUM_AGE_GROUPS - 6); -const auto AGE_GROUP_5_TO_14 = mio::AgeGroup(NUM_AGE_GROUPS - 5); -const auto AGE_GROUP_15_TO_34 = mio::AgeGroup(NUM_AGE_GROUPS - 4); -const auto AGE_GROUP_35_TO_59 = mio::AgeGroup(NUM_AGE_GROUPS - 3); -const auto AGE_GROUP_60_TO_79 = mio::AgeGroup(NUM_AGE_GROUPS - 2); -const auto AGE_GROUP_80_PLUS = mio::AgeGroup(NUM_AGE_GROUPS - 1); +const size_t num_age_groups = 6; +const auto age_group_0_to_4 = mio::AgeGroup(num_age_groups - 6); +const auto age_group_5_to_14 = mio::AgeGroup(num_age_groups - 5); +const auto age_group_15_to_34 = mio::AgeGroup(num_age_groups - 4); +const auto age_group_35_to_59 = mio::AgeGroup(num_age_groups - 3); +const auto age_group_60_to_79 = mio::AgeGroup(num_age_groups - 2); +const auto age_group_80_plus = mio::AgeGroup(num_age_groups - 1); /** * mock of the generator function of DistributionAdapter. @@ -97,16 +97,16 @@ struct ScopedMockDistribution { /** * @brief Create a Person without a World object. Intended for simple use in tests. */ -mio::abm::Person make_test_person(mio::abm::Location& location, mio::AgeGroup age = AGE_GROUP_15_TO_34, +mio::abm::Person make_test_person(mio::abm::Location& location, mio::AgeGroup age = age_group_15_to_34, mio::abm::InfectionState infection_state = mio::abm::InfectionState::Susceptible, mio::abm::TimePoint t = mio::abm::TimePoint(0), - mio::abm::Parameters params = mio::abm::Parameters(NUM_AGE_GROUPS)); + mio::abm::Parameters params = mio::abm::Parameters(num_age_group)); /** * @brief Add a Person to the World. Intended for simple use in tests. */ mio::abm::Person& add_test_person(mio::abm::World& world, mio::abm::LocationId loc_id, - mio::AgeGroup age = AGE_GROUP_15_TO_34, + mio::AgeGroup age = age_group_15_to_34, mio::abm::InfectionState infection_state = mio::abm::InfectionState::Susceptible, mio::abm::TimePoint t = mio::abm::TimePoint(0)); diff --git a/cpp/tests/test_abm_household.cpp b/cpp/tests/test_abm_household.cpp index 8478df6aae..7fc3a5a4a1 100644 --- a/cpp/tests/test_abm_household.cpp +++ b/cpp/tests/test_abm_household.cpp @@ -24,17 +24,17 @@ TEST(TestHouseholds, test_add_household_to_world) { - auto member1 = mio::abm::HouseholdMember(NUM_AGE_GROUPS); - member1.set_age_weight(AGE_GROUP_0_TO_4, 1); + auto member1 = mio::abm::HouseholdMember(num_age_groups); + member1.set_age_weight(age_group_0_to_4, 1); - auto member2 = mio::abm::HouseholdMember(NUM_AGE_GROUPS); - member2.set_age_weight(AGE_GROUP_5_TO_14, 1); + auto member2 = mio::abm::HouseholdMember(num_age_group); + member2.set_age_weight(age_group_5_to_14, 1); auto household = mio::abm::Household(); household.add_members(member1, 2); household.add_members(member2, 2); - auto world = mio::abm::World(NUM_AGE_GROUPS); + auto world = mio::abm::World(num_age_groups); add_household_to_world(world, household); auto persons = world.get_persons(); @@ -43,10 +43,10 @@ TEST(TestHouseholds, test_add_household_to_world) EXPECT_EQ(persons.size(), 4); // Test age - EXPECT_EQ(persons[0].get_age(), AGE_GROUP_0_TO_4); - EXPECT_EQ(persons[1].get_age(), AGE_GROUP_0_TO_4); - EXPECT_EQ(persons[2].get_age(), AGE_GROUP_5_TO_14); - EXPECT_EQ(persons[3].get_age(), AGE_GROUP_5_TO_14); + EXPECT_EQ(persons[0].get_age(), age_group_0_to_4); + EXPECT_EQ(persons[1].get_age(), age_group_0_to_4); + EXPECT_EQ(persons[2].get_age(), age_group_5_to_14); + EXPECT_EQ(persons[3].get_age(), age_group_5_to_14); // Test location EXPECT_EQ(persons[0].get_location().get_index(), persons[1].get_location().get_index()); @@ -56,11 +56,11 @@ TEST(TestHouseholds, test_add_household_to_world) TEST(TestHouseholds, test_add_household_group_to_world) { - auto member1 = mio::abm::HouseholdMember(NUM_AGE_GROUPS); - member1.set_age_weight(AGE_GROUP_35_TO_59, 1); + auto member1 = mio::abm::HouseholdMember(num_age_groups); + member1.set_age_weight(age_group_35_to_59, 1); - auto member2 = mio::abm::HouseholdMember(NUM_AGE_GROUPS); - member2.set_age_weight(AGE_GROUP_5_TO_14, 1); + auto member2 = mio::abm::HouseholdMember(num_age_groups); + member2.set_age_weight(age_group_5_to_14, 1); auto household_group = mio::abm::HouseholdGroup(); @@ -74,7 +74,7 @@ TEST(TestHouseholds, test_add_household_group_to_world) household2.add_members(member2, 2); household_group.add_households(household2, 10); - auto world = mio::abm::World(NUM_AGE_GROUPS); + auto world = mio::abm::World(num_age_groups); add_household_group_to_world(world, household_group); auto persons = world.get_persons(); @@ -86,10 +86,10 @@ TEST(TestHouseholds, test_add_household_group_to_world) int number_of_age5to14_year_olds = 0, number_of_age35to59_year_olds = 0; for (auto& person : persons) { - if (person.get_age() == AGE_GROUP_5_TO_14) { + if (person.get_age() == age_group_5_to_14) { number_of_age5to14_year_olds++; } - if (person.get_age() == AGE_GROUP_35_TO_59) { + if (person.get_age() == age_group_35_to_59) { number_of_age35to59_year_olds++; } } diff --git a/cpp/tests/test_abm_infection.cpp b/cpp/tests/test_abm_infection.cpp index 82ad0c67e8..bb6df0c064 100644 --- a/cpp/tests/test_abm_infection.cpp +++ b/cpp/tests/test_abm_infection.cpp @@ -26,9 +26,9 @@ TEST(TestInfection, init) { - auto params = mio::abm::Parameters(NUM_AGE_GROUPS); + auto params = mio::abm::Parameters(num_age_groups); auto virus_variant_test = mio::abm::VirusVariant::Wildtype; - auto age_group_test = AGE_GROUP_15_TO_34; + auto age_group_test = age_group_15_to_34; //set up a personal RNG for infections //uses uniformdistribution but result doesn't matter, so init before the mock @@ -65,7 +65,7 @@ TEST(TestInfection, init) .infectivity_beta.params.a())) .WillRepeatedly(testing::Return(1.0)); - auto infection = mio::abm::Infection(rng, mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34, params, + auto infection = mio::abm::Infection(rng, mio::abm::VirusVariant::Wildtype, age_group_15_to_34, params, mio::abm::TimePoint(0), mio::abm::InfectionState::Exposed, {}, true); EXPECT_EQ(infection.get_virus_variant(), mio::abm::VirusVariant::Wildtype); @@ -101,9 +101,9 @@ TEST(TestInfection, getInfectionState) { auto counter = mio::Counter(0); auto rng = mio::abm::Person::RandomNumberGenerator(mio::Key{0}, 0, counter); - auto params = mio::abm::Parameters(NUM_AGE_GROUPS); + auto params = mio::abm::Parameters(num_age_groups); auto t = mio::abm::TimePoint(0); - auto infection = mio::abm::Infection(rng, mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34, params, t, + auto infection = mio::abm::Infection(rng, mio::abm::VirusVariant::Wildtype, age_group_15_to_34, params, t, mio::abm::InfectionState::Exposed, {}, true); EXPECT_EQ(infection.get_infection_state(t), mio::abm::InfectionState::Exposed); EXPECT_EQ(infection.get_infection_state(t - mio::abm::TimeSpan(1)), mio::abm::InfectionState::Susceptible); @@ -116,13 +116,13 @@ TEST(TestInfection, drawInfectionCourseBackward) auto t = mio::abm::TimePoint(1); auto dt = mio::abm::days(1); - mio::abm::Parameters params = mio::abm::Parameters(NUM_AGE_GROUPS); + mio::abm::Parameters params = mio::abm::Parameters(num_age_groups); // Time to go from all infected states to recover is 1 day (dt). - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 1; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 1; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 1; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 1; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 1; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 1; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 1; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 1; ScopedMockDistribution>>> mock_uniform_dist; EXPECT_CALL(mock_uniform_dist.get_mock(), invoke) @@ -142,16 +142,16 @@ TEST(TestInfection, drawInfectionCourseBackward) .WillOnce(testing::Return(0.6)) // Transition to InfectedSevere .WillRepeatedly(testing::Return(0.9)); // Transition to InfectedCritical - auto infection1 = mio::abm::Infection(rng, mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79, params, + auto infection1 = mio::abm::Infection(rng, mio::abm::VirusVariant::Wildtype, age_group_60_to_79, params, mio::abm::TimePoint(t + dt), mio::abm::InfectionState::Recovered, {mio::abm::ExposureType::NoProtection, mio::abm::TimePoint(0)}, false); - auto infection2 = mio::abm::Infection(rng, mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79, params, + auto infection2 = mio::abm::Infection(rng, mio::abm::VirusVariant::Wildtype, age_group_60_to_79, params, mio::abm::TimePoint(t + dt), mio::abm::InfectionState::Recovered, {mio::abm::ExposureType::NoProtection, mio::abm::TimePoint(0)}, false); - auto infection3 = mio::abm::Infection(rng, mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79, params, + auto infection3 = mio::abm::Infection(rng, mio::abm::VirusVariant::Wildtype, age_group_60_to_79, params, mio::abm::TimePoint(t + dt), mio::abm::InfectionState::Recovered, {mio::abm::ExposureType::NoProtection, mio::abm::TimePoint(0)}, false); - auto infection4 = mio::abm::Infection(rng, mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79, params, + auto infection4 = mio::abm::Infection(rng, mio::abm::VirusVariant::Wildtype, age_group_60_to_79, params, mio::abm::TimePoint(t + dt), mio::abm::InfectionState::Recovered, {mio::abm::ExposureType::NoProtection, mio::abm::TimePoint(0)}, false); @@ -165,12 +165,12 @@ TEST(TestInfection, getPersonalProtectiveFactor) { auto rng = mio::RandomNumberGenerator(); - auto location = mio::abm::Location(mio::abm::LocationType::School, 0, NUM_AGE_GROUPS); - auto person = mio::abm::Person(rng, location, AGE_GROUP_15_TO_34); + auto location = mio::abm::Location(mio::abm::LocationType::School, 0, num_age_groups); + auto person = mio::abm::Person(rng, location, age_group_15_to_34); person.add_new_vaccination(mio::abm::ExposureType::GenericVaccine, mio::abm::TimePoint(0)); auto latest_protection = person.get_latest_protection(); - mio::abm::Parameters params = mio::abm::Parameters(NUM_AGE_GROUPS); + mio::abm::Parameters params = mio::abm::Parameters(num_age_groups); // Test default parameter functions auto defaut_infection_protection = params.get()[{ mio::abm::ExposureType::GenericVaccine, mio::AgeGroup(0), mio::abm::VirusVariant::Wildtype}](0); @@ -206,21 +206,21 @@ TEST(TestInfection, getPersonalProtectiveFactor) // Test Parameter InfectionProtectionFactor and get_protection_factor() t = mio::abm::TimePoint(0) + mio::abm::days(2); auto infection_protection_factor = params.get()[{ - latest_protection.first, AGE_GROUP_15_TO_34, mio::abm::VirusVariant::Wildtype}]( + latest_protection.first, age_group_15_to_34, mio::abm::VirusVariant::Wildtype}]( t.days() - latest_protection.second.days()); ASSERT_NEAR(infection_protection_factor, 0.91, 0.0001); ASSERT_NEAR(person.get_protection_factor(t, mio::abm::VirusVariant::Wildtype, params), 0.91, 0.0001); t = mio::abm::TimePoint(0) + mio::abm::days(15); infection_protection_factor = params.get()[{ - latest_protection.first, AGE_GROUP_15_TO_34, mio::abm::VirusVariant::Wildtype}]( + latest_protection.first, age_group_15_to_34, mio::abm::VirusVariant::Wildtype}]( t.days() - latest_protection.second.days()); ASSERT_NEAR(infection_protection_factor, 0.8635, 0.0001); ASSERT_NEAR(person.get_protection_factor(t, mio::abm::VirusVariant::Wildtype, params), 0.8635, 0.0001); t = mio::abm::TimePoint(0) + mio::abm::days(40); infection_protection_factor = params.get()[{ - latest_protection.first, AGE_GROUP_15_TO_34, mio::abm::VirusVariant::Wildtype}]( + latest_protection.first, age_group_15_to_34, mio::abm::VirusVariant::Wildtype}]( t.days() - latest_protection.second.days()); ASSERT_NEAR(infection_protection_factor, 0, 0.0001); ASSERT_NEAR(person.get_protection_factor(t, mio::abm::VirusVariant::Wildtype, params), 0, 0.0001); @@ -228,19 +228,19 @@ TEST(TestInfection, getPersonalProtectiveFactor) // Test Parameter SeverityProtectionFactor t = mio::abm::TimePoint(0) + mio::abm::days(2); auto severity_protection_factor = params.get()[{ - latest_protection.first, AGE_GROUP_15_TO_34, mio::abm::VirusVariant::Wildtype}]( + latest_protection.first, age_group_15_to_34, mio::abm::VirusVariant::Wildtype}]( t.days() - latest_protection.second.days()); ASSERT_NEAR(severity_protection_factor, 0.91, 0.0001); t = mio::abm::TimePoint(0) + mio::abm::days(15); severity_protection_factor = params.get()[{ - latest_protection.first, AGE_GROUP_15_TO_34, mio::abm::VirusVariant::Wildtype}]( + latest_protection.first, age_group_15_to_34, mio::abm::VirusVariant::Wildtype}]( t.days() - latest_protection.second.days()); ASSERT_NEAR(severity_protection_factor, 0.8635, 0.0001); t = mio::abm::TimePoint(0) + mio::abm::days(40); severity_protection_factor = params.get()[{ - latest_protection.first, AGE_GROUP_15_TO_34, mio::abm::VirusVariant::Wildtype}]( + latest_protection.first, age_group_15_to_34, mio::abm::VirusVariant::Wildtype}]( t.days() - latest_protection.second.days()); ASSERT_NEAR(severity_protection_factor, 0, 0.0001); diff --git a/cpp/tests/test_abm_location.cpp b/cpp/tests/test_abm_location.cpp index d596fa8ada..d564964da9 100644 --- a/cpp/tests/test_abm_location.cpp +++ b/cpp/tests/test_abm_location.cpp @@ -26,7 +26,7 @@ TEST(TestLocation, init) { - mio::abm::Location location(mio::abm::LocationType::School, 0, NUM_AGE_GROUPS); + mio::abm::Location location(mio::abm::LocationType::School, 0, num_age_groups); for (mio::abm::InfectionState i = mio::abm::InfectionState(0); i < mio::abm::InfectionState::Count; i = mio::abm::InfectionState(size_t(i) + 1)) { ASSERT_EQ(location.get_subpopulation(mio::abm::TimePoint(0), i), 0); @@ -36,13 +36,13 @@ TEST(TestLocation, init) TEST(TestLocation, copyLocation) { - auto location = mio::abm::Location(mio::abm::LocationType::School, 0, NUM_AGE_GROUPS); - auto person = make_test_person(location, AGE_GROUP_5_TO_14, mio::abm::InfectionState::InfectedSymptoms); + auto location = mio::abm::Location(mio::abm::LocationType::School, 0, num_age_groups); + auto person = make_test_person(location, age_group_5_to_14, mio::abm::InfectionState::InfectedSymptoms); EXPECT_EQ(location.get_number_persons(), 0); location.add_person(person); EXPECT_EQ(location.get_number_persons(), 1); - auto copied_location = location.copy_location_without_persons(NUM_AGE_GROUPS); + auto copied_location = location.copy_location_without_persons(num_age_groups); ASSERT_EQ(copied_location.get_type(), mio::abm::LocationType::School); ASSERT_EQ(copied_location.get_index(), location.get_index()); ASSERT_EQ(copied_location.get_cells().size(), location.get_cells().size()); @@ -57,7 +57,7 @@ TEST(TestLocation, initCell) TEST(TestLocation, getIndex) { - mio::abm::Location location(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); + mio::abm::Location location(mio::abm::LocationType::Home, 0, num_age_groups); ASSERT_EQ((int)location.get_index(), 0); } @@ -66,9 +66,9 @@ TEST(TestLocation, addRemovePerson) mio::abm::Location home(mio::abm::LocationType::Home, 0, 6, 1); mio::abm::Location location(mio::abm::LocationType::PublicTransport, 0, 6, 3); - auto person1 = make_test_person(home, AGE_GROUP_5_TO_14, mio::abm::InfectionState::InfectedSymptoms); - auto person2 = make_test_person(home, AGE_GROUP_5_TO_14, mio::abm::InfectionState::InfectedSymptoms); - auto person3 = make_test_person(home, AGE_GROUP_35_TO_59, mio::abm::InfectionState::Exposed); + auto person1 = make_test_person(home, age_group_5_to_14, mio::abm::InfectionState::InfectedSymptoms); + auto person2 = make_test_person(home, age_group_5_to_14, mio::abm::InfectionState::InfectedSymptoms); + auto person3 = make_test_person(home, age_group_35_to_59, mio::abm::InfectionState::Exposed); home.add_person(person1, {0}); home.add_person(person2, {0}); @@ -103,18 +103,18 @@ TEST(TestLocation, CacheExposureRate) auto rng = mio::RandomNumberGenerator(); mio::AgeGroup age = - mio::AgeGroup(mio::UniformIntDistribution::get_instance()(rng, 0, int(NUM_AGE_GROUPS - 1))); + mio::AgeGroup(mio::UniformIntDistribution::get_instance()(rng, 0, int(num_age_groups - 1))); mio::abm::VirusVariant variant = mio::abm::VirusVariant( mio::UniformIntDistribution::get_instance()(rng, 0, int(mio::abm::VirusVariant::Count) - 1)); auto t = mio::abm::TimePoint(0); auto dt = mio::abm::seconds(10000); - mio::abm::Parameters params = mio::abm::Parameters(NUM_AGE_GROUPS); + mio::abm::Parameters params = mio::abm::Parameters(num_age_groups); // setup a location with some chance of exposure - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS, 1); - mio::abm::Location location(mio::abm::LocationType::PublicTransport, 0, NUM_AGE_GROUPS, 3); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups, 1); + mio::abm::Location location(mio::abm::LocationType::PublicTransport, 0, num_age_groups, 3); auto infected1 = mio::abm::Person(rng, home, age); auto rng_infected1 = mio::abm::Person::RandomNumberGenerator(rng, infected1); infected1.add_new_infection( @@ -127,7 +127,7 @@ TEST(TestLocation, CacheExposureRate) infected2.migrate_to(location, {0, 1}); //cache precomputed results - location.cache_exposure_rates(t, dt, NUM_AGE_GROUPS); + location.cache_exposure_rates(t, dt, num_age_groups); EXPECT_NEAR((location.get_cells()[0].m_cached_exposure_rate_contacts[{variant, age}]), 0.015015859523894731, 1e-14); EXPECT_NEAR((location.get_cells()[0].m_cached_exposure_rate_air[{variant}]), 0.015015859523894731, 1e-14); @@ -142,7 +142,7 @@ TEST(TestLocation, CacheExposureRate) location.set_capacity(2, 22, 0); // Capacity for Cell 1 location.set_capacity(2, 22, 1); // Capacity for Cell 2 location.set_capacity(2, 22, 2); // Capacity for Cell 3 - location.cache_exposure_rates(t, dt, NUM_AGE_GROUPS); + location.cache_exposure_rates(t, dt, num_age_groups); EXPECT_NEAR((location.get_cells()[0].m_cached_exposure_rate_air[{variant}]), 0.045047578571684191, 1e-14); EXPECT_NEAR((location.get_cells()[1].m_cached_exposure_rate_air[{variant}]), 0.022523789285842095, 1e-14); @@ -155,14 +155,14 @@ TEST(TestLocation, reachCapacity) auto t = mio::abm::TimePoint{mio::abm::hours(8).seconds()}; auto dt = mio::abm::hours(1); - auto world = mio::abm::World(NUM_AGE_GROUPS); + auto world = mio::abm::World(num_age_groups); //setup so p1 doesn't do transition world.parameters - .get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = + .get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 2 * dt.days(); world.parameters - .get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = + .get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 2 * dt.days(); auto home_id = world.add_location(mio::abm::LocationType::Home); @@ -181,8 +181,8 @@ TEST(TestLocation, reachCapacity) .WillOnce(testing::Return(0.8)) // draw random school hour .WillRepeatedly(testing::Return(1.0)); - auto& p1 = add_test_person(world, home_id, AGE_GROUP_5_TO_14, mio::abm::InfectionState::InfectedNoSymptoms); - auto& p2 = add_test_person(world, home_id, AGE_GROUP_5_TO_14, mio::abm::InfectionState::Susceptible); + auto& p1 = add_test_person(world, home_id, age_group_5_to_14, mio::abm::InfectionState::InfectedNoSymptoms); + auto& p2 = add_test_person(world, home_id, age_group_5_to_14, mio::abm::InfectionState::Susceptible); auto& home = world.get_individualized_location(home_id); auto& school = world.get_individualized_location(school_id); @@ -229,37 +229,37 @@ TEST(TestLocation, interact) // Test should work identically work with any age. mio::AgeGroup age = - mio::AgeGroup(mio::UniformIntDistribution::get_instance()(rng, 0, int(NUM_AGE_GROUPS - 1))); + mio::AgeGroup(mio::UniformIntDistribution::get_instance()(rng, 0, int(num_age_groups - 1))); mio::abm::VirusVariant variant = mio::abm::VirusVariant( mio::UniformIntDistribution::get_instance()(rng, 0, int(mio::abm::VirusVariant::Count) - 1)); auto t = mio::abm::TimePoint(0); auto dt = mio::abm::seconds(8640); //0.1 days - mio::abm::Parameters params = mio::abm::Parameters(NUM_AGE_GROUPS); - params.set_default(NUM_AGE_GROUPS); + mio::abm::Parameters params = mio::abm::Parameters(num_age_groups); + params.set_default(num_age_groups); params.get()[{variant, age}] = {{1., 1.}, {0.0001, 0.0001}, {-0.0001, -0.0001}}; - params.set_default(NUM_AGE_GROUPS); + params.set_default(num_age_groups); params.get()[{variant, age}] = {{1., 1.}, {1., 1.}}; // set incubtion period to two days so that the newly infected person is still exposed params.get()[{variant, age}] = 2.; //setup location with some chance of exposure - mio::abm::Location location(mio::abm::LocationType::Work, 0, NUM_AGE_GROUPS); + mio::abm::Location location(mio::abm::LocationType::Work, 0, num_age_groups); auto infected1 = - make_test_person(location, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedNoSymptoms, t, params); + make_test_person(location, age_group_15_to_34, mio::abm::InfectionState::InfectedNoSymptoms, t, params); auto infected2 = - make_test_person(location, AGE_GROUP_80_PLUS, mio::abm::InfectionState::InfectedSymptoms, t, params); + make_test_person(location, age_group_80_plus, mio::abm::InfectionState::InfectedSymptoms, t, params); auto infected3 = - make_test_person(location, AGE_GROUP_5_TO_14, mio::abm::InfectionState::InfectedSymptoms, t, params); + make_test_person(location, age_group_5_to_14, mio::abm::InfectionState::InfectedSymptoms, t, params); location.add_person(infected1, {0}); location.add_person(infected2, {0}); location.add_person(infected3, {0}); //cache precomputed results - location.cache_exposure_rates(t, dt, NUM_AGE_GROUPS); + location.cache_exposure_rates(t, dt, num_age_groups); ScopedMockDistribution>>> mock_exponential_dist; @@ -279,7 +279,7 @@ TEST(TestLocation, interact) TEST(TestLocation, setCapacity) { - mio::abm::Location location(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); + mio::abm::Location location(mio::abm::LocationType::Home, 0, num_age_groups); location.set_capacity(4, 200); ASSERT_EQ(location.get_capacity().persons, (uint32_t)4); ASSERT_EQ(location.get_capacity().volume, (uint32_t)200); @@ -287,7 +287,7 @@ TEST(TestLocation, setCapacity) TEST(TestLocation, setRequiredMask) { - mio::abm::Location location(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); + mio::abm::Location location(mio::abm::LocationType::Home, 0, num_age_groups); ASSERT_EQ(location.get_required_mask(), mio::abm::MaskType::Community); location.set_required_mask(mio::abm::MaskType::FFP2); @@ -296,7 +296,7 @@ TEST(TestLocation, setRequiredMask) TEST(TestLocation, setNPIActive) { - mio::abm::Location location(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); + mio::abm::Location location(mio::abm::LocationType::Home, 0, num_age_groups); location.set_npi_active(false); ASSERT_FALSE(location.get_npi_active()); diff --git a/cpp/tests/test_abm_lockdown_rules.cpp b/cpp/tests/test_abm_lockdown_rules.cpp index 7f4019a8a7..3f39dadc00 100644 --- a/cpp/tests/test_abm_lockdown_rules.cpp +++ b/cpp/tests/test_abm_lockdown_rules.cpp @@ -28,8 +28,8 @@ TEST(TestLockdownRules, school_closure) auto dt = mio::abm::hours(1); auto t_morning = mio::abm::TimePoint(0) + mio::abm::hours(6); - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); - mio::abm::Location school(mio::abm::LocationType::School, 0, NUM_AGE_GROUPS); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups); + mio::abm::Location school(mio::abm::LocationType::School, 0, num_age_groups); //setup rng mock so one person is home schooled and the other goes to school ScopedMockDistribution>>> mock_uniform_dist; @@ -45,17 +45,17 @@ TEST(TestLockdownRules, school_closure) .WillOnce(testing::Return(0.2)) .WillRepeatedly(testing::Return(1.0)); - auto p1 = mio::abm::Person(rng, home, AGE_GROUP_5_TO_14); + auto p1 = mio::abm::Person(rng, home, age_group_5_to_14); p1.set_assigned_location(home); p1.set_assigned_location(school); - auto p2 = mio::abm::Person(rng, home, AGE_GROUP_5_TO_14); + auto p2 = mio::abm::Person(rng, home, age_group_5_to_14); p2.set_assigned_location(home); p2.set_assigned_location(school); - mio::abm::Parameters params = mio::abm::Parameters(NUM_AGE_GROUPS); + mio::abm::Parameters params = mio::abm::Parameters(num_age_groups); // Set the age group the can go to school is AgeGroup(1) (i.e. 5-14) - params.get() = {AGE_GROUP_5_TO_14}; + params.get() = {age_group_5_to_14}; // Set the age group the can go to work is AgeGroup(2) and AgeGroup(3) (i.e. 15-34 or 35-59) - params.get() = {AGE_GROUP_15_TO_34, AGE_GROUP_35_TO_59}; + params.get() = {age_group_15_to_34, age_group_35_to_59}; mio::abm::set_school_closure(t, 0.7, params); auto p1_rng = mio::abm::Person::RandomNumberGenerator(rng, p1); @@ -72,8 +72,8 @@ TEST(TestLockdownRules, school_opening) auto dt = mio::abm::hours(1); auto t_morning = mio::abm::TimePoint(0) + mio::abm::days(1) + mio::abm::hours(7); - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); - mio::abm::Location school(mio::abm::LocationType::School, 0, NUM_AGE_GROUPS); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups); + mio::abm::Location school(mio::abm::LocationType::School, 0, num_age_groups); //setup rng mock so the person is homeschooled in case of lockdown ScopedMockDistribution>>> mock_uniform_dist; EXPECT_CALL(mock_uniform_dist.get_mock(), invoke) @@ -83,14 +83,14 @@ TEST(TestLockdownRules, school_opening) .WillOnce(testing::Return(0.6)) .WillOnce(testing::Return(0.6)) .WillRepeatedly(testing::Return(1.0)); - auto p = mio::abm::Person(rng, home, AGE_GROUP_5_TO_14); + auto p = mio::abm::Person(rng, home, age_group_5_to_14); p.set_assigned_location(home); p.set_assigned_location(school); - mio::abm::Parameters params = mio::abm::Parameters(NUM_AGE_GROUPS); + mio::abm::Parameters params = mio::abm::Parameters(num_age_groups); // Set the age group the can go to school is AgeGroup(1) (i.e. 5-14) - params.get() = {AGE_GROUP_5_TO_14}; + params.get() = {age_group_5_to_14}; // Set the age group the can go to work is AgeGroup(2) and AgeGroup(3) (i.e. 15-34 or 35-59) - params.get() = {AGE_GROUP_15_TO_34, AGE_GROUP_35_TO_59}; + params.get() = {age_group_15_to_34, age_group_35_to_59}; mio::abm::set_school_closure(t_closing, 1., params); mio::abm::set_school_closure(t_opening, 0., params); @@ -107,12 +107,12 @@ TEST(TestLockdownRules, home_office) mio::abm::Location home(mio::abm::LocationType::Home, 0); mio::abm::Location work(mio::abm::LocationType::Work, 0); - mio::abm::Parameters params(NUM_AGE_GROUPS); + mio::abm::Parameters params(num_age_groups); // Set the age group the can go to school is AgeGroup(1) (i.e. 5-14) - params.get() = {AGE_GROUP_5_TO_14}; + params.get() = {age_group_5_to_14}; // Set the age group the can go to work is AgeGroup(2) and AgeGroup(3) (i.e. 15-34 or 35-59) - params.get() = {AGE_GROUP_15_TO_34, AGE_GROUP_35_TO_59}; + params.get() = {age_group_15_to_34, age_group_35_to_59}; mio::abm::set_home_office(t, 0.4, params); @@ -126,8 +126,8 @@ TEST(TestLockdownRules, home_office) .WillOnce(testing::Return(0.7)) .WillRepeatedly(testing::Return(1.0)); - auto person1 = mio::abm::Person(rng, home, AGE_GROUP_15_TO_34); - auto person2 = mio::abm::Person(rng, home, AGE_GROUP_15_TO_34); + auto person1 = mio::abm::Person(rng, home, age_group_15_to_34); + auto person2 = mio::abm::Person(rng, home, age_group_15_to_34); person1.set_assigned_location(home); person1.set_assigned_location(work); person2.set_assigned_location(home); @@ -147,8 +147,8 @@ TEST(TestLockdownRules, no_home_office) auto dt = mio::abm::hours(1); auto t_morning = mio::abm::TimePoint(0) + mio::abm::days(1) + mio::abm::hours(8); - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); - mio::abm::Location work(mio::abm::LocationType::Work, 0, NUM_AGE_GROUPS); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups); + mio::abm::Location work(mio::abm::LocationType::Work, 0, num_age_groups); //setup rng mock so the person works in home office ScopedMockDistribution>>> mock_uniform_dist; @@ -159,14 +159,14 @@ TEST(TestLockdownRules, no_home_office) .WillOnce(testing::Return(0.7)) .WillRepeatedly(testing::Return(1.0)); - auto p = mio::abm::Person(rng, home, AGE_GROUP_15_TO_34); + auto p = mio::abm::Person(rng, home, age_group_15_to_34); p.set_assigned_location(home); p.set_assigned_location(work); - mio::abm::Parameters params = mio::abm::Parameters(NUM_AGE_GROUPS); + mio::abm::Parameters params = mio::abm::Parameters(num_age_groups); // Set the age group the can go to school is AgeGroup(1) (i.e. 5-14) - params.get() = {AGE_GROUP_5_TO_14}; + params.get() = {age_group_5_to_14}; // Set the age group the can go to work is AgeGroup(2) and AgeGroup(3) (i.e. 15-34 or 35-59) - params.get() = {AGE_GROUP_15_TO_34, AGE_GROUP_35_TO_59}; + params.get() = {age_group_15_to_34, age_group_35_to_59}; mio::abm::set_home_office(t_closing, 0.5, params); mio::abm::set_home_office(t_opening, 0., params); @@ -182,12 +182,12 @@ TEST(TestLockdownRules, social_event_closure) auto dt = mio::abm::hours(1); auto t_evening = mio::abm::TimePoint(0) + mio::abm::hours(19); - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); - mio::abm::Location event(mio::abm::LocationType::SocialEvent, 0, NUM_AGE_GROUPS); - auto p = mio::abm::Person(rng, home, AGE_GROUP_5_TO_14); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups); + mio::abm::Location event(mio::abm::LocationType::SocialEvent, 0, num_age_groups); + auto p = mio::abm::Person(rng, home, age_group_5_to_14); p.set_assigned_location(home); p.set_assigned_location(event); - mio::abm::Parameters params = mio::abm::Parameters(NUM_AGE_GROUPS); + mio::abm::Parameters params = mio::abm::Parameters(num_age_groups); mio::abm::close_social_events(t, 1, params); @@ -203,12 +203,12 @@ TEST(TestLockdownRules, social_events_opening) auto dt = mio::abm::hours(1); auto t_evening = mio::abm::TimePoint(0) + mio::abm::days(1) + mio::abm::hours(19); - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); - mio::abm::Location event(mio::abm::LocationType::SocialEvent, 0, NUM_AGE_GROUPS); - auto p = mio::abm::Person(rng, home, AGE_GROUP_5_TO_14); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups); + mio::abm::Location event(mio::abm::LocationType::SocialEvent, 0, num_age_groups); + auto p = mio::abm::Person(rng, home, age_group_5_to_14); p.set_assigned_location(event); p.set_assigned_location(home); - mio::abm::Parameters params = mio::abm::Parameters(NUM_AGE_GROUPS); + mio::abm::Parameters params = mio::abm::Parameters(num_age_groups); mio::abm::close_social_events(t_closing, 1, params); mio::abm::close_social_events(t_opening, 0, params); diff --git a/cpp/tests/test_abm_masks.cpp b/cpp/tests/test_abm_masks.cpp index ab337bb7ac..dd0fa484af 100644 --- a/cpp/tests/test_abm_masks.cpp +++ b/cpp/tests/test_abm_masks.cpp @@ -57,24 +57,24 @@ TEST(TestMasks, changeMask) TEST(TestMasks, maskProtection) { auto rng = mio::RandomNumberGenerator(); - mio::abm::Parameters params(NUM_AGE_GROUPS); + mio::abm::Parameters params(num_age_groups); // set incubation period to two days so that the newly infected person is still exposed - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_5_TO_14}] = 2.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_5_to_14}] = 2.; //setup location with some chance of exposure auto t = mio::abm::TimePoint(0); - mio::abm::Location infection_location(mio::abm::LocationType::School, 0, NUM_AGE_GROUPS); - auto susc_person1 = mio::abm::Person(rng, infection_location, AGE_GROUP_15_TO_34); - auto susc_person2 = mio::abm::Person(rng, infection_location, AGE_GROUP_15_TO_34); - auto infected1 = make_test_person(infection_location, AGE_GROUP_15_TO_34, + mio::abm::Location infection_location(mio::abm::LocationType::School, 0, num_age_groups); + auto susc_person1 = mio::abm::Person(rng, infection_location, age_group_15_to_34); + auto susc_person2 = mio::abm::Person(rng, infection_location, age_group_15_to_34); + auto infected1 = make_test_person(infection_location, age_group_15_to_34, mio::abm::InfectionState::InfectedSymptoms, t, params); // infected 7 days prior infection_location.add_person(infected1); //cache precomputed results auto dt = mio::abm::days(1); - infection_location.cache_exposure_rates(t, dt, NUM_AGE_GROUPS); + infection_location.cache_exposure_rates(t, dt, num_age_groups); // susc_person1 wears a mask, default protection is 1 susc_person1.set_wear_mask(true); // susc_person2 does not wear a mask diff --git a/cpp/tests/test_abm_migration_rules.cpp b/cpp/tests/test_abm_migration_rules.cpp index 8cc9e324d8..5d3a50d38e 100644 --- a/cpp/tests/test_abm_migration_rules.cpp +++ b/cpp/tests/test_abm_migration_rules.cpp @@ -33,20 +33,20 @@ TEST(TestMigrationRules, student_goes_to_school) .WillOnce(testing::Return(0.6)) .WillRepeatedly(testing::Return(1.0)); - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); - auto p_child = mio::abm::Person(rng, home, AGE_GROUP_5_TO_14); - auto p_adult = mio::abm::Person(rng, home, AGE_GROUP_15_TO_34); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups); + auto p_child = mio::abm::Person(rng, home, age_group_5_to_14); + auto p_adult = mio::abm::Person(rng, home, age_group_15_to_34); auto t_morning = mio::abm::TimePoint(0) + mio::abm::hours(7); auto t_weekend = mio::abm::TimePoint(0) + mio::abm::days(5) + mio::abm::hours(7); auto dt = mio::abm::hours(1); - mio::abm::Parameters params = mio::abm::Parameters(NUM_AGE_GROUPS); + mio::abm::Parameters params = mio::abm::Parameters(num_age_groups); auto child_rng = mio::abm::Person::RandomNumberGenerator(rng, p_child); auto adult_rng = mio::abm::Person::RandomNumberGenerator(rng, p_child); // Set the age group the can go to school is AgeGroup(1) (i.e. 5-14) - params.get() = {AGE_GROUP_5_TO_14}; + params.get() = {age_group_5_to_14}; // Set the age group the can go to work is AgeGroup(2) and AgeGroup(3) (i.e. 15-34 or 35-59) - params.get() = {AGE_GROUP_15_TO_34, AGE_GROUP_35_TO_59}; + params.get() = {age_group_15_to_34, age_group_35_to_59}; ASSERT_EQ(mio::abm::go_to_school(child_rng, p_child, t_morning, dt, params), mio::abm::LocationType::School); ASSERT_EQ(mio::abm::go_to_school(adult_rng, p_adult, t_morning, dt, params), mio::abm::LocationType::Home); @@ -73,21 +73,21 @@ TEST(TestMigrationRules, students_go_to_school_in_different_times) .WillOnce(testing::Return(0.8)) .WillRepeatedly(testing::Return(1.0)); - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); - auto p_child_goes_to_school_at_6 = mio::abm::Person(rng, home, AGE_GROUP_5_TO_14); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups); + auto p_child_goes_to_school_at_6 = mio::abm::Person(rng, home, age_group_5_to_14); auto rng_child_goes_to_school_at_6 = mio::abm::Person::RandomNumberGenerator(rng, p_child_goes_to_school_at_6); - auto p_child_goes_to_school_at_8 = mio::abm::Person(rng, home, AGE_GROUP_5_TO_14); + auto p_child_goes_to_school_at_8 = mio::abm::Person(rng, home, age_group_5_to_14); auto rng_child_goes_to_school_at_8 = mio::abm::Person::RandomNumberGenerator(rng, p_child_goes_to_school_at_8); auto t_morning_6 = mio::abm::TimePoint(0) + mio::abm::hours(6); auto t_morning_8 = mio::abm::TimePoint(0) + mio::abm::hours(8); auto dt = mio::abm::hours(1); - mio::abm::Parameters params = mio::abm::Parameters(NUM_AGE_GROUPS); + mio::abm::Parameters params = mio::abm::Parameters(num_age_groups); // Set the age group the can go to school is AgeGroup(1) (i.e. 5-14) - params.get() = {AGE_GROUP_5_TO_14}; + params.get() = {age_group_5_to_14}; // Set the age group the can go to work is AgeGroup(2) and AgeGroup(3) (i.e. 15-34 or 35-59) - params.get() = {AGE_GROUP_15_TO_34, AGE_GROUP_35_TO_59}; + params.get() = {age_group_15_to_34, age_group_35_to_59}; ASSERT_EQ( mio::abm::go_to_school(rng_child_goes_to_school_at_6, p_child_goes_to_school_at_6, t_morning_6, dt, params), @@ -130,21 +130,21 @@ TEST(TestMigrationRules, students_go_to_school_in_different_times_with_smaller_t .WillOnce(testing::Return(0.9)) .WillRepeatedly(testing::Return(1.0)); - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); - auto p_child_goes_to_school_at_6 = mio::abm::Person(rng, home, AGE_GROUP_5_TO_14); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups); + auto p_child_goes_to_school_at_6 = mio::abm::Person(rng, home, age_group_5_to_14); auto rng_child_goes_to_school_at_6 = mio::abm::Person::RandomNumberGenerator(rng, p_child_goes_to_school_at_6); - auto p_child_goes_to_school_at_8_30 = mio::abm::Person(rng, home, AGE_GROUP_5_TO_14); + auto p_child_goes_to_school_at_8_30 = mio::abm::Person(rng, home, age_group_5_to_14); auto rng_child_goes_to_school_at_8_30 = mio::abm::Person::RandomNumberGenerator(rng, p_child_goes_to_school_at_8_30); auto t_morning_6 = mio::abm::TimePoint(0) + mio::abm::hours(6); auto t_morning_8_30 = mio::abm::TimePoint(0) + mio::abm::hours(8) + mio::abm::seconds(1800); auto dt = mio::abm::seconds(1800); - mio::abm::Parameters params = mio::abm::Parameters(NUM_AGE_GROUPS); + mio::abm::Parameters params = mio::abm::Parameters(num_age_groups); // Set the age group the can go to school is AgeGroup(1) (i.e. 5-14) - params.get() = {AGE_GROUP_5_TO_14}; + params.get() = {age_group_5_to_14}; // Set the age group the can go to work is AgeGroup(2) and AgeGroup(3) (i.e. 15-34 or 35-59) - params.get() = {AGE_GROUP_15_TO_34, AGE_GROUP_35_TO_59}; + params.get() = {age_group_15_to_34, age_group_35_to_59}; ASSERT_EQ( mio::abm::go_to_school(rng_child_goes_to_school_at_6, p_child_goes_to_school_at_6, t_morning_6, dt, params), @@ -164,21 +164,21 @@ TEST(TestMigrationRules, students_go_to_school_in_different_times_with_smaller_t TEST(TestMigrationRules, school_return) { auto rng = mio::RandomNumberGenerator(); - mio::abm::Location school(mio::abm::LocationType::School, 0, NUM_AGE_GROUPS); - auto p_child = mio::abm::Person(rng, school, AGE_GROUP_5_TO_14); + mio::abm::Location school(mio::abm::LocationType::School, 0, num_age_groups); + auto p_child = mio::abm::Person(rng, school, age_group_5_to_14); auto rng_child = mio::abm::Person::RandomNumberGenerator(rng, p_child); auto t = mio::abm::TimePoint(0) + mio::abm::hours(15); auto dt = mio::abm::hours(1); - ASSERT_EQ(mio::abm::go_to_school(rng_child, p_child, t, dt, mio::abm::Parameters(NUM_AGE_GROUPS)), + ASSERT_EQ(mio::abm::go_to_school(rng_child, p_child, t, dt, mio::abm::Parameters(num_age_groups)), mio::abm::LocationType::Home); } TEST(TestMigrationRules, worker_goes_to_work) { auto rng = mio::RandomNumberGenerator(); - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups); ScopedMockDistribution>>> mock_uniform_dist; EXPECT_CALL(mock_uniform_dist.get_mock(), invoke) .Times(testing::AtLeast(8)) @@ -192,20 +192,20 @@ TEST(TestMigrationRules, worker_goes_to_work) .WillOnce(testing::Return(0.)) .WillRepeatedly(testing::Return(1.0)); - auto p_retiree = mio::abm::Person(rng, home, AGE_GROUP_60_TO_79); + auto p_retiree = mio::abm::Person(rng, home, age_group_60_to_79); auto rng_retiree = mio::abm::Person::RandomNumberGenerator(rng, p_retiree); - auto p_adult = mio::abm::Person(rng, home, AGE_GROUP_15_TO_34); + auto p_adult = mio::abm::Person(rng, home, age_group_15_to_34); auto rng_adult = mio::abm::Person::RandomNumberGenerator(rng, p_adult); auto t_morning = mio::abm::TimePoint(0) + mio::abm::hours(8); auto t_night = mio::abm::TimePoint(0) + mio::abm::days(1) + mio::abm::hours(4); auto dt = mio::abm::hours(1); - mio::abm::Parameters params = mio::abm::Parameters(NUM_AGE_GROUPS); + mio::abm::Parameters params = mio::abm::Parameters(num_age_groups); // Set the age group the can go to school is AgeGroup(1) (i.e. 5-14) - params.get() = {AGE_GROUP_5_TO_14}; + params.get() = {age_group_5_to_14}; // Set the age group the can go to work is AgeGroup(2) and AgeGroup(3) (i.e. 15-34 or 35-59) - params.get() = {AGE_GROUP_15_TO_34, AGE_GROUP_35_TO_59}; + params.get() = {age_group_15_to_34, age_group_35_to_59}; ASSERT_EQ(mio::abm::go_to_work(rng_retiree, p_retiree, t_morning, dt, params), mio::abm::LocationType::Home); ASSERT_EQ(mio::abm::go_to_work(rng_adult, p_adult, t_morning, dt, params), mio::abm::LocationType::Home); @@ -215,7 +215,7 @@ TEST(TestMigrationRules, worker_goes_to_work) TEST(TestMigrationRules, worker_goes_to_work_with_non_dividable_timespan) { auto rng = mio::RandomNumberGenerator(); - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups); ScopedMockDistribution>>> mock_uniform_dist; EXPECT_CALL(mock_uniform_dist.get_mock(), invoke) .Times(testing::AtLeast(8)) @@ -229,20 +229,20 @@ TEST(TestMigrationRules, worker_goes_to_work_with_non_dividable_timespan) .WillOnce(testing::Return(0.)) .WillRepeatedly(testing::Return(1.0)); - auto p_retiree = mio::abm::Person(rng, home, AGE_GROUP_60_TO_79); + auto p_retiree = mio::abm::Person(rng, home, age_group_60_to_79); auto rng_retiree = mio::abm::Person::RandomNumberGenerator(rng, p_retiree); - auto p_adult = mio::abm::Person(rng, home, AGE_GROUP_15_TO_34); + auto p_adult = mio::abm::Person(rng, home, age_group_15_to_34); auto rng_adult = mio::abm::Person::RandomNumberGenerator(rng, p_adult); auto t_morning = mio::abm::TimePoint(0) + mio::abm::hours(8); auto t_night = mio::abm::TimePoint(0) + mio::abm::days(1) + mio::abm::hours(4); auto dt = mio::abm::minutes(53); - mio::abm::Parameters params = mio::abm::Parameters(NUM_AGE_GROUPS); + mio::abm::Parameters params = mio::abm::Parameters(num_age_groups); // Set the age group the can go to school is AgeGroup(1) (i.e. 5-14) - params.get() = {AGE_GROUP_5_TO_14}; + params.get() = {age_group_5_to_14}; // Set the age group the can go to work is AgeGroup(2) and AgeGroup(3) (i.e. 15-34 or 35-59) - params.get() = {AGE_GROUP_15_TO_34, AGE_GROUP_35_TO_59}; + params.get() = {age_group_15_to_34, age_group_35_to_59}; ASSERT_EQ(mio::abm::go_to_work(rng_retiree, p_retiree, t_morning, dt, params), mio::abm::LocationType::Home); ASSERT_EQ(mio::abm::go_to_work(rng_adult, p_adult, t_morning, dt, params), mio::abm::LocationType::Home); @@ -252,7 +252,7 @@ TEST(TestMigrationRules, worker_goes_to_work_with_non_dividable_timespan) TEST(TestMigrationRules, workers_go_to_work_in_different_times) { auto rng = mio::RandomNumberGenerator(); - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups); ScopedMockDistribution>>> mock_uniform_dist; EXPECT_CALL(mock_uniform_dist.get_mock(), invoke) .Times(testing::AtLeast(8)) @@ -267,20 +267,20 @@ TEST(TestMigrationRules, workers_go_to_work_in_different_times) .WillRepeatedly(testing::Return(1.0)); - auto p_adult_goes_to_work_at_6 = mio::abm::Person(rng, home, AGE_GROUP_15_TO_34); + auto p_adult_goes_to_work_at_6 = mio::abm::Person(rng, home, age_group_15_to_34); auto rng_adult_goes_to_work_at_6 = mio::abm::Person::RandomNumberGenerator(rng, p_adult_goes_to_work_at_6); - auto p_adult_goes_to_work_at_8 = mio::abm::Person(rng, home, AGE_GROUP_15_TO_34); + auto p_adult_goes_to_work_at_8 = mio::abm::Person(rng, home, age_group_15_to_34); auto rng_adult_goes_to_work_at_8 = mio::abm::Person::RandomNumberGenerator(rng, p_adult_goes_to_work_at_8); auto t_morning_6 = mio::abm::TimePoint(0) + mio::abm::hours(6); auto t_morning_8 = mio::abm::TimePoint(0) + mio::abm::hours(8); auto t_night = mio::abm::TimePoint(0) + mio::abm::days(1) + mio::abm::hours(4); auto dt = mio::abm::hours(1); - mio::abm::Parameters params = mio::abm::Parameters(NUM_AGE_GROUPS); + mio::abm::Parameters params = mio::abm::Parameters(num_age_groups); // Set the age group the can go to school is AgeGroup(1) (i.e. 5-14) - params.get() = {AGE_GROUP_5_TO_14}; + params.get() = {age_group_5_to_14}; // Set the age group the can go to work is AgeGroup(2) and AgeGroup(3) (i.e. 15-34 or 35-59) - params.get() = {AGE_GROUP_15_TO_34, AGE_GROUP_35_TO_59}; + params.get() = {age_group_15_to_34, age_group_35_to_59}; ASSERT_EQ(mio::abm::go_to_work(rng_adult_goes_to_work_at_6, p_adult_goes_to_work_at_6, t_morning_6, dt, params), mio::abm::LocationType::Work); @@ -299,12 +299,12 @@ TEST(TestMigrationRules, workers_go_to_work_in_different_times) TEST(TestMigrationRules, work_return) { auto rng = mio::RandomNumberGenerator(); - mio::abm::Location work(mio::abm::LocationType::Work, 0, NUM_AGE_GROUPS); - auto p_adult = mio::abm::Person(rng, work, AGE_GROUP_35_TO_59); + mio::abm::Location work(mio::abm::LocationType::Work, 0, num_age_groups); + auto p_adult = mio::abm::Person(rng, work, age_group_35_to_59); auto rng_adult = mio::abm::Person::RandomNumberGenerator(rng, p_adult); auto t = mio::abm::TimePoint(0) + mio::abm::hours(17); auto dt = mio::abm::hours(1); - ASSERT_EQ(mio::abm::go_to_work(rng_adult, p_adult, t, dt, mio::abm::Parameters(NUM_AGE_GROUPS)), + ASSERT_EQ(mio::abm::go_to_work(rng_adult, p_adult, t, dt, mio::abm::Parameters(num_age_groups)), mio::abm::LocationType::Home); } @@ -314,103 +314,103 @@ TEST(TestMigrationRules, quarantine) auto t = mio::abm::TimePoint(12346); auto dt = mio::abm::hours(1); - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); - mio::abm::Location work(mio::abm::LocationType::Work, 0, NUM_AGE_GROUPS); - mio::abm::Location hospital(mio::abm::LocationType::Hospital, 0, NUM_AGE_GROUPS); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups); + mio::abm::Location work(mio::abm::LocationType::Work, 0, num_age_groups); + mio::abm::Location hospital(mio::abm::LocationType::Hospital, 0, num_age_groups); - auto p_inf1 = make_test_person(work, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedSymptoms, t); + auto p_inf1 = make_test_person(work, age_group_15_to_34, mio::abm::InfectionState::InfectedSymptoms, t); auto rng_inf1 = mio::abm::Person::RandomNumberGenerator(rng, p_inf1); p_inf1.detect_infection(t); - ASSERT_EQ(mio::abm::go_to_quarantine(rng_inf1, p_inf1, t, dt, mio::abm::Parameters(NUM_AGE_GROUPS)), + ASSERT_EQ(mio::abm::go_to_quarantine(rng_inf1, p_inf1, t, dt, mio::abm::Parameters(num_age_groups)), mio::abm::LocationType::Home); //detected infected person quarantines at home - auto p_inf2 = make_test_person(work, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedSymptoms, t); + auto p_inf2 = make_test_person(work, age_group_15_to_34, mio::abm::InfectionState::InfectedSymptoms, t); auto rng_inf2 = mio::abm::Person::RandomNumberGenerator(rng, p_inf2); - ASSERT_EQ(mio::abm::go_to_quarantine(rng_inf2, p_inf2, t, dt, mio::abm::Parameters(NUM_AGE_GROUPS)), + ASSERT_EQ(mio::abm::go_to_quarantine(rng_inf2, p_inf2, t, dt, mio::abm::Parameters(num_age_groups)), mio::abm::LocationType::Work); //undetected infected person does not quaratine - auto p_inf3 = make_test_person(hospital, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedSevere, t); + auto p_inf3 = make_test_person(hospital, age_group_15_to_34, mio::abm::InfectionState::InfectedSevere, t); auto rng_inf3 = mio::abm::Person::RandomNumberGenerator(rng, p_inf3); p_inf3.detect_infection(t); - ASSERT_EQ(mio::abm::go_to_quarantine(rng_inf3, p_inf3, t, dt, mio::abm::Parameters(NUM_AGE_GROUPS)), + ASSERT_EQ(mio::abm::go_to_quarantine(rng_inf3, p_inf3, t, dt, mio::abm::Parameters(num_age_groups)), mio::abm::LocationType::Hospital); //detected infected person does not leave hospital to quarantine } TEST(TestMigrationRules, hospital) { auto rng = mio::RandomNumberGenerator(); - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups); auto t = mio::abm::TimePoint(12346); auto dt = mio::abm::hours(1); - auto p_inf = make_test_person(home, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedSevere, t); + auto p_inf = make_test_person(home, age_group_15_to_34, mio::abm::InfectionState::InfectedSevere, t); auto rng_inf = mio::abm::Person::RandomNumberGenerator(rng, p_inf); - ASSERT_EQ(mio::abm::go_to_hospital(rng_inf, p_inf, t, dt, mio::abm::Parameters(NUM_AGE_GROUPS)), + ASSERT_EQ(mio::abm::go_to_hospital(rng_inf, p_inf, t, dt, mio::abm::Parameters(num_age_groups)), mio::abm::LocationType::Hospital); - auto p_car = make_test_person(home, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedSymptoms); + auto p_car = make_test_person(home, age_group_15_to_34, mio::abm::InfectionState::InfectedSymptoms); auto rng_car = mio::abm::Person::RandomNumberGenerator(rng, p_car); - ASSERT_EQ(mio::abm::go_to_hospital(rng_car, p_car, t, dt, mio::abm::Parameters(NUM_AGE_GROUPS)), + ASSERT_EQ(mio::abm::go_to_hospital(rng_car, p_car, t, dt, mio::abm::Parameters(num_age_groups)), mio::abm::LocationType::Home); } TEST(TestMigrationRules, go_shopping) { auto rng = mio::RandomNumberGenerator(); - mio::abm::Location hospital(mio::abm::LocationType::Hospital, 0, NUM_AGE_GROUPS); - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); + mio::abm::Location hospital(mio::abm::LocationType::Hospital, 0, num_age_groups); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups); auto t_weekday = mio::abm::TimePoint(0) + mio::abm::days(4) + mio::abm::hours(9); auto t_sunday = mio::abm::TimePoint(0) + mio::abm::days(6) + mio::abm::hours(9); auto t_night = mio::abm::TimePoint(0) + mio::abm::days(4) + mio::abm::hours(1); auto dt = mio::abm::hours(1); - auto p_hosp = make_test_person(hospital, AGE_GROUP_0_TO_4, mio::abm::InfectionState::InfectedSymptoms, t_weekday); + auto p_hosp = make_test_person(hospital, age_group_0_to_4, mio::abm::InfectionState::InfectedSymptoms, t_weekday); auto rng_hosp = mio::abm::Person::RandomNumberGenerator(rng, p_hosp); - auto p_home = mio::abm::Person(rng, home, AGE_GROUP_60_TO_79); + auto p_home = mio::abm::Person(rng, home, age_group_60_to_79); auto rng_home = mio::abm::Person::RandomNumberGenerator(rng, p_home); - ASSERT_EQ(mio::abm::go_to_shop(rng_hosp, p_hosp, t_weekday, dt, mio::abm::Parameters(NUM_AGE_GROUPS)), + ASSERT_EQ(mio::abm::go_to_shop(rng_hosp, p_hosp, t_weekday, dt, mio::abm::Parameters(num_age_groups)), mio::abm::LocationType::Hospital); - ASSERT_EQ(mio::abm::go_to_shop(rng_home, p_home, t_sunday, dt, mio::abm::Parameters(NUM_AGE_GROUPS)), + ASSERT_EQ(mio::abm::go_to_shop(rng_home, p_home, t_sunday, dt, mio::abm::Parameters(num_age_groups)), mio::abm::LocationType::Home); - ASSERT_EQ(mio::abm::go_to_shop(rng_home, p_home, t_night, dt, mio::abm::Parameters(NUM_AGE_GROUPS)), + ASSERT_EQ(mio::abm::go_to_shop(rng_home, p_home, t_night, dt, mio::abm::Parameters(num_age_groups)), mio::abm::LocationType::Home); ScopedMockDistribution>>> mock_exponential_dist; EXPECT_CALL(mock_exponential_dist.get_mock(), invoke).Times(1).WillOnce(testing::Return(0.01)); - ASSERT_EQ(mio::abm::go_to_shop(rng_home, p_home, t_weekday, dt, mio::abm::Parameters(NUM_AGE_GROUPS)), + ASSERT_EQ(mio::abm::go_to_shop(rng_home, p_home, t_weekday, dt, mio::abm::Parameters(num_age_groups)), mio::abm::LocationType::BasicsShop); } TEST(TestMigrationRules, shop_return) { auto rng = mio::RandomNumberGenerator(); - auto params = mio::abm::Parameters(NUM_AGE_GROUPS); + auto params = mio::abm::Parameters(num_age_groups); auto t = mio::abm::TimePoint(0) + mio::abm::days(4) + mio::abm::hours(9); auto dt = mio::abm::hours(1); - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); - mio::abm::Location shop(mio::abm::LocationType::BasicsShop, 0, NUM_AGE_GROUPS); - auto p = make_test_person(home, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedNoSymptoms, t); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups); + mio::abm::Location shop(mio::abm::LocationType::BasicsShop, 0, num_age_groups); + auto p = make_test_person(home, age_group_15_to_34, mio::abm::InfectionState::InfectedNoSymptoms, t); auto rng_p = mio::abm::Person::RandomNumberGenerator(rng, p); home.add_person(p); p.migrate_to(shop); p.interact(rng_p, t, dt, params); //person only returns home after some time passed - ASSERT_EQ(mio::abm::go_to_shop(rng_p, p, t, dt, mio::abm::Parameters(NUM_AGE_GROUPS)), + ASSERT_EQ(mio::abm::go_to_shop(rng_p, p, t, dt, mio::abm::Parameters(num_age_groups)), mio::abm::LocationType::Home); } TEST(TestMigrationRules, go_event) { auto rng = mio::RandomNumberGenerator(); - mio::abm::Location work(mio::abm::LocationType::Work, 0, NUM_AGE_GROUPS); - auto p_work = mio::abm::Person(rng, work, AGE_GROUP_35_TO_59); + mio::abm::Location work(mio::abm::LocationType::Work, 0, num_age_groups); + auto p_work = mio::abm::Person(rng, work, age_group_35_to_59); auto rng_work = mio::abm::Person::RandomNumberGenerator(rng, p_work); - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); - auto p_home = mio::abm::Person(rng, home, AGE_GROUP_60_TO_79); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups); + auto p_home = mio::abm::Person(rng, home, age_group_60_to_79); auto rng_home = mio::abm::Person::RandomNumberGenerator(rng, p_home); auto t_weekday = mio::abm::TimePoint(0) + mio::abm::days(4) + mio::abm::hours(20); @@ -418,57 +418,57 @@ TEST(TestMigrationRules, go_event) auto t_night = mio::abm::TimePoint(0) + mio::abm::days(5) + mio::abm::hours(1); auto dt = mio::abm::hours(1); - ASSERT_EQ(mio::abm::go_to_event(rng_work, p_work, t_weekday, dt, mio::abm::Parameters(NUM_AGE_GROUPS)), + ASSERT_EQ(mio::abm::go_to_event(rng_work, p_work, t_weekday, dt, mio::abm::Parameters(num_age_groups)), mio::abm::LocationType::Work); - ASSERT_EQ(mio::abm::go_to_event(rng_home, p_home, t_night, dt, mio::abm::Parameters(NUM_AGE_GROUPS)), + ASSERT_EQ(mio::abm::go_to_event(rng_home, p_home, t_night, dt, mio::abm::Parameters(num_age_groups)), mio::abm::LocationType::Home); ScopedMockDistribution>>> mock_exponential_dist; EXPECT_CALL(mock_exponential_dist.get_mock(), invoke).Times(1).WillOnce(testing::Return(0.01)); - ASSERT_EQ(mio::abm::go_to_event(rng_home, p_home, t_weekday, dt, mio::abm::Parameters(NUM_AGE_GROUPS)), + ASSERT_EQ(mio::abm::go_to_event(rng_home, p_home, t_weekday, dt, mio::abm::Parameters(num_age_groups)), mio::abm::LocationType::SocialEvent); EXPECT_CALL(mock_exponential_dist.get_mock(), invoke).Times(1).WillOnce(testing::Return(0.01)); - ASSERT_EQ(mio::abm::go_to_event(rng_home, p_home, t_saturday, dt, mio::abm::Parameters(NUM_AGE_GROUPS)), + ASSERT_EQ(mio::abm::go_to_event(rng_home, p_home, t_saturday, dt, mio::abm::Parameters(num_age_groups)), mio::abm::LocationType::SocialEvent); } TEST(TestMigrationRules, event_return) { auto rng = mio::RandomNumberGenerator(); - auto params = mio::abm::Parameters(NUM_AGE_GROUPS); + auto params = mio::abm::Parameters(num_age_groups); auto t = mio::abm::TimePoint(0) + mio::abm::days(4) + mio::abm::hours(21); auto dt = mio::abm::hours(3); - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); - mio::abm::Location social_event(mio::abm::LocationType::SocialEvent, 0, NUM_AGE_GROUPS); - auto p = mio::abm::Person(rng, home, AGE_GROUP_15_TO_34); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups); + mio::abm::Location social_event(mio::abm::LocationType::SocialEvent, 0, num_age_groups); + auto p = mio::abm::Person(rng, home, age_group_15_to_34); auto rng_p = mio::abm::Person::RandomNumberGenerator(rng, p); home.add_person(p); p.migrate_to(social_event); p.interact(rng_p, t, dt, params); - ASSERT_EQ(mio::abm::go_to_event(rng_p, p, t, dt, mio::abm::Parameters(NUM_AGE_GROUPS)), + ASSERT_EQ(mio::abm::go_to_event(rng_p, p, t, dt, mio::abm::Parameters(num_age_groups)), mio::abm::LocationType::Home); } TEST(TestMigrationRules, icu) { auto rng = mio::RandomNumberGenerator(); - mio::abm::Location hospital(mio::abm::LocationType::Hospital, 0, NUM_AGE_GROUPS); + mio::abm::Location hospital(mio::abm::LocationType::Hospital, 0, num_age_groups); auto t = mio::abm::TimePoint(12346); auto dt = mio::abm::hours(1); - auto p_hosp = make_test_person(hospital, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedCritical, t); + auto p_hosp = make_test_person(hospital, age_group_15_to_34, mio::abm::InfectionState::InfectedCritical, t); auto rng_hosp = mio::abm::Person::RandomNumberGenerator(rng, p_hosp); - ASSERT_EQ(mio::abm::go_to_icu(rng_hosp, p_hosp, t, dt, mio::abm::Parameters(NUM_AGE_GROUPS)), + ASSERT_EQ(mio::abm::go_to_icu(rng_hosp, p_hosp, t, dt, mio::abm::Parameters(num_age_groups)), mio::abm::LocationType::ICU); - mio::abm::Location work(mio::abm::LocationType::Work, 0, NUM_AGE_GROUPS); - auto p_work = make_test_person(work, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedSymptoms, t); + mio::abm::Location work(mio::abm::LocationType::Work, 0, num_age_groups); + auto p_work = make_test_person(work, age_group_15_to_34, mio::abm::InfectionState::InfectedSymptoms, t); auto rng_work = mio::abm::Person::RandomNumberGenerator(rng, p_work); - ASSERT_EQ(mio::abm::go_to_icu(rng_work, p_work, t, dt, mio::abm::Parameters(NUM_AGE_GROUPS)), + ASSERT_EQ(mio::abm::go_to_icu(rng_work, p_work, t, dt, mio::abm::Parameters(num_age_groups)), mio::abm::LocationType::Work); } @@ -478,13 +478,13 @@ TEST(TestMigrationRules, recover) mio::abm::Location hospital(mio::abm::LocationType::Hospital, 0); auto t = mio::abm::TimePoint(12346); auto dt = mio::abm::hours(1); - auto p_rec = make_test_person(hospital, AGE_GROUP_60_TO_79, mio::abm::InfectionState::Recovered, t); + auto p_rec = make_test_person(hospital, age_group_60_to_79, mio::abm::InfectionState::Recovered, t); auto rng_rec = mio::abm::Person::RandomNumberGenerator(rng, p_rec); - auto p_inf = make_test_person(hospital, AGE_GROUP_60_TO_79, mio::abm::InfectionState::InfectedSevere, t); + auto p_inf = make_test_person(hospital, age_group_60_to_79, mio::abm::InfectionState::InfectedSevere, t); auto rng_inf = mio::abm::Person::RandomNumberGenerator(rng, p_inf); - ASSERT_EQ(mio::abm::return_home_when_recovered(rng_rec, p_rec, t, dt, {NUM_AGE_GROUPS}), + ASSERT_EQ(mio::abm::return_home_when_recovered(rng_rec, p_rec, t, dt, {num_age_groups}), mio::abm::LocationType::Home); - ASSERT_EQ(mio::abm::return_home_when_recovered(rng_inf, p_inf, t, dt, {NUM_AGE_GROUPS}), + ASSERT_EQ(mio::abm::return_home_when_recovered(rng_inf, p_inf, t, dt, {num_age_groups}), mio::abm::LocationType::Hospital); } @@ -495,8 +495,8 @@ TEST(TestMigrationRules, dead) mio::abm::Location icu(mio::abm::LocationType::ICU, 0); auto t = mio::abm::TimePoint(12346); auto dt = mio::abm::hours(1); - auto p_dead = make_test_person(icu, AGE_GROUP_60_TO_79, mio::abm::InfectionState::Dead, t); + auto p_dead = make_test_person(icu, age_group_60_to_79, mio::abm::InfectionState::Dead, t); auto p_rng = mio::abm::Person::RandomNumberGenerator(rng, p_dead); - ASSERT_EQ(mio::abm::get_buried(p_rng, p_dead, t, dt, {NUM_AGE_GROUPS}), mio::abm::LocationType::Cemetery); + ASSERT_EQ(mio::abm::get_buried(p_rng, p_dead, t, dt, {num_age_groups}), mio::abm::LocationType::Cemetery); } diff --git a/cpp/tests/test_abm_person.cpp b/cpp/tests/test_abm_person.cpp index fd14098de8..257962d4a0 100644 --- a/cpp/tests/test_abm_person.cpp +++ b/cpp/tests/test_abm_person.cpp @@ -28,9 +28,9 @@ TEST(TestPerson, init) { auto rng = mio::RandomNumberGenerator(); - mio::abm::Location location(mio::abm::LocationType::Work, 0, NUM_AGE_GROUPS); + mio::abm::Location location(mio::abm::LocationType::Work, 0, num_age_groups); auto t = mio::abm::TimePoint(0); - auto person = mio::abm::Person(rng, location, AGE_GROUP_60_TO_79); + auto person = mio::abm::Person(rng, location, age_group_60_to_79); ASSERT_EQ(person.get_infection_state(t), mio::abm::InfectionState::Susceptible); ASSERT_EQ(person.get_location(), location); @@ -40,10 +40,10 @@ TEST(TestPerson, init) TEST(TestPerson, copyPerson) { auto rng = mio::RandomNumberGenerator(); - auto location = mio::abm::Location(mio::abm::LocationType::Work, 0, NUM_AGE_GROUPS); + auto location = mio::abm::Location(mio::abm::LocationType::Work, 0, num_age_groups); auto t = mio::abm::TimePoint(0); - auto person = mio::abm::Person(rng, location, AGE_GROUP_60_TO_79); - auto copied_location = location.copy_location_without_persons(NUM_AGE_GROUPS); + auto person = mio::abm::Person(rng, location, age_group_60_to_79); + auto copied_location = location.copy_location_without_persons(num_age_groups); auto copied_person = person.copy_person(copied_location); ASSERT_EQ(copied_person.get_infection_state(t), mio::abm::InfectionState::Susceptible); @@ -56,11 +56,11 @@ TEST(TestPerson, migrate) auto rng = mio::RandomNumberGenerator(); auto t = mio::abm::TimePoint(0); - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups); mio::abm::Location loc1(mio::abm::LocationType::PublicTransport, 0, 6, 1); - mio::abm::Location loc2(mio::abm::LocationType::School, 0, NUM_AGE_GROUPS); + mio::abm::Location loc2(mio::abm::LocationType::School, 0, num_age_groups); mio::abm::Location loc3(mio::abm::LocationType::PublicTransport, 0, 6, 2); - auto person = make_test_person(home, AGE_GROUP_0_TO_4, mio::abm::InfectionState::Recovered); + auto person = make_test_person(home, age_group_0_to_4, mio::abm::InfectionState::Recovered); person.migrate_to(loc1, {0}); ASSERT_EQ(person.get_location(), loc1); @@ -90,8 +90,8 @@ TEST(TestPerson, migrate) TEST(TestPerson, setGetAssignedLocation) { auto rng = mio::RandomNumberGenerator(); - mio::abm::Location location(mio::abm::LocationType::Work, 2, NUM_AGE_GROUPS); - auto person = mio::abm::Person(rng, location, AGE_GROUP_35_TO_59); + mio::abm::Location location(mio::abm::LocationType::Work, 2, num_age_groups); + auto person = mio::abm::Person(rng, location, age_group_35_to_59); person.set_assigned_location(location); ASSERT_EQ((int)person.get_assigned_location_index(mio::abm::LocationType::Work), 2); @@ -104,9 +104,9 @@ TEST(TestPerson, quarantine) using testing::Return; auto rng = mio::RandomNumberGenerator(); - auto infection_parameters = mio::abm::Parameters(NUM_AGE_GROUPS); - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); - mio::abm::Location work(mio::abm::LocationType::Work, 0, NUM_AGE_GROUPS); + auto infection_parameters = mio::abm::Parameters(num_age_groups); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups); + mio::abm::Location work(mio::abm::LocationType::Work, 0, num_age_groups); //setup rng mock so the person has a state transition to Recovered ScopedMockDistribution>>> mock_uniform_dist; @@ -121,21 +121,21 @@ TEST(TestPerson, quarantine) auto t_morning = mio::abm::TimePoint(0) + mio::abm::hours(7); auto dt = mio::abm::hours(1); infection_parameters - .get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_35_TO_59}] = + .get()[{mio::abm::VirusVariant::Wildtype, age_group_35_to_59}] = 0.5 * dt.days(); - auto person = make_test_person(home, AGE_GROUP_35_TO_59, mio::abm::InfectionState::InfectedSymptoms, t_morning, + auto person = make_test_person(home, age_group_35_to_59, mio::abm::InfectionState::InfectedSymptoms, t_morning, infection_parameters); auto rng_person = mio::abm::Person::RandomNumberGenerator(rng, person); person.detect_infection(t_morning); ASSERT_EQ(person.get_infection_state(t_morning), mio::abm::InfectionState::InfectedSymptoms); - ASSERT_EQ(mio::abm::go_to_work(rng_person, person, t_morning, dt, mio::abm::Parameters(NUM_AGE_GROUPS)), + ASSERT_EQ(mio::abm::go_to_work(rng_person, person, t_morning, dt, mio::abm::Parameters(num_age_groups)), mio::abm::LocationType::Home); ASSERT_EQ(person.get_infection_state(t_morning + dt), mio::abm::InfectionState::Recovered); person.remove_quarantine(); - ASSERT_EQ(mio::abm::go_to_work(rng_person, person, t_morning, dt, mio::abm::Parameters(NUM_AGE_GROUPS)), + ASSERT_EQ(mio::abm::go_to_work(rng_person, person, t_morning, dt, mio::abm::Parameters(num_age_groups)), mio::abm::LocationType::Work); } @@ -145,10 +145,10 @@ TEST(TestPerson, get_tested) auto rng = mio::RandomNumberGenerator(); mio::abm::TimePoint t(0); - mio::abm::Location loc(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); - auto infected = make_test_person(loc, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedSymptoms); + mio::abm::Location loc(mio::abm::LocationType::Home, 0, num_age_groups); + auto infected = make_test_person(loc, age_group_15_to_34, mio::abm::InfectionState::InfectedSymptoms); auto rng_infected = mio::abm::Person::RandomNumberGenerator(rng, infected); - auto susceptible = mio::abm::Person(rng, loc, AGE_GROUP_15_TO_34); + auto susceptible = mio::abm::Person(rng, loc, age_group_15_to_34); auto rng_suscetible = mio::abm::Person::RandomNumberGenerator(rng, susceptible); auto pcr_test = mio::abm::PCRTest(); @@ -193,7 +193,7 @@ TEST(TestPerson, getCells) { mio::abm::Location home(mio::abm::LocationType::Home, 0, 6, 1); mio::abm::Location location(mio::abm::LocationType::PublicTransport, 0, 6, 2); - auto person = make_test_person(home, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedNoSymptoms); + auto person = make_test_person(home, age_group_15_to_34, mio::abm::InfectionState::InfectedNoSymptoms); home.add_person(person); person.migrate_to(location, {0, 1}); ASSERT_EQ(person.get_cells().size(), 2); @@ -204,10 +204,10 @@ TEST(TestPerson, interact) auto rng = mio::RandomNumberGenerator(); // Location.interact is tested seperately in the location - auto infection_parameters = mio::abm::Parameters(NUM_AGE_GROUPS); - mio::abm::Location loc(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); + auto infection_parameters = mio::abm::Parameters(num_age_groups); + mio::abm::Location loc(mio::abm::LocationType::Home, 0, num_age_groups); mio::abm::TimePoint t(0); - auto person = mio::abm::Person(rng, loc, AGE_GROUP_15_TO_34); + auto person = mio::abm::Person(rng, loc, age_group_15_to_34); auto rng_person = mio::abm::Person::RandomNumberGenerator(rng, person); auto dt = mio::abm::seconds(8640); //0.1 days person.interact(rng_person, t, dt, infection_parameters); @@ -218,8 +218,8 @@ TEST(TestPerson, applyMaskIntervention) { auto rng = mio::RandomNumberGenerator(); - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); - mio::abm::Location target(mio::abm::LocationType::Work, 0, NUM_AGE_GROUPS); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups); + mio::abm::Location target(mio::abm::LocationType::Work, 0, num_age_groups); auto person = make_test_person(home); person.get_mask().change_mask(mio::abm::MaskType::Community); auto rng_person = mio::abm::Person::RandomNumberGenerator(rng, person); @@ -252,7 +252,7 @@ TEST(TestPerson, applyMaskIntervention) TEST(TestPerson, setWearMask) { - mio::abm::Location location(mio::abm::LocationType::School, 0, NUM_AGE_GROUPS); + mio::abm::Location location(mio::abm::LocationType::School, 0, num_age_groups); auto person = make_test_person(location); person.set_wear_mask(false); @@ -277,7 +277,7 @@ TEST(TestPerson, getMaskProtectiveFactor) auto person_without = make_test_person(location); person_without.set_wear_mask(false); - mio::abm::Parameters params = mio::abm::Parameters(NUM_AGE_GROUPS); + mio::abm::Parameters params = mio::abm::Parameters(num_age_groups); params.get()[{mio::abm::MaskType::Community}] = 0.5; params.get()[{mio::abm::MaskType::Surgical}] = 0.8; params.get()[{mio::abm::MaskType::FFP2}] = 0.9; @@ -291,10 +291,10 @@ TEST(TestPerson, getMaskProtectiveFactor) TEST(TestPerson, getLatestProtection) { auto rng = mio::RandomNumberGenerator(); - auto location = mio::abm::Location(mio::abm::LocationType::School, 0, NUM_AGE_GROUPS); - auto person = mio::abm::Person(rng, location, AGE_GROUP_15_TO_34); + auto location = mio::abm::Location(mio::abm::LocationType::School, 0, num_age_groups); + auto person = mio::abm::Person(rng, location, age_group_15_to_34); auto prng = mio::abm::Person::RandomNumberGenerator(rng, person); - mio::abm::Parameters params = mio::abm::Parameters(NUM_AGE_GROUPS); + mio::abm::Parameters params = mio::abm::Parameters(num_age_groups); auto t = mio::abm::TimePoint(0); person.add_new_vaccination(mio::abm::ExposureType::GenericVaccine, t); @@ -303,7 +303,7 @@ TEST(TestPerson, getLatestProtection) ASSERT_EQ(latest_protection.second.days(), t.days()); t = mio::abm::TimePoint(40 * 24 * 60 * 60); - person.add_new_infection(mio::abm::Infection(prng, static_cast(0), AGE_GROUP_15_TO_34, + person.add_new_infection(mio::abm::Infection(prng, static_cast(0), age_group_15_to_34, params, t, mio::abm::InfectionState::Exposed)); latest_protection = person.get_latest_protection(); ASSERT_EQ(latest_protection.first, mio::abm::ExposureType::NaturalInfection); @@ -314,7 +314,7 @@ TEST(Person, rng) { auto rng = mio::RandomNumberGenerator(); mio::abm::Location loc(mio::abm::LocationType::Home, 0); - auto p = mio::abm::Person(rng, loc, AGE_GROUP_35_TO_59, 13); + auto p = mio::abm::Person(rng, loc, age_group_35_to_59, 13); ASSERT_EQ(p.get_rng_counter(), mio::Counter(0)); diff --git a/cpp/tests/test_abm_simulation.cpp b/cpp/tests/test_abm_simulation.cpp index bec3aa339a..fff7311d5d 100644 --- a/cpp/tests/test_abm_simulation.cpp +++ b/cpp/tests/test_abm_simulation.cpp @@ -23,13 +23,13 @@ TEST(TestSimulation, advance_random) { - auto world = mio::abm::World(NUM_AGE_GROUPS); + auto world = mio::abm::World(num_age_groups); auto location1 = world.add_location(mio::abm::LocationType::School); auto location2 = world.add_location(mio::abm::LocationType::School); - auto& p1 = world.add_person(location1, AGE_GROUP_5_TO_14); - auto& p2 = world.add_person(location1, AGE_GROUP_5_TO_14); - auto& p3 = world.add_person(location2, AGE_GROUP_5_TO_14); - auto& p4 = world.add_person(location2, AGE_GROUP_5_TO_14); + auto& p1 = world.add_person(location1, age_group_5_to_14); + auto& p2 = world.add_person(location1, age_group_5_to_14); + auto& p3 = world.add_person(location2, age_group_5_to_14); + auto& p4 = world.add_person(location2, age_group_5_to_14); p1.set_assigned_location(location1); p2.set_assigned_location(location1); p3.set_assigned_location(location2); @@ -53,7 +53,7 @@ TEST(TestSimulation, getWorldAndTimeConst) { auto t = mio::abm::TimePoint(0); - auto world = mio::abm::World(NUM_AGE_GROUPS); + auto world = mio::abm::World(num_age_groups); auto sim = mio::abm::Simulation(t + mio::abm::days(7), std::move(world)); auto t_test = mio::abm::days(7); @@ -65,7 +65,7 @@ TEST(TestSimulation, getWorldAndTimeConst) TEST(TestSimulation, advanceWithCommonHistory) { - auto world = mio::abm::World(NUM_AGE_GROUPS); + auto world = mio::abm::World(num_age_groups); auto home_id = world.add_location(mio::abm::LocationType::Home); auto work_id = world.add_location(mio::abm::LocationType::Work); auto icu_id = world.add_location(mio::abm::LocationType::ICU); @@ -75,9 +75,9 @@ TEST(TestSimulation, advanceWithCommonHistory) auto basics_id = world.add_location(mio::abm::LocationType::BasicsShop); auto public_id = world.add_location(mio::abm::LocationType::PublicTransport); - auto& person1 = add_test_person(world, home_id, AGE_GROUP_5_TO_14, mio::abm::InfectionState::Exposed); - auto& person2 = add_test_person(world, home_id, AGE_GROUP_15_TO_34, mio::abm::InfectionState::Exposed); - auto& person3 = add_test_person(world, home_id, AGE_GROUP_35_TO_59, mio::abm::InfectionState::Dead); + auto& person1 = add_test_person(world, home_id, age_group_5_to_14, mio::abm::InfectionState::Exposed); + auto& person2 = add_test_person(world, home_id, age_group_15_to_34, mio::abm::InfectionState::Exposed); + auto& person3 = add_test_person(world, home_id, age_group_35_to_59, mio::abm::InfectionState::Dead); person1.set_assigned_location(home_id); person2.set_assigned_location(home_id); person3.set_assigned_location(home_id); diff --git a/cpp/tests/test_abm_testing_strategy.cpp b/cpp/tests/test_abm_testing_strategy.cpp index 0760e36b62..b4714b24a9 100644 --- a/cpp/tests/test_abm_testing_strategy.cpp +++ b/cpp/tests/test_abm_testing_strategy.cpp @@ -23,9 +23,9 @@ TEST(TestTestingCriteria, addRemoveAndEvaluateTestCriteria) { - mio::abm::Location home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); - mio::abm::Location work(mio::abm::LocationType::Work, 0, NUM_AGE_GROUPS); - auto person = make_test_person(home, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedSymptoms); + mio::abm::Location home(mio::abm::LocationType::Home, 0, num_age_groups); + mio::abm::Location work(mio::abm::LocationType::Work, 0, num_age_groups); + auto person = make_test_person(home, age_group_15_to_34, mio::abm::InfectionState::InfectedSymptoms); mio::abm::TimePoint t{0}; auto testing_criteria = mio::abm::TestingCriteria(); @@ -33,10 +33,10 @@ TEST(TestTestingCriteria, addRemoveAndEvaluateTestCriteria) testing_criteria.add_infection_state(mio::abm::InfectionState::InfectedSymptoms); testing_criteria.add_infection_state(mio::abm::InfectionState::InfectedNoSymptoms); - testing_criteria.add_age_group(AGE_GROUP_35_TO_59); + testing_criteria.add_age_group(age_group_35_to_59); ASSERT_EQ(testing_criteria.evaluate(person, t), false); // now it isn't empty and get's evaluated against age group - testing_criteria.remove_age_group(AGE_GROUP_35_TO_59); + testing_criteria.remove_age_group(age_group_35_to_59); ASSERT_EQ(testing_criteria.evaluate(person, t), true); testing_criteria.remove_infection_state(mio::abm::InfectionState::InfectedSymptoms); @@ -44,11 +44,11 @@ TEST(TestTestingCriteria, addRemoveAndEvaluateTestCriteria) testing_criteria.add_infection_state(mio::abm::InfectionState::InfectedSymptoms); auto testing_criteria_manual = mio::abm::TestingCriteria( - std::vector({AGE_GROUP_15_TO_34}), + std::vector({age_group_15_to_34}), std::vector({mio::abm::InfectionState::InfectedNoSymptoms})); ASSERT_EQ(testing_criteria == testing_criteria_manual, false); testing_criteria_manual.add_infection_state(mio::abm::InfectionState::InfectedSymptoms); - testing_criteria_manual.remove_age_group(AGE_GROUP_15_TO_34); + testing_criteria_manual.remove_age_group(age_group_15_to_34); ASSERT_EQ(testing_criteria == testing_criteria_manual, true); } @@ -88,11 +88,11 @@ TEST(TestTestingScheme, runScheme) auto testing_scheme2 = mio::abm::TestingScheme(testing_criteria2, testing_min_time, start_date, end_date, test_type, probability); - mio::abm::Location loc_home(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); - mio::abm::Location loc_work(mio::abm::LocationType::Work, 0, NUM_AGE_GROUPS); - auto person1 = make_test_person(loc_home, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedNoSymptoms); + mio::abm::Location loc_home(mio::abm::LocationType::Home, 0, num_age_groups); + mio::abm::Location loc_work(mio::abm::LocationType::Work, 0, num_age_groups); + auto person1 = make_test_person(loc_home, age_group_15_to_34, mio::abm::InfectionState::InfectedNoSymptoms); auto rng_person1 = mio::abm::Person::RandomNumberGenerator(rng, person1); - auto person2 = make_test_person(loc_home, AGE_GROUP_15_TO_34, mio::abm::InfectionState::Recovered); + auto person2 = make_test_person(loc_home, age_group_15_to_34, mio::abm::InfectionState::Recovered); auto rng_person2 = mio::abm::Person::RandomNumberGenerator(rng, person2); ScopedMockDistribution>>> mock_uniform_dist; @@ -130,9 +130,9 @@ TEST(TestTestingScheme, initAndRunTestingStrategy) mio::abm::TestingScheme(testing_criteria2, testing_min_time, start_date, end_date, test_type, probability); mio::abm::Location loc_home(mio::abm::LocationType::Home, 0); - auto person1 = make_test_person(loc_home, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedNoSymptoms); + auto person1 = make_test_person(loc_home, age_group_15_to_34, mio::abm::InfectionState::InfectedNoSymptoms); auto rng_person1 = mio::abm::Person::RandomNumberGenerator(rng, person1); - auto person2 = make_test_person(loc_home, AGE_GROUP_15_TO_34, mio::abm::InfectionState::Recovered); + auto person2 = make_test_person(loc_home, age_group_15_to_34, mio::abm::InfectionState::Recovered); auto rng_person2 = mio::abm::Person::RandomNumberGenerator(rng, person2); ScopedMockDistribution>>> mock_uniform_dist; diff --git a/cpp/tests/test_abm_world.cpp b/cpp/tests/test_abm_world.cpp index 026b1809db..4275202b86 100644 --- a/cpp/tests/test_abm_world.cpp +++ b/cpp/tests/test_abm_world.cpp @@ -23,7 +23,7 @@ TEST(TestWorld, init) { - auto world = mio::abm::World(NUM_AGE_GROUPS); + auto world = mio::abm::World(num_age_groups); EXPECT_EQ(world.get_locations().size(), 1); EXPECT_EQ(world.get_locations()[0].get_type(), mio::abm::LocationType::Cemetery); @@ -32,7 +32,7 @@ TEST(TestWorld, init) TEST(TestWorld, addLocation) { - auto world = mio::abm::World(NUM_AGE_GROUPS); + auto world = mio::abm::World(num_age_groups); auto school_id1 = world.add_location(mio::abm::LocationType::School); auto school_id2 = world.add_location(mio::abm::LocationType::School); auto work_id = world.add_location(mio::abm::LocationType::Work); @@ -62,11 +62,11 @@ TEST(TestWorld, addLocation) TEST(TestWorld, addPerson) { - auto world = mio::abm::World(NUM_AGE_GROUPS); + auto world = mio::abm::World(num_age_groups); auto location = world.add_location(mio::abm::LocationType::School); - auto& p1 = world.add_person(location, AGE_GROUP_15_TO_34); - auto& p2 = world.add_person(location, AGE_GROUP_35_TO_59); + auto& p1 = world.add_person(location, age_group_15_to_34); + auto& p2 = world.add_person(location, age_group_35_to_59); ASSERT_EQ(world.get_persons().size(), 2); ASSERT_EQ(&world.get_persons()[0], &p1); @@ -76,17 +76,17 @@ TEST(TestWorld, addPerson) TEST(TestWorld, getSubpopulationCombined) { auto t = mio::abm::TimePoint(0); - auto world = mio::abm::World(NUM_AGE_GROUPS); + auto world = mio::abm::World(num_age_groups); auto school1 = world.add_location(mio::abm::LocationType::School); auto school2 = world.add_location(mio::abm::LocationType::School); auto school3 = world.add_location(mio::abm::LocationType::School); auto home1 = world.add_location(mio::abm::LocationType::Home); - add_test_person(world, school1, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedNoSymptoms); - add_test_person(world, school1, AGE_GROUP_15_TO_34, mio::abm::InfectionState::Susceptible); - add_test_person(world, school2, AGE_GROUP_15_TO_34, mio::abm::InfectionState::Susceptible); - add_test_person(world, school2, AGE_GROUP_15_TO_34, mio::abm::InfectionState::Susceptible); - add_test_person(world, school3, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedNoSymptoms); - add_test_person(world, home1, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedNoSymptoms); + add_test_person(world, school1, age_group_15_to_34, mio::abm::InfectionState::InfectedNoSymptoms); + add_test_person(world, school1, age_group_15_to_34, mio::abm::InfectionState::Susceptible); + add_test_person(world, school2, age_group_15_to_34, mio::abm::InfectionState::Susceptible); + add_test_person(world, school2, age_group_15_to_34, mio::abm::InfectionState::Susceptible); + add_test_person(world, school3, age_group_15_to_34, mio::abm::InfectionState::InfectedNoSymptoms); + add_test_person(world, home1, age_group_15_to_34, mio::abm::InfectionState::InfectedNoSymptoms); ASSERT_EQ(world.get_subpopulation_combined_per_location_type(t, mio::abm::InfectionState::Susceptible, mio::abm::LocationType::School), @@ -99,7 +99,7 @@ TEST(TestWorld, getSubpopulationCombined) TEST(TestWorld, findLocation) { - auto world = mio::abm::World(NUM_AGE_GROUPS); + auto world = mio::abm::World(num_age_groups); auto home_id = world.add_location(mio::abm::LocationType::Home); auto school_id = world.add_location(mio::abm::LocationType::School); auto work_id = world.add_location(mio::abm::LocationType::Work); @@ -127,28 +127,28 @@ TEST(TestWorld, evolveStateTransition) auto t = mio::abm::TimePoint(0); auto dt = mio::abm::hours(1); - auto world = mio::abm::World(NUM_AGE_GROUPS); + auto world = mio::abm::World(num_age_groups); //setup so p1 and p3 don't transition - world.parameters.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = + world.parameters.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 2 * dt.days(); world.parameters - .get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = + .get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 2 * dt.days(); world.parameters - .get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = + .get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 2 * dt.days(); - world.parameters.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = + world.parameters.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 2 * dt.days(); world.parameters - .get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = + .get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 2 * dt.days(); auto location1 = world.add_location(mio::abm::LocationType::School); - auto& p1 = add_test_person(world, location1, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedNoSymptoms); - auto& p2 = add_test_person(world, location1, AGE_GROUP_15_TO_34, mio::abm::InfectionState::Susceptible); + auto& p1 = add_test_person(world, location1, age_group_15_to_34, mio::abm::InfectionState::InfectedNoSymptoms); + auto& p2 = add_test_person(world, location1, age_group_15_to_34, mio::abm::InfectionState::Susceptible); auto location2 = world.add_location(mio::abm::LocationType::Work); - auto& p3 = add_test_person(world, location2, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedSymptoms); + auto& p3 = add_test_person(world, location2, age_group_15_to_34, mio::abm::InfectionState::InfectedSymptoms); p1.set_assigned_location(location1); p2.set_assigned_location(location1); p3.set_assigned_location(location2); @@ -172,13 +172,13 @@ TEST(TestWorld, evolveMigration) { auto t = mio::abm::TimePoint(0) + mio::abm::hours(8); auto dt = mio::abm::hours(1); - auto world = mio::abm::World(NUM_AGE_GROUPS); + auto world = mio::abm::World(num_age_groups); //setup so p1 doesn't do transition world.parameters - .get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = + .get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 2 * dt.days(); world.parameters - .get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = + .get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 2 * dt.days(); auto home_id = world.add_location(mio::abm::LocationType::Home); @@ -199,8 +199,8 @@ TEST(TestWorld, evolveMigration) .WillOnce(testing::Return(0.8)) // draw random school hour .WillRepeatedly(testing::Return(1.0)); - auto& p2 = add_test_person(world, home_id, AGE_GROUP_5_TO_14, mio::abm::InfectionState::Susceptible, t); - auto& p1 = add_test_person(world, home_id, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedNoSymptoms, t); + auto& p2 = add_test_person(world, home_id, age_group_5_to_14, mio::abm::InfectionState::Susceptible, t); + auto& p1 = add_test_person(world, home_id, age_group_15_to_34, mio::abm::InfectionState::InfectedNoSymptoms, t); p1.set_assigned_location(school_id); p2.set_assigned_location(school_id); @@ -227,17 +227,17 @@ TEST(TestWorld, evolveMigration) { auto t = mio::abm::TimePoint(0) + mio::abm::hours(8); auto dt = mio::abm::hours(2); - auto world = mio::abm::World(NUM_AGE_GROUPS); + auto world = mio::abm::World(num_age_groups); //setup so p1-p5 don't do transition world.parameters - .get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = + .get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 2 * dt.days(); world.parameters - .get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = + .get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 2 * dt.days(); - world.parameters.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = + world.parameters.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 2 * dt.days(); - world.parameters.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_15_TO_34}] = + world.parameters.get()[{mio::abm::VirusVariant::Wildtype, age_group_15_to_34}] = 2 * dt.days(); auto home_id = world.add_location(mio::abm::LocationType::Home); @@ -259,11 +259,11 @@ TEST(TestWorld, evolveMigration) .WillOnce(testing::Return(0.8)) // draw random school hour .WillRepeatedly(testing::Return(1.0)); // this forces p1 and p3 to recover - auto& p1 = add_test_person(world, home_id, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedNoSymptoms, t); - auto& p2 = add_test_person(world, home_id, AGE_GROUP_5_TO_14, mio::abm::InfectionState::Susceptible, t); - auto& p3 = add_test_person(world, home_id, AGE_GROUP_5_TO_14, mio::abm::InfectionState::InfectedSevere, t); - auto& p4 = add_test_person(world, hospital_id, AGE_GROUP_5_TO_14, mio::abm::InfectionState::Recovered, t); - auto& p5 = add_test_person(world, home_id, AGE_GROUP_15_TO_34, mio::abm::InfectionState::Susceptible, t); + auto& p1 = add_test_person(world, home_id, age_group_15_to_34, mio::abm::InfectionState::InfectedNoSymptoms, t); + auto& p2 = add_test_person(world, home_id, age_group_5_to_14, mio::abm::InfectionState::Susceptible, t); + auto& p3 = add_test_person(world, home_id, age_group_5_to_14, mio::abm::InfectionState::InfectedSevere, t); + auto& p4 = add_test_person(world, hospital_id, age_group_5_to_14, mio::abm::InfectionState::Recovered, t); + auto& p5 = add_test_person(world, home_id, age_group_15_to_34, mio::abm::InfectionState::Susceptible, t); p1.set_assigned_location(event_id); p2.set_assigned_location(event_id); p1.set_assigned_location(work_id); @@ -356,23 +356,23 @@ TEST(TestWorld, evolveMigration) { auto t = mio::abm::TimePoint(0); auto dt = mio::abm::days(1); - auto world = mio::abm::World(NUM_AGE_GROUPS); + auto world = mio::abm::World(num_age_groups); // Time to go from severe to critical infection is 1 day (dt). - world.parameters.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = + world.parameters.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.5; // Time to go from critical infection to dead state is 1/2 day (0.5 * dt). - world.parameters.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_60_TO_79}] = 0.5; + world.parameters.get()[{mio::abm::VirusVariant::Wildtype, age_group_60_to_79}] = 0.5; auto home_id = world.add_location(mio::abm::LocationType::Home); auto work_id = world.add_location(mio::abm::LocationType::Work); auto icu_id = world.add_location(mio::abm::LocationType::ICU); auto hospital_id = world.add_location(mio::abm::LocationType::Hospital); // Create a person that is dead at time t - auto& p_dead = add_test_person(world, icu_id, AGE_GROUP_60_TO_79, mio::abm::InfectionState::Dead, t); + auto& p_dead = add_test_person(world, icu_id, age_group_60_to_79, mio::abm::InfectionState::Dead, t); // Create a person that is severe at hospital and will be dead at time t + dt auto& p_severe = - add_test_person(world, hospital_id, AGE_GROUP_60_TO_79, mio::abm::InfectionState::Dead, t + dt); + add_test_person(world, hospital_id, age_group_60_to_79, mio::abm::InfectionState::Dead, t + dt); p_dead.set_assigned_location(icu_id); p_dead.set_assigned_location(work_id); p_dead.set_assigned_location(home_id); @@ -407,11 +407,11 @@ TEST(TestWorldTestingCriteria, testAddingAndUpdatingAndRunningTestingSchemes) { auto rng = mio::RandomNumberGenerator(); - auto world = mio::abm::World(NUM_AGE_GROUPS); + auto world = mio::abm::World(num_age_groups); // make sure the infected person stay in Infected long enough - world.parameters.get()[{mio::abm::VirusVariant(0), AGE_GROUP_15_TO_34}] = + world.parameters.get()[{mio::abm::VirusVariant(0), age_group_15_to_34}] = 100; - world.parameters.get()[{mio::abm::VirusVariant(0), AGE_GROUP_15_TO_34}] = 100; + world.parameters.get()[{mio::abm::VirusVariant(0), age_group_15_to_34}] = 100; auto home_id = world.add_location(mio::abm::LocationType::Home); auto work_id = world.add_location(mio::abm::LocationType::Work); @@ -419,7 +419,7 @@ TEST(TestWorldTestingCriteria, testAddingAndUpdatingAndRunningTestingSchemes) auto& work = world.get_individualized_location(work_id); auto current_time = mio::abm::TimePoint(0); auto person = - add_test_person(world, home_id, AGE_GROUP_15_TO_34, mio::abm::InfectionState::InfectedSymptoms, current_time); + add_test_person(world, home_id, age_group_15_to_34, mio::abm::InfectionState::InfectedSymptoms, current_time); auto rng_person = mio::abm::Person::RandomNumberGenerator(rng, person); person.set_assigned_location(home); person.set_assigned_location(work); @@ -459,76 +459,76 @@ TEST(TestWorldTestingCriteria, testAddingAndUpdatingAndRunningTestingSchemes) TEST(TestWorld, checkParameterConstraints) { mio::set_log_level(mio::LogLevel::critical); //errors inevitable as these are wanted - auto world = mio::abm::World(NUM_AGE_GROUPS); + auto world = mio::abm::World(num_age_groups); auto params = world.parameters; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 1.; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 2.; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 3.; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 4.; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 5.; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 6.; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 7.; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 8.; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 9.; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 10.; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.3; - params.get()[AGE_GROUP_35_TO_59] = mio::abm::hours(4); - params.get()[AGE_GROUP_35_TO_59] = mio::abm::hours(8); - params.get()[AGE_GROUP_0_TO_4] = mio::abm::hours(3); - params.get()[AGE_GROUP_0_TO_4] = mio::abm::hours(6); + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 1.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 2.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 3.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 4.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 5.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 6.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 7.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 8.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 9.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 10.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.3; + params.get()[age_group_35_to_59] = mio::abm::hours(4); + params.get()[age_group_35_to_59] = mio::abm::hours(8); + params.get()[age_group_0_to_4] = mio::abm::hours(3); + params.get()[age_group_0_to_4] = mio::abm::hours(6); params.get()[mio::abm::MaskType::Community] = 0.5; params.get()[mio::abm::MaskType::FFP2] = 0.6; params.get()[mio::abm::MaskType::Surgical] = 0.7; params.get() = mio::abm::TimePoint(0); ASSERT_EQ(params.check_constraints(), false); - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = -1.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = -1.; ASSERT_EQ(params.check_constraints(), true); - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 1.; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = -2.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 1.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = -2.; ASSERT_EQ(params.check_constraints(), true); - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 2.; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = -3.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 2.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = -3.; ASSERT_EQ(params.check_constraints(), true); - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 3.; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = -4.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 3.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = -4.; ASSERT_EQ(params.check_constraints(), true); - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 4.; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = -5.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 4.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = -5.; ASSERT_EQ(params.check_constraints(), true); - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 5.; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = -6.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 5.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = -6.; ASSERT_EQ(params.check_constraints(), true); - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 6.; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = -7.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 6.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = -7.; ASSERT_EQ(params.check_constraints(), true); - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 7.; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = -8.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 7.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = -8.; ASSERT_EQ(params.check_constraints(), true); - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 8.; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = -9.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 8.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = -9.; ASSERT_EQ(params.check_constraints(), true); - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 9.; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = -10.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 9.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = -10.; ASSERT_EQ(params.check_constraints(), true); - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 10.; - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 1.1; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 10.; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 1.1; ASSERT_EQ(params.check_constraints(), true); - params.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 0.3; + params.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 0.3; - params.get()[AGE_GROUP_35_TO_59] = mio::abm::hours(30); + params.get()[age_group_35_to_59] = mio::abm::hours(30); ASSERT_EQ(params.check_constraints(), true); - params.get()[AGE_GROUP_35_TO_59] = mio::abm::hours(4); - params.get()[AGE_GROUP_35_TO_59] = mio::abm::hours(30); + params.get()[age_group_35_to_59] = mio::abm::hours(4); + params.get()[age_group_35_to_59] = mio::abm::hours(30); ASSERT_EQ(params.check_constraints(), true); - params.get()[AGE_GROUP_35_TO_59] = mio::abm::hours(8); - params.get()[AGE_GROUP_0_TO_4] = mio::abm::hours(30); + params.get()[age_group_35_to_59] = mio::abm::hours(8); + params.get()[age_group_0_to_4] = mio::abm::hours(30); ASSERT_EQ(params.check_constraints(), true); - params.get()[AGE_GROUP_0_TO_4] = mio::abm::hours(3); - params.get()[AGE_GROUP_0_TO_4] = mio::abm::hours(30); + params.get()[age_group_0_to_4] = mio::abm::hours(3); + params.get()[age_group_0_to_4] = mio::abm::hours(30); ASSERT_EQ(params.check_constraints(), true); - params.get()[AGE_GROUP_0_TO_4] = mio::abm::hours(6); + params.get()[age_group_0_to_4] = mio::abm::hours(6); params.get()[mio::abm::MaskType::Community] = 1.2; ASSERT_EQ(params.check_constraints(), true); @@ -546,10 +546,10 @@ TEST(TestWorld, checkParameterConstraints) TEST(TestWorld, copyWorld) { - auto world = mio::abm::World(NUM_AGE_GROUPS); + auto world = mio::abm::World(num_age_groups); auto rng = mio::RandomNumberGenerator(); - world.parameters.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] = 4.; + world.parameters.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] = 4.; world.use_migration_rules(false); auto school_id1 = world.add_location(mio::abm::LocationType::School); @@ -565,11 +565,11 @@ TEST(TestWorld, copyWorld) auto& work = world.get_individualized_location(work_id); auto& home = world.get_individualized_location(home_id); - auto& p1 = world.add_person(school_id1, AGE_GROUP_0_TO_4); + auto& p1 = world.add_person(school_id1, age_group_0_to_4); auto rng_p1 = mio::abm::Person::RandomNumberGenerator(rng, p1); p1.add_new_infection(mio::abm::Infection(rng_p1, mio::abm::VirusVariant::Wildtype, p1.get_age(), world.parameters, mio::abm::TimePoint(0))); - auto& p2 = world.add_person(school_id2, AGE_GROUP_15_TO_34); + auto& p2 = world.add_person(school_id2, age_group_15_to_34); p2.set_mask_preferences(std::vector(15, 0.2)); mio::abm::TripList& trip_data = world.get_trip_list(); @@ -579,12 +579,12 @@ TEST(TestWorld, copyWorld) trip_data.add_trip(trip2); auto infection_params = - world.parameters.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] + world.parameters.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] .value(); auto copied_world = mio::abm::World(world); auto copied_infection_params = - copied_world.parameters.get()[{mio::abm::VirusVariant::Wildtype, AGE_GROUP_0_TO_4}] + copied_world.parameters.get()[{mio::abm::VirusVariant::Wildtype, age_group_0_to_4}] .value(); // Assert the parameters, trips, locations and persons of copied world are logically equal to that of original world diff --git a/cpp/tests/test_json_serializer.cpp b/cpp/tests/test_json_serializer.cpp index 2d45136672..b9a1f1b4de 100644 --- a/cpp/tests/test_json_serializer.cpp +++ b/cpp/tests/test_json_serializer.cpp @@ -475,7 +475,7 @@ TEST(TestJsonSerializer, container_of_objects) TEST(TestJsonSerializer, abmLocation) { - auto location = mio::abm::Location(mio::abm::LocationType::Home, 0, NUM_AGE_GROUPS); + auto location = mio::abm::Location(mio::abm::LocationType::Home, 0, num_age_groups); auto js = mio::serialize_json(location); Json::Value expected_json; expected_json["index"] = Json::UInt64(0); @@ -506,7 +506,7 @@ TEST(TestJsonSerializer, abmPerson) TEST(TestJsonSerializer, abmTrip) { - auto world = mio::abm::World(NUM_AGE_GROUPS); + auto world = mio::abm::World(num_age_groups); auto home_id = world.add_location(mio::abm::LocationType::Home); auto work_id = world.add_location(mio::abm::LocationType::Work); auto& home = world.get_individualized_location(home_id); @@ -529,17 +529,17 @@ TEST(TestJsonSerializer, abmTrip) TEST(TestJsonSerializer, abmWorld) { - auto world = mio::abm::World(NUM_AGE_GROUPS); + auto world = mio::abm::World(num_age_groups); auto home_id = world.add_location(mio::abm::LocationType::Home); auto work_id = world.add_location(mio::abm::LocationType::Work); - auto person = world.add_person(home_id, AGE_GROUP_15_TO_34); + auto person = world.add_person(home_id, age_group_15_to_34); mio::abm::Trip trip1(person.get_person_id(), mio::abm::TimePoint(0) + mio::abm::hours(8), work_id, home_id); mio::abm::Trip trip2(person.get_person_id(), mio::abm::TimePoint(0) + mio::abm::hours(11), work_id, home_id); world.get_trip_list().add_trip(trip1, false); world.get_trip_list().add_trip(trip2, true); auto js = mio::serialize_json(world); Json::Value expected_json; - expected_json["num_agegroups"] = Json::UInt(NUM_AGE_GROUPS); + expected_json["num_agegroups"] = Json::UInt(num_age_groups); expected_json["trips"][0]["person_id"] = Json::UInt(person.get_person_id()); expected_json["trips"][0]["time"] = Json::Int(mio::abm::hours(8).seconds()); expected_json["trips"][0]["destination_index"] = Json::UInt(work_id.index); diff --git a/pycode/memilio-simulation/memilio/simulation_test/test_abm.py b/pycode/memilio-simulation/memilio/simulation_test/test_abm.py index f6644887be..a77d1c31d4 100644 --- a/pycode/memilio-simulation/memilio/simulation_test/test_abm.py +++ b/pycode/memilio-simulation/memilio/simulation_test/test_abm.py @@ -25,21 +25,21 @@ import memilio.simulation as mio import memilio.simulation.abm as abm -global NUM_AGE_GROUPS -NUM_AGE_GROUPS = 6 +global num_age_groups +num_age_groups = 6 class TestAbm(unittest.TestCase): def test_world(self): t0 = abm.TimePoint(0) - sim = abm.Simulation(t0, NUM_AGE_GROUPS) + sim = abm.Simulation(t0, num_age_groups) world = sim.world self.assertEqual(len(world.persons), 0) self.assertEqual(len(world.locations), 1) def test_locations(self): t0 = abm.TimePoint(0) - sim = abm.Simulation(t0, NUM_AGE_GROUPS) + sim = abm.Simulation(t0, num_age_groups) world = sim.world home_id = world.add_location(abm.LocationType.Home) @@ -84,7 +84,7 @@ def test_persons(self): def test_simulation(self): t0 = abm.TimePoint(0) - sim = abm.Simulation(t0, NUM_AGE_GROUPS) + sim = abm.Simulation(t0, num_age_groups) world = sim.world # add some locations and persons From d12db7e6f00f9e6382ce602c4c2d5022b6501d0a Mon Sep 17 00:00:00 2001 From: Khoa Nguyen <4763945+khoanguyen-dev@users.noreply.github.com> Date: Sun, 17 Dec 2023 18:47:12 +0100 Subject: [PATCH 2/4] Fix errors in complication --- cpp/examples/abm_history_object.cpp | 2 +- cpp/tests/abm_helpers.h | 2 +- cpp/tests/test_abm_household.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cpp/examples/abm_history_object.cpp b/cpp/examples/abm_history_object.cpp index 9b8be77c5a..1095ff6eae 100644 --- a/cpp/examples/abm_history_object.cpp +++ b/cpp/examples/abm_history_object.cpp @@ -83,7 +83,7 @@ int main() auto parent = mio::abm::HouseholdMember(num_age_groups); // A parent is 50/50% 15-34 or 35-59. parent.set_age_weight(age_groups_15_to_34, 1); - parent.set_age_weight(age_groupsP_35_to_59, 1); + parent.set_age_weight(age_groups_35_to_59, 1); // Two-person household with one parent and one child. auto twoPersonHousehold_group = mio::abm::HouseholdGroup(); diff --git a/cpp/tests/abm_helpers.h b/cpp/tests/abm_helpers.h index 360b1b07fb..f6721455ee 100644 --- a/cpp/tests/abm_helpers.h +++ b/cpp/tests/abm_helpers.h @@ -100,7 +100,7 @@ struct ScopedMockDistribution { mio::abm::Person make_test_person(mio::abm::Location& location, mio::AgeGroup age = age_group_15_to_34, mio::abm::InfectionState infection_state = mio::abm::InfectionState::Susceptible, mio::abm::TimePoint t = mio::abm::TimePoint(0), - mio::abm::Parameters params = mio::abm::Parameters(num_age_group)); + mio::abm::Parameters params = mio::abm::Parameters(num_age_groups)); /** * @brief Add a Person to the World. Intended for simple use in tests. diff --git a/cpp/tests/test_abm_household.cpp b/cpp/tests/test_abm_household.cpp index 7fc3a5a4a1..a04b78e126 100644 --- a/cpp/tests/test_abm_household.cpp +++ b/cpp/tests/test_abm_household.cpp @@ -27,7 +27,7 @@ TEST(TestHouseholds, test_add_household_to_world) auto member1 = mio::abm::HouseholdMember(num_age_groups); member1.set_age_weight(age_group_0_to_4, 1); - auto member2 = mio::abm::HouseholdMember(num_age_group); + auto member2 = mio::abm::HouseholdMember(num_age_groups); member2.set_age_weight(age_group_5_to_14, 1); auto household = mio::abm::Household(); From 6801c48202d7061c4c68bab424a91339e40b8e46 Mon Sep 17 00:00:00 2001 From: Khoa Nguyen <4763945+khoanguyen-dev@users.noreply.github.com> Date: Mon, 18 Dec 2023 15:39:13 +0100 Subject: [PATCH 3/4] Changing value assignment from AgeGroup(num_age_groups - n) to simply AgeGroup(n) --- cpp/examples/abm_history_object.cpp | 22 +++++++++++----------- cpp/simulations/abm.cpp | 12 ++++++------ cpp/simulations/abm_braunschweig.cpp | 12 ++++++------ cpp/tests/abm_helpers.h | 12 ++++++------ 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/cpp/examples/abm_history_object.cpp b/cpp/examples/abm_history_object.cpp index 1095ff6eae..8f76b8d699 100644 --- a/cpp/examples/abm_history_object.cpp +++ b/cpp/examples/abm_history_object.cpp @@ -61,11 +61,11 @@ int main() { // This is a minimal example with children and adults < 60y. // We divided them into 4 different age groups, which are defined as follows: - const size_t num_age_groups = 4; - const auto age_groups_0_to_4 = mio::AgeGroup(num_age_groups - 4); - const auto age_groups_5_to_14 = mio::AgeGroup(num_age_groups - 3); - const auto age_groups_15_to_34 = mio::AgeGroup(num_age_groups - 2); - const auto age_groups_35_to_59 = mio::AgeGroup(num_age_groups - 1); + size_t num_age_groups = 4; + const auto age_group_0_to_4 = mio::AgeGroup(0); + const auto age_group_5_to_14 = mio::AgeGroup(1); + const auto age_group_15_to_34 = mio::AgeGroup(2); + const auto age_group_35_to_59 = mio::AgeGroup(3); // Create the world with 4 age groups. auto world = mio::abm::World(num_age_groups); @@ -78,12 +78,12 @@ int main() // For more than 1 family households we need families. These are parents and children and randoms (which are distributed like the data we have for these households). auto child = mio::abm::HouseholdMember(num_age_groups); // A child is 50/50% 0-4 or 5-14. - child.set_age_weight(age_groups_0_to_4, 1); - child.set_age_weight(age_groups_5_to_14, 1); + child.set_age_weight(age_group_0_to_4, 1); + child.set_age_weight(age_group_5_to_14, 1); auto parent = mio::abm::HouseholdMember(num_age_groups); // A parent is 50/50% 15-34 or 35-59. - parent.set_age_weight(age_groups_15_to_34, 1); - parent.set_age_weight(age_groups_35_to_59, 1); + parent.set_age_weight(age_group_15_to_34, 1); + parent.set_age_weight(age_group_35_to_59, 1); // Two-person household with one parent and one child. auto twoPersonHousehold_group = mio::abm::HouseholdGroup(); @@ -152,10 +152,10 @@ int main() person.set_assigned_location(hospital); person.set_assigned_location(icu); //assign work/school to people depending on their age - if (person.get_age() == age_groups_5_to_14) { + if (person.get_age() == age_group_5_to_14) { person.set_assigned_location(school); } - if (person.get_age() == age_groups_15_to_34 || person.get_age() == age_groups_35_to_59) { + if (person.get_age() == age_group_15_to_34 || person.get_age() == age_group_35_to_59) { person.set_assigned_location(work); } } diff --git a/cpp/simulations/abm.cpp b/cpp/simulations/abm.cpp index 496e9adfd4..20a3240904 100644 --- a/cpp/simulations/abm.cpp +++ b/cpp/simulations/abm.cpp @@ -29,12 +29,12 @@ namespace fs = boost::filesystem; // Assign the name to general age group. size_t num_age_groups = 6; -const auto age_group_0_to_4 = mio::AgeGroup(num_age_groups - 6); -const auto age_group_5_to_14 = mio::AgeGroup(num_age_groups - 5); -const auto age_group_15_to_34 = mio::AgeGroup(num_age_groups - 4); -const auto age_group_35_to_59 = mio::AgeGroup(num_age_groups - 3); -const auto age_group_60_to_79 = mio::AgeGroup(num_age_groups - 2); -const auto age_group_80_plus = mio::AgeGroup(num_age_groups - 1); +const auto age_group_0_to_4 = mio::AgeGroup(0); +const auto age_group_5_to_14 = mio::AgeGroup(1); +const auto age_group_15_to_34 = mio::AgeGroup(2); +const auto age_group_35_to_59 = mio::AgeGroup(3); +const auto age_group_60_to_79 = mio::AgeGroup(4); +const auto age_group_80_plus = mio::AgeGroup(5); /** * Set a value and distribution of an UncertainValue. diff --git a/cpp/simulations/abm_braunschweig.cpp b/cpp/simulations/abm_braunschweig.cpp index 734f0e7ae9..d56b9d6ec4 100644 --- a/cpp/simulations/abm_braunschweig.cpp +++ b/cpp/simulations/abm_braunschweig.cpp @@ -34,12 +34,12 @@ namespace fs = boost::filesystem; // Assign the name to general age group. size_t num_age_groups = 6; -const auto age_group_0_to_4 = mio::AgeGroup(num_age_groups - 6); -const auto age_group_5_to_14 = mio::AgeGroup(num_age_groups - 5); -const auto age_group_15_to_34 = mio::AgeGroup(num_age_groups - 4); -const auto age_group_35_to_59 = mio::AgeGroup(num_age_groups - 3); -const auto age_group_60_to_79 = mio::AgeGroup(num_age_groups - 2); -const auto age_group_80_plus = mio::AgeGroup(num_age_groups - 1); +const auto age_group_0_to_4 = mio::AgeGroup(0); +const auto age_group_5_to_14 = mio::AgeGroup(1); +const auto age_group_15_to_34 = mio::AgeGroup(2); +const auto age_group_35_to_59 = mio::AgeGroup(3); +const auto age_group_60_to_79 = mio::AgeGroup(4); +const auto age_group_80_plus = mio::AgeGroup(5); /** * Set a value and distribution of an UncertainValue. diff --git a/cpp/tests/abm_helpers.h b/cpp/tests/abm_helpers.h index f6721455ee..787b4cadde 100644 --- a/cpp/tests/abm_helpers.h +++ b/cpp/tests/abm_helpers.h @@ -31,12 +31,12 @@ // Assign the name to general age group. const size_t num_age_groups = 6; -const auto age_group_0_to_4 = mio::AgeGroup(num_age_groups - 6); -const auto age_group_5_to_14 = mio::AgeGroup(num_age_groups - 5); -const auto age_group_15_to_34 = mio::AgeGroup(num_age_groups - 4); -const auto age_group_35_to_59 = mio::AgeGroup(num_age_groups - 3); -const auto age_group_60_to_79 = mio::AgeGroup(num_age_groups - 2); -const auto age_group_80_plus = mio::AgeGroup(num_age_groups - 1); +const auto age_group_0_to_4 = mio::AgeGroup(0); +const auto age_group_5_to_14 = mio::AgeGroup(1); +const auto age_group_15_to_34 = mio::AgeGroup(2); +const auto age_group_35_to_59 = mio::AgeGroup(3); +const auto age_group_60_to_79 = mio::AgeGroup(4); +const auto age_group_80_plus = mio::AgeGroup(5); /** * mock of the generator function of DistributionAdapter. From c168549a9c79f461a618d244185ecfe42176a834 Mon Sep 17 00:00:00 2001 From: Khoa Nguyen <4763945+khoanguyen-dev@users.noreply.github.com> Date: Mon, 18 Dec 2023 17:09:57 +0100 Subject: [PATCH 4/4] Add check to all functions that use AgeGroup as parameters --- cpp/models/abm/household.h | 1 + cpp/models/abm/infection.cpp | 4 ++++ cpp/models/abm/location.cpp | 1 + cpp/models/abm/testing_strategy.cpp | 1 + cpp/tests/abm_helpers.cpp | 2 ++ 5 files changed, 9 insertions(+) diff --git a/cpp/models/abm/household.h b/cpp/models/abm/household.h index 50b46d6cab..c379e7364b 100644 --- a/cpp/models/abm/household.h +++ b/cpp/models/abm/household.h @@ -68,6 +68,7 @@ class HouseholdMember */ void set_age_weight(mio::AgeGroup age_group, int weight) { + assert((size_t)age_group.size < m_age_weights.numel()); m_age_weights[age_group] = weight; } diff --git a/cpp/models/abm/infection.cpp b/cpp/models/abm/infection.cpp index 1783942764..cf7fc2e15b 100644 --- a/cpp/models/abm/infection.cpp +++ b/cpp/models/abm/infection.cpp @@ -32,6 +32,7 @@ Infection::Infection(Person::RandomNumberGenerator& rng, VirusVariant virus, Age : m_virus_variant(virus) , m_detected(detected) { + assert((size_t)age.size < (size_t)params.get_num_groups()); m_viral_load.start_date = draw_infection_course(rng, age, params, init_date, init_state, latest_exposure); auto vl_params = params.get()[{virus, age}]; @@ -115,6 +116,7 @@ TimePoint Infection::draw_infection_course(Person::RandomNumberGenerator& rng, A TimePoint init_date, InfectionState init_state, std::pair latest_protection) { + assert((size_t)age.size < (size_t)params.get_num_groups()); TimePoint start_date = draw_infection_course_backward(rng, age, params, init_date, init_state); draw_infection_course_forward(rng, age, params, init_date, init_state, latest_protection); return start_date; @@ -124,6 +126,7 @@ void Infection::draw_infection_course_forward(Person::RandomNumberGenerator& rng const Parameters& params, TimePoint init_date, InfectionState start_state, std::pair latest_exposure) { + assert((size_t)age.size < (size_t)params.get_num_groups()); auto t = init_date; TimeSpan time_period{}; // time period for current infection state InfectionState next_state{start_state}; // next state to enter @@ -211,6 +214,7 @@ TimePoint Infection::draw_infection_course_backward(Person::RandomNumberGenerato const Parameters& params, TimePoint init_date, InfectionState init_state) { + assert((size_t)age.size < (size_t)params.get_num_groups()); auto start_date = init_date; TimeSpan time_period{}; // time period for current infection state InfectionState previous_state{init_state}; // next state to enter diff --git a/cpp/models/abm/location.cpp b/cpp/models/abm/location.cpp index fef7fe0594..e53310d2d9 100644 --- a/cpp/models/abm/location.cpp +++ b/cpp/models/abm/location.cpp @@ -58,6 +58,7 @@ Location Location::copy_location_without_persons(size_t num_agegroups) ScalarType Location::transmission_contacts_per_day(uint32_t cell_index, VirusVariant virus, AgeGroup age_receiver, size_t num_agegroups) const { + assert((size_t)age_receiver.size < num_agegroups); ScalarType prob = 0; for (uint32_t age_transmitter = 0; age_transmitter != num_agegroups; ++age_transmitter) { prob += m_cells[cell_index].m_cached_exposure_rate_contacts[{virus, static_cast(age_transmitter)}] * diff --git a/cpp/models/abm/testing_strategy.cpp b/cpp/models/abm/testing_strategy.cpp index 1f82bdadc7..33bcf3ede5 100644 --- a/cpp/models/abm/testing_strategy.cpp +++ b/cpp/models/abm/testing_strategy.cpp @@ -43,6 +43,7 @@ bool TestingCriteria::operator==(const TestingCriteria& other) const void TestingCriteria::add_age_group(const AgeGroup age_group) { + m_ages.insert(static_cast(age_group)); } diff --git a/cpp/tests/abm_helpers.cpp b/cpp/tests/abm_helpers.cpp index e2d3176560..98a3a12dab 100644 --- a/cpp/tests/abm_helpers.cpp +++ b/cpp/tests/abm_helpers.cpp @@ -25,6 +25,7 @@ mio::abm::Person make_test_person(mio::abm::Location& location, mio::AgeGroup ag mio::abm::InfectionState infection_state, mio::abm::TimePoint t, mio::abm::Parameters params) { + assert((size_t)age.size < (size_t)params.get_num_groups()); auto rng = mio::RandomNumberGenerator(); mio::abm::Person p = mio::abm::Person(rng, location, age); if (infection_state != mio::abm::InfectionState::Susceptible) { @@ -38,6 +39,7 @@ mio::abm::Person make_test_person(mio::abm::Location& location, mio::AgeGroup ag mio::abm::Person& add_test_person(mio::abm::World& world, mio::abm::LocationId loc_id, mio::AgeGroup age, mio::abm::InfectionState infection_state, mio::abm::TimePoint t) { + assert((size_t)age.size < (size_t)world.parameters.get_num_groups()); mio::abm::Person& p = world.add_person(loc_id, age); if (infection_state != mio::abm::InfectionState::Susceptible) { auto rng_p = mio::abm::Person::RandomNumberGenerator(world.get_rng(), p);