Reduce time required to form non-daily habits; smooth out irregular schedules

This commit is contained in:
2020-09-15 22:12:44 -05:00
parent ef186d55c6
commit 20142d5f94
4 changed files with 99 additions and 26 deletions

View File

@@ -63,7 +63,7 @@ public final class Score
double previousScore,
double checkmarkValue)
{
double multiplier = pow(0.5, frequency / 13.0);
double multiplier = pow(0.5, sqrt(frequency) / 13.0);
double score = previousScore * multiplier;
score += checkmarkValue * (1 - multiplier);

View File

@@ -275,6 +275,15 @@ public abstract class ScoreList implements Iterable<Score>
final double freq = habit.getFrequency().toDouble();
final int[] checkmarkValues = habit.getCheckmarks().getValues(from, to);
// For non-daily boolean habits, we double the numerator and the denominator to smooth
// out irregular repetition schedules (for example, weekly habits performed on different
// days of the week)
if (!habit.isNumerical() && freq < 1.0)
{
numerator *= 2;
denominator *= 2;
}
List<Score> scores = new LinkedList<>();
for (int i = 0; i < checkmarkValues.length; i++)