Model rules for a computerised STV election using the weighted inclusive Gregory method
OpenTally is open-source software for counting single transferable vote (STV) elections. The default preset in OpenTally is ‘OpenTally WIGM’, a recommended set of simple STV rules designed for computer counting, using the weighted inclusive Gregory method, exact quotas and rational arithmetic.
The weighted inclusive Gregory method (WIGM) is generally regarded as the fairest method of distributing surplus votes in STV elections (excepting the more computationally expensive Meek method) – for a discussion, see for example [1]. In Australia, elections to the Western Australia Legislative Council and New South Wales local government now use WIGM. In Scotland, WIGM has been used for local government elections since 2007.
However, intermediate results in STV counts are frequently rounded for ease of computation. Quotas are typically rounded to integers, but it is known that such rounding (of any degree) can adversely affect the results and lead to proportionality failure. It has therefore been suggested that the quota not be rounded, and candidates be declared elected only on strictly exceeding the quota – see for example [2–3]. Rounding at other aspects of the count can be eliminated by the use of rational arithmetic, where numbers are represented exactly as fractions without rounding [2]. However, despite the advantages of these modifications, they are not commonly implemented.
To assist with the implementation of these modifications, we therefore present below model rules for an STV count using the ‘OpenTally WIGM’ rules. These rules are licensed under the Creative Commons Attribution-ShareAlike 4.0 International licence.
Model rules
1 Interpretation
(1) In these rules—
ballot paper means a record of a voter's preferences, with an associated value;
continuing candidate means a candidate who is neither elected nor excluded;
end of a stage: see rules 2(4) and 3(5);
progress total: a candidate's progress total means the sum of the values of all ballot papers allocated to the candidate.
(2) Whenever a calculation needs to be performed, the calculation must be performed without rounding, and the result represented exactly, as a fraction if necessary.
2 First stage
(1) Allocate every formal ballot paper, at a value of 1, to its first-preference candidate.
(2) Calculate the quota as the total number of formal ballot papers, divided by one more than the number of vacancies.
(3) Declare elected any continuing candidate whose progress total is greater than the quota, one by one in descending order of progress total, breaking any tie as described in rule 3(2)(a).
(4) This is regarded as the ‘end of a stage’.
3 Second or subsequent stages
(1) If no more vacancies remain to be filled, the count is complete.
(2) If subrule (1) does not apply, and one or more candidates have progress totals greater than the quota, then—
(a) identify the candidate with the highest progress total, but if there is a tie for highest—
(i) identify the tied candidate who had the highest progress total at the end of the previous stage, breaking any further tie by referring to successive previous stages; and
(ii) if the tie cannot be so broken, the Returning Officer must break the tie by lot;
(b) calculate the surplus fraction as the candidate's progress total, minus the quota, all divided by the candidate's progress total;
(c) for each of the candidate's ballot papers, multiply the value of the ballot paper by the surplus fraction, and reallocate it at that new value to the continuing candidate now highest on its preferences (if such a candidate exists);
(d) declare elected any continuing candidate whose progress total is greater than the quota, one by one in descending order of progress total, breaking any tie as described in subrule (2)(a).
(3) If subrules (1)–(2) do not apply, and the number of continuing candidates equals the number of remaining vacancies, declare elected all continuing candidates, one by one in descending order of progress total, breaking any tie as described in subrule (2)(a).
(4) If subrules (1)–(3) do not apply, then—
(a) identify the continuing candidate with the lowest progress total, but if there is a tie for lowest—
(i) identify the tied candidate who had the lowest progress total at the end of the previous stage, breaking any further tie by referring to successive previous stages; and
(ii) if the tie cannot be so broken, the Returning Officer must break the tie by lot;
(b) declare the candidate excluded;
(c) for each of the candidate's ballot papers, reallocate it to the continuing candidate now highest on its preferences (if such a candidate exists);
(d) declare elected any continuing candidate whose progress total is greater than the quota, one by one in descending order of progress total, breaking any tie as described in subrule (2)(a).
(5) This is regarded as the ‘end of a stage’.
(6) Repeat subrules (1) to (6) until no more vacancies remain to be filled.
Other matters to be provided for
The model rules above do not make provision for determining the formality of ballots cast. For a fully optional preferential voting election, we present the following provision:
xx Formality of ballots cast
For each position in the election, a vote is formal to the extent that it indicates a consecutive sequence of preferences (of any length, including only a single preference) beginning with a number 1 preference, with no duplicate or skipped preferences.
Note: A vote may be partly formal, and therefore partly accepted – formal up to a certain point, and informal thereafter.
Example 1: If a vote contains multiple number 1 preferences, it is informal in its entirety.
Example 2: If a vote contains duplicate numbers, it is formal up to (but not including) the first duplicated number, and informal thereafter.
Example 3: If a vote contains skipped numbers, it is formal up to (but not including) the first skipped number, and informal thereafter.
This rule is based on the Australian Electoral Commission's ballot paper formality guidelines.
The model rules are designed so that the order of election and exclusion is well-defined, and it is therefore straightforward to adapt them if constraints are required. If constraints are required to be implemented, using the OpenTally algorithm (see [4–5]), we present the following provision:
xx Application of constraints
(1) The modifications in this rule apply to an election for [describe constrained election].
(2) Rule 1(1) applies as if the definition of continuing candidate read—
continuing candidate means a candidate who is neither elected, excluded nor doomed;
(3) Before the first stage, and each time a candidate is declared elected or excluded—
(a) immediately classify as guarded any continuing candidate who must eventually be elected if the result is to comply with [constraint provision]; and
(b) immediately classify as doomed any continuing candidate who must not be elected if the result is to comply with [constraint provision].
(4) At the end of every stage, if any candidates are doomed—
(a) declare all such candidates excluded;
(b) for each of the candidates' ballot papers, reallocate it to the continuing candidate now highest on its preferences (if such a candidate exists);
(c) declare elected any continuing candidate whose progress total is greater than the quota, one by one in descending order of progress total, breaking any tie as described in rule 3(2)(a).
This is regarded as the ‘end of a stage’.
(5) When applying rule 3(4)(a) (when determining which candidate to exclude), ignore any candidate who is guarded.
Notes and further reading
We should note that the suggestions implemented in these rules (regarding quota rounding and rational arithmetic) have not seen widespread use. For a set of rules for WIGM which has seen widespread real-world use, interested readers are directed to Schedule 1 of the Scottish Local Government Elections Order 2011, which sets out the WIGM implementation used for local government elections in Scotland. A detailed discussion of those rules can be found here.
References
- Miragliotta N. Determining the result: transferring surplus votes in the Western Australian Legislative Council. Perth: Western Australian Electoral Commission; 2002. https://www.elections.wa.gov.au/sites/default/files/content/documents/Determining_the_result.pdf
- Lundell J, Hill ID. Notes on the Droop Quota. Voting Matters. 2007 Oct; (24): 3–6. http://www.votingmatters.org.uk/ISSUE24/I24P2.pdf
- Janson S. Another note on the Droop quota and rounding. Voting Matters. 2011 Oct; (29): 32–4. http://www.votingmatters.org.uk/ISSUE29/I29P4.pdf
- Hill ID. STV with constraints. Voting Matters. 1998 May; (9): 2–4. http://www.votingmatters.org.uk/ISSUE9/P1.HTM
- Otten J. STV with multiple constraints. Voting Matters. 2001 Apr; (13): 4–7. http://www.votingmatters.org.uk/ISSUE13/P3.HTM