Skip to content
Snippets Groups Projects

Bringing Bart's recent changes into the inequality branch

3 files
+ 8
8
Compare changes
  • Side-by-side
  • Inline

Files

@@ -39,10 +39,9 @@ public class DietParamCalculationManager {
}
private double interpolateParam(int year, double initialParam, double shiftParam) {
double ratio = (double) (year - ModelConfig.DIET_CHANGE_START_YEAR) /
(ModelConfig.DIET_CHANGE_END_YEAR - ModelConfig.DIET_CHANGE_START_YEAR);
ratio = Math.min(Math.max(ratio, 0), 1);
double offset = (ModelConfig.DIET_CHANGE_END_YEAR - ModelConfig.DIET_CHANGE_START_YEAR) / 2.0;
double x = year - ModelConfig.DIET_CHANGE_START_YEAR;
double ratio = 1 / (1 + Math.exp(-ModelConfig.DIET_CHANGE_RATE * (x - offset))); // sigmoid
return ratio * shiftParam + (1 - ratio) * initialParam;
}
Loading