Skip to content

Commit 44ff6cc

Browse files
committed
small changes
1 parent fc4f9a8 commit 44ff6cc

3 files changed

Lines changed: 84 additions & 96 deletions

File tree

cpp-tutorials/abm/tutorial_abm_testing.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ int main(int argc, char* argv[])
150150
auto single_adult = mio::abm::HouseholdMember(num_age_groups);
151151
single_adult.set_age_weight(age_group_35_to_59, 1);
152152

153+
// senior: equally likely to be 60-79 or 80+ years old.
153154
auto senior_adult = mio::abm::HouseholdMember(num_age_groups);
154155
senior_adult.set_age_weight(age_group_60_to_79, 1);
155156
senior_adult.set_age_weight(age_group_80_plus, 1);
@@ -181,6 +182,10 @@ int main(int argc, char* argv[])
181182
auto singleAdultHousehold = mio::abm::Household();
182183
singleAdultHousehold.add_members(single_adult, 1);
183184

185+
auto singleAdultGroup = mio::abm::HouseholdGroup();
186+
singleAdultGroup.add_households(singleAdultHousehold, n_households);
187+
add_household_group_to_model(model, singleAdultGroup);
188+
184189
// --- Type D: Senior & ELderly household (2 adult, no children) ---------------
185190
auto seniorAdultHousehold = mio::abm::Household();
186191
seniorAdultHousehold.add_members(senior_adult, 2);
@@ -217,17 +222,17 @@ int main(int argc, char* argv[])
217222
//
218223
// Index | InfectionState | Probability
219224
// ------|-------------------------|------------
220-
// 0 | Susceptible | 0.80
221-
// 1 | Exposed | 0.10
222-
// 2 | InfectedNoSymptoms | 0.01
223-
// 3 | InfectedSymptoms | 0.01
224-
// 4 | InfectedSevere | 0.01
225-
// 5 | InfectedCritical | 0.01
226-
// 6 | Recovered | 0.00
227-
// 7 | Dead | 0.06
225+
// 0 | Susceptible | 0.8
226+
// 1 | Exposed | 0.05
227+
// 2 | InfectedNoSymptoms | 0.1
228+
// 3 | InfectedSymptoms | 0.05
229+
// 4 | InfectedSevere | 0.0
230+
// 5 | InfectedCritical | 0.0
231+
// 6 | Recovered | 0.0
232+
// 7 | Dead | 0.0
228233
auto start_date = mio::abm::TimePoint(0); // t = 0 s from the simulation epoch
229234

230-
std::vector<ScalarType> infection_distribution{0.8, 0.05, 0.1, 0.05, 0.00, 0.00, 0.00, 0.00};
235+
std::vector<ScalarType> infection_distribution{0.8, 0.05, 0.1, 0.05, 0.0, 0.0, 0.0, 0.0};
231236

232237
for (auto& person : model.get_persons()) {
233238
// Draw an infection state from the distribution above.

0 commit comments

Comments
 (0)