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:

  1. Shuffle the ballots.
  2. 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.
  3. If a ballot's next-highest preference was used, that becomes the "highest preference" in the next round.
  4. Repeat steps 1-3 until there are enough winners.

Here it is in flowchart form:

Flowchart interpretation of the counting process 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.

enter image description here

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.

  • For clarity, I'm using the Droop formula to calculate the quota. – Sam Nabi Apr 7 '17 at 20:35
  • 1
    If "bylaws dictate that we need to use STV", don't you have to use STV? Not make up your own counting system? – endolith Apr 7 '17 at 23:13
  • 2
    @endolith there are many many ways to count votes within STV, and our bylaws don't specify the counting method. – Sam Nabi Apr 8 '17 at 16:45
  • 1
    Why reinvent the wheel? Why not use on of the STV-PR on-line systems that is already available? – James Gilmour Apr 10 '17 at 9:24

I think the fact that you never eliminate candidates could be a problem - in same cases you won't even get a result.

Let's say you have 10 candidates trying for 5 slots, and 1000 votes. Each candidate gets between 50-150 votes. But 150 is less then the quota (using the Droop method, the quota would be 1000/[5+1] + 1 = 167) Nobody meets the quota - so how do you determine who wins? In most systems, you'd eliminate the weakest candidate and transfer his votes (and either that puts someone over the quota and you can transfer some other votes, or you keep eliminating candidates until the number of candidates equals the number of seats), but in your system that's not done. Your flowchart would just loop endlessly, counting and re-counting forever.

I'd also point out that, since candidates are never eliminated in your system, if you vote as your first choice a candidate who is not eventually elected, then your second choice will never be counted. I think this goes against the intent of single-transfer voting. I think eliminating a particularly weak candidate actually does a favor to those who voted for that candidate, as it ensures the transfer will kick in.

On another note, I really don't like any randomness in the system. Outcomes should be determined by votes, not by the shuffling algorithm of your software.

  • "if you vote as your first choice a candidate who is not eventually elected, then your second choice will never be counted." - not quite. If your first choice gets crossed off your ballot, then the next choice will be counted. Typically 60-70% of votes elect a winner in the datasets I've tested with. – Sam Nabi Apr 8 '17 at 17:35
  • " Nobody meets the quota - so how do you determine who wins?" - good catch. The flowchart oversimplifies this, so actually if the number of seats equals the number of candidates with non-zero vote counts, they are all declared winners. That means they might have less than the quota. – Sam Nabi Apr 8 '17 at 17:40
  • "if the number of seats equals the number of candidates with non-zero vote counts, they are all declared winners." - but in my scenario, you have 10 candidates with non-zero vote counts and only 5 seats, so that still doesn't kick in. – D M Apr 9 '17 at 4:20
  • 3
    And if there's more to your system than you told us - well, that kind of makes it hard for us to evaluate your system, now doesn't it? :) – D M Apr 9 '17 at 4:21
  • 1
    What you're doing in the table looks reasonable at first glance, but you may want to put it into words and/or the flowchart. If you can't put the entire process into words, it may not be a good idea to use it in an important election. – D M Apr 10 '17 at 6:35

The biggest problem that I see with this is that it is possible to get different results in a recount. So I would never recommend it for a government election. You'd have politicians trying to game the system to get the "right" recount.

One might argue that there are often random tiebreakers, but these operate at the end of the process. So everyone can agree on the recount up to the tiebreaker. Then there is one single random event that they can record. So if the recount has the same result, they can keep the original tiebreaker.

To get a similar result here, you would have to pick the entire random sequence. This is possible. You could randomly pick a seed for a particular pseudorandom algorithm and preserve that choice. But I'm not sure that doing that leaves the system any easier to explain than the other methods. It has a big element of "trust me, I did the random stuff correctly" in it.

  • I've tested this with a few different datasets, and I haven't come across a situation where a recount results in different winners. Of course I will need to do more testing to make sure. But if this pattern holds true, are you still concerned about the randomness involved? (e.g. Each recount takes a different path to arrive at the same result.) – Sam Nabi Apr 8 '17 at 16:48
  • 1
    Yes, it would still be a problem. Characteristics of an electoral system need to be proven mathematically, not statistically. Edge cases that are highly improbable will happen sometime in the centuries and you just need to be sure. Statistics can be useful to research a system, but in the end you'll need formal proofs for any property you want to advertise. – Rad80 Nov 14 '18 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.