What is the problem?
Because we eliminate all tied candidates at once, we should make pretty certain they really are tied before eliminating them all.
Before eliminating tied candidates we should check that either:
- None of the tied candidates have a chance of winning, or
- There are no more votes to transfer
In case 1, we can treat the candidates as tied. Even if one tied candidate could in theory overtake another tied candidate, they still would not win.
We already do case 1 to some extent now, but we do it differently than OpenSTV. See below.
In case 2, we know none of the tied candidates can overtake any of the others, so we are sure they are equal.
- How do we calculate when tied candidates have no chance of winning?
OpenSTV does number of votes * number of tied candidates + surplus. So 2 tied candidates with 50 votes would need to be more than 100 + surplus behind the second lowest candidate to be eliminated (ref).
SecurePoll does number of votes + surplus. So 2 tied candidates with 50 votes would need to be more than 50 + surplus behind the second lowest candidate to be eliminated.
I guess the logic behind OpenSTV's calculation is whether it would be possible for one of the tied candidates to win if the rest of the tied candidates were eliminated.
In our case, I guess we are checking whether it would be possible for all the tied candidates to win simultaneously. But, this assumes that all the tied candidates really are tied, and we only know they are tied when we get to case 2.
- How do we decide when there are no more votes to transfer?
OpenSTV does it when the current round's surplus equals last rounds surplus, i.e. no change in surplus between 2 rounds (ref).
I think this becomes important when all the remaining hopeful candidates are tied. There is no second lowest vote to catch up to, so we just need to make sure that the remaining tied candidates really are tied (i.e. there are no more votes to transfer).
Currently, in the case where all remaining candidates are tied, I believe SecurePoll eliminates them all immediately.
Steps to reproduce problem