mrc-ide / covid-sim

This is the COVID-19 CovidSim microsimulation model developed by the MRC Centre for Global Infectious Disease Analysis hosted at Imperial College, London.
GNU General Public License v3.0
1.23k stars 257 forks source link

Use better if-else-elseif flow for model CalibIteration #421

Closed zlatanvasovic closed 4 years ago

zlatanvasovic commented 4 years ago

It's all only refactoring, except this one:

if ((P.ModelCalibIteration >= 2) && ((((RatioPredictedObserved - 1.0) <= DesiredAccuracy) && (RatioPredictedObserved >= 1)) || (((1.0 - RatioPredictedObserved) <= DesiredAccuracy) && (RatioPredictedObserved < 1))))
  P.StopCalibration = 1;

Based on my understanding, what it is trying to achieve is equivalent to:

if (abs((RatioPredictedObserved - 1.0) <= DesiredAccuracy)) {
  P.StopCalibration = 1;
}

Edit: tests failed with that change, so I reverted it.

weshinsley commented 4 years ago

This has been part-implemented, and part-changed by Neil's recent work on PR #430