What is the problem?
There are circumstances in which a candidate can be declared elected in one round but not be considered elected in a later round.
The declareWinners() method calculates the winners from scratch each time. In one round, if we have calculated the keep factor for a previously elected candidate in such a way that they have fewer votes than the quota, they will not be considered elected.
I can see at least two possible solutions:
- Don't recalculate winners from scratch each round. For example, have an array of winners which we append to. declareWinners() only looks at candidates who are not already in this array. I think this is something OpenSTV does (see here).
- Do some mathematical magic to make sure elected candidates are always declared elected by declareWinners(). This might be harder. Also, according to 2.9 in meekm.pdf, calculation of the keep factor can put elected candidates votes below the quota.
See T290027#7379765 for an example of where this is happening, where it leads to infinite recursion/iteration.
blt files to reproduce problem
Wiki(s): SecurePoll 3.0.0 (dcbad8c) 06:35, 27 September 2021.