I've been asked by my employer to create an online voting system for internal elections (e.g. board of directors). Our bylaws dictate that we need to use STV.
I wasn't satisfied with the existing software available for counting STV elections, so I rolled my own. Here's how it works:
- Shuffle the ballots.
- Assign highest-preference votes
- If the highest-preference candidate has already met the quota, and there aren't enough winners yet, use the ballot's next-highest preference.
- If the highest-preference candidate came last in the previous round, use the ballot's next-highest preference.
- If a ballot's next-highest preference was used, that becomes the "highest preference" in the next round.
- Repeat steps 1-3 until there are enough winners.
Here it is in flowchart form:
After doing some reading on different counting methods (this comparison [PDF] has proven to be very helpful), I realize that my counting doesn't really fit within the established methods. Here are some of its characteristics:
- Randomisation is achieved by shuffling all ballots at the beginning of each round, then processing each ballot in sequence.
- Surplus votes start getting allocated in the middle of the round, as soon as a candidate reaches quota.
- Surplus votes are allocated to all candidates, not just hopefuls. This means that a candidate who came last in the first round could "come back from the dead". It also means candidates that have already achieved quota could get a few extra votes later on in the round.
- I use the Cincinnatti method for allocating surplus (a random sample of all ballots), rather than the Irish method.
- Since the random sample is different for each round, recounts may produce slightly different results
- Unlike the Wright method, candidates are never definitively excluded.
To be honest, I don't really know if these qualities are good or bad – do they make my method susceptible to vote-rigging? Is it less proportional than another method?
Please let me know what you see as the pros and cons of this counting method. Personally, I think it's easier to understand than the other methods I've come across – but that also means it's probably less robust!
Edit: Here's a sample vote count for an election with 10 candidates competing for 5 seats. 1000 ballots were cast. The Quota is 167.
Delilah receives the fewest first-preference votes. So, in the second round, Delilah is crossed off those 85 ballots and the second preferences are counted.
Greg has the lowest number of votes in round 2, and the same happens to those 105 ballots in the next round. 11 of those happen to have Delilah as their second choice.