@@ -211,22 +211,21 @@ TEST(IdeSecir, checkStartTime)
211211}
212212
213213// Check results of our simulation with an example calculated by hand,
214- // for calculations see internal Overleaf document.
215- // TODO: Add link to material when published.
214+ // see https://doi.org/10.1016/j.amc.2025.129636 for the used formulas.
216215TEST (IdeSecir, checkSimulationFunctions)
217216{
218217 using Vec = mio::TimeSeries<ScalarType>::Vector;
219218 size_t num_agegroups = 1 ;
220219 ScalarType tmax = 0.5 ;
220+ ScalarType dt = 0.5 ;
221+
221222 mio::CustomIndexArray<ScalarType, mio::AgeGroup> N =
222223 mio::CustomIndexArray<ScalarType, mio::AgeGroup>(mio::AgeGroup (num_agegroups), 10000 .);
223224 mio::CustomIndexArray<ScalarType, mio::AgeGroup> deaths =
224225 mio::CustomIndexArray<ScalarType, mio::AgeGroup>(mio::AgeGroup (num_agegroups), 10 .);
225- ScalarType dt = 0.5 ;
226-
227- int num_transitions = (int )mio::isecir::InfectionTransition::Count;
228226
229227 // Create TimeSeries with num_transitions elements where transitions needed for simulation will be stored.
228+ int num_transitions = (int )mio::isecir::InfectionTransition::Count;
230229 mio::TimeSeries<ScalarType> init (num_transitions * num_agegroups);
231230
232231 // Add time points for initialization for transitions and death.
@@ -274,26 +273,26 @@ TEST(IdeSecir, checkSimulationFunctions)
274273 mio::TimeSeries<ScalarType> secihurd_simulated = sim.get_result ();
275274 mio::TimeSeries<ScalarType> transitions_simulated = sim.get_transitions ();
276275
277- // Define vectors for compartments and transitions with values from example
278- // (calculated by hand, see internal Overleaf document ).
279- // TODO: Add link to material when published.
280- Vec secihurd0 ((int )mio::isecir::InfectionState::Count);
281- Vec secihurd1 (( int )mio::isecir::InfectionState::Count );
282- Vec transitions1 (num_transitions) ;
283- secihurd0 << 4995 , 0.5 , 0 , 4 , 0 , 0 , 4990.5 , 10 ;
284- secihurd1 << 4994.00020016 , 0.49989992 , 0.49994996 , 0.12498749 , 1.03124687 , 0.25781172 , 4993.45699802 , 10.12890586 ;
285- transitions1 << 0.99979984 , 0.99989992 , 0.24997498 , 0.24997498 , 2.06249374 , 2.06249374 , 0.51562344 , 0.51562344 ,
276+ // Define vectors for compartments and transitions at t0 and t1 with values from example
277+ // (calculated by hand, see https://doi.org/10.1016/j.amc.2025.129636 for the used formulas ).
278+ Vec secihurd_t0 (( int )mio::isecir::InfectionState::Count);
279+ Vec secihurd_t1 ((int )mio::isecir::InfectionState::Count);
280+ Vec transitions_t1 (num_transitions );
281+ secihurd_t0 << 4995 , 0.5 , 0 , 4 , 0 , 0 , 4990.5 , 10 ;
282+ secihurd_t1 << 4994.00020016 , 0.49989992 , 0.49994996 , 0.12498749 , 1.03124687 , 0.25781172 , 4993.45699802 ,
283+ 10.12890586 ;
284+ transitions_t1 << 0.99979984 , 0.99989992 , 0.24997498 , 0.24997498 , 2.06249374 , 2.06249374 , 0.51562344 , 0.51562344 ,
286285 0.12890586 , 0.12890586 ;
287286
288- // Compare SECIHURD compartments at times 0 and 1 .
287+ // Compare simulated compartments at time points t0 and t1 .
289288 for (Eigen::Index i = 0 ; i < (Eigen::Index)mio::isecir::InfectionState::Count; i++) {
290- EXPECT_NEAR (secihurd_simulated[0 ][i], secihurd0 [i], 1e-8 );
291- EXPECT_NEAR (secihurd_simulated[1 ][i], secihurd1 [i], 1e-8 );
289+ EXPECT_NEAR (secihurd_simulated[0 ][i], secihurd_t0 [i], 1e-8 );
290+ EXPECT_NEAR (secihurd_simulated[1 ][i], secihurd_t1 [i], 1e-8 );
292291 }
293292
294- // Compare transitions at time 1 .
293+ // Compare simulated transitions with expected results at time point t1 .
295294 for (Eigen::Index i = 0 ; i < num_transitions; i++) {
296- EXPECT_NEAR (transitions_simulated[transitions_simulated.get_num_time_points () - 1 ][i], transitions1 [i], 1e-8 );
295+ EXPECT_NEAR (transitions_simulated[transitions_simulated.get_num_time_points () - 1 ][i], transitions_t1 [i], 1e-8 );
297296 }
298297}
299298
0 commit comments