xquercus / load-balanced-scheduler

GNU General Public License v3.0
10 stars 9 forks source link

Load Balanced Scheduler

Load Balanced Scheduler is an Anki add-on which helps maintain a consistent number of reviews from one day to another. Intervals are chosen from the same range as stock Anki so as not to affect the SRS algorithm. It is compatible with:

Installation

To install follow the instructions on the AnkiWeb add-ons page.

Configuration

No configuration is required however logging can be enabled. This is done by setting LOG_LEVEL at the top of load_balanced_scheduler.py. The following options are available:

Logs are sent to stdout. On some systems (e.g. Windows) Anki doesn't direct stdout anywhere useful. On these systems Le Petit Debugger can be used to view the log output.

Details

After a card is reviewed, Anki assigns it the interval shown on the ease button selected by the user. This new interval is further modified as described in the Anki manual:

After you select an ease button, Anki also applies a small amount of random “fuzz” to prevent cards that were introduced at the same time and given the same ratings from sticking together and always coming up for review on the same day. This fuzz does not appear on the interval buttons, so if you’re noticing a slight discrepancy between what you select and the intervals your cards actually get, this is probably the cause.

Image Image

The above plots show the possible "fuzzed" intervals Anki may assign given a particular interval. Looking at the second plot as an example, if the users selects an ease button with an interval of 10 days, Anki will randomly assign a "fuzzed" interval between 8 and 12 days. Load Balanced Scheduler uses this same range of between 8 and 12 but, instead of selecting at random, will choose an interval with the least number of cards due.

Cards with small intervals will be load balanced over a narrow range. For example, cards with an interval of 3 will be load balanced over days 2-4. This range expands as the interval increases. Cards with an interval of 15 will be balanced over days 13-17 and cards with an interval of 30 will be balanced over days 26-34. Again, these are the same ranges stock Anki uses when randomly assigning intervals. The exact ranges can be seen here in the Anki source.

Bugs and Support

If you encounter a bug or need support please see the official README. Please report bugs through github. Please don't use the review section of the AnkiWeb add-on page for support as I won't receive a notification and there is no way for me to respond.

Known Issues

Failed cards aren't getting load balanced.

This is expected behavior. Load Balanced Scheduler balances cards that stock Anki would "fuzz". Anki doesn't "fuzz" failed cards when they move back into the review queue so they are not load balanced. Additionally, while this would be easy to add, it would patch core parts of the v2 scheduler which is still in development. It's not worth putting scheduling at risk if there is a silent failure. The "fuzz" function itself has been very stable over time.

Under the experimental v2 scheduler logs show multiple intervals being calculated for the same card.

This is expected behavior. Anki calculates intervals before checking which ease button the user actually pressed. See this function in schedv2.py if you want to explore more. The end result is that for a NORMAL card the log will show calculated intervals for HARD and NORMAL. For an EASY cards the log will show calculated intervals for HARD, NORMAL and EASY. In the end, the last interval shown in the log is the one Anki assigns to the card.

Credits

Thank you to Jake Probst for the Load Balancer add-on. I used and abused that thing for a long time.

Revision History