You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
958 implement a check for the results of the initialization (#959)
- Optimization of IDE SECIR initialization to avoid overwriting of beforehand set values.
- Check and return of initialization could be conducted properly.
- Added unit tests to check_constraints() function to increase code coverage.
Co-authored-by: annawendler <106674756+annawendler@users.noreply.github.com>
Co-authored-by: Martin J. Kühn <62713180+mknaranja@users.noreply.github.com>
log_error("Error occured while initializing compartments: Force of infection is evaluated to 0 and neither "
129
134
"Susceptibles nor Recovered or total confirmed cases for time 0 were set. One of them should be "
130
135
"larger 0.");
131
136
}
132
137
}
133
-
// compute m_forceofinfection at time 0 needed for further simulation
138
+
139
+
// Verify that the initialization produces an appropriate result.
140
+
// Another check would be if the sum of the compartments is equal to N, but in all initialization methods one of the compartments is initialized via N - the others.
141
+
// This also means that if a compartment is greater than N, we will always have one or more compartments less than zero.
142
+
// Check if all compartments are non negative.
143
+
for (int i = 0; i < (int)InfectionState::Count; i++) {
144
+
if (m_populations[0][i] < 0) {
145
+
m_initialization_method = -2;
146
+
log_error("Initialization failed. One or more initial values for populations are less than zero. It may "
147
+
"help to use a different method for initialization.");
148
+
}
149
+
}
150
+
151
+
// Compute m_forceofinfection at time 0 needed for further simulation.
0 commit comments