From 3ea1eef7c53e6fdb97ddf7f08ca0bc54dacd1be7 Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Thu, 22 Jul 2021 00:40:01 +1000 Subject: [PATCH] Implement WA STV and update documentation --- docs/options.md | 41 +++++++++++++++++++++++++------------- html/index.html | 5 ++++- html/index.js | 52 +++++++++++++++++++++++++++++++++++++++++++++++-- src/main.rs | 8 ++++---- src/stv/mod.rs | 3 +++ 5 files changed, 88 insertions(+), 21 deletions(-) diff --git a/docs/options.md b/docs/options.md index cd577ee..41871a9 100644 --- a/docs/options.md +++ b/docs/options.md @@ -4,18 +4,31 @@ The preset dropdown allows you to choose from a hardcoded list of preloaded STV counting rules. These are: -* *OpenTally WIGM*: A recommended set of simple STV rules designed for computer counting, using the weighted inclusive Gregory method and rational arithmetic. -* *Scottish STV*: Rules from the [*Scottish Local Government Elections Order 2011*](https://www.legislation.gov.uk/ssi/2011/399/schedule/1/made), using the weighted inclusive Gregory method. Validated against the [2007 Scottish local government election result for Linn ward](https://web.archive.org/web/20121004213938/http://www.glasgow.gov.uk/en/YourCouncil/Elections_Voting/Election_Results/ElectionScotland2007/LGWardResults.htm?ward=1&wardname=1%20-%20Linn). -* [*Meek STV*](http://www.dia.govt.nz/diawebsite.NSF/Files/meekm/%24file/meekm.pdf): Advanced STV rules designed for computer counting, recognised by the Proportional Representation Society of Australia (Victoria–Tasmania) as the superior STV system. - * *Meek STV (1987)* operates according to the original Hill–Wichmann–Woodall [‘Algorithm 123’](https://www.dia.govt.nz/diawebsite.NSF/Files/meekm/%24file/meekm.pdf) specification of Meek STV, with the modifications, relevant only in exceptional cases, that (a) fixed-point arithmetic with 5 decimal places is used, and (b) candidates are elected on strictly exceeding the quota. Validated against the Hill–Wichmann–Woodall implementation for ballot papers [derived from the ERS97 model election](https://yingtongli.me/blog/2021/01/04/ers97.html). - * *Meek STV (2006)* operates according to [Hill's 2006 revisions](http://www.votingmatters.org.uk/ISSUE22/I22P2.pdf). This is the algorithm referred to in OpenSTV/OpaVote as ‘Meek STV’, and forms the basis of New Zealand's Meek STV rules. Validated against OpenSTV 1.7 for the ERS97 model election. - * *Meek STV (New Zealand)* operates according to Schedule 1A of the [*Local Electoral Regulations 2001*](https://www.legislation.govt.nz/regulation/public/2001/0145/latest/DLM57125.html). Validated against OpenSTV 1.7, and Hill's nzmeek version 6.7.7, for the ERS97 model election. -* *Australian Senate STV*: Rules from the [*Commonwealth Electoral Act 1918*](https://www.legislation.gov.au/Details/C2020C00400/Html/Text#_Toc59107700), using the unweighted inclusive Gregory method. Validated against the [2019 Australian Senate election result for Tasmania](https://results.aec.gov.au/24310/Website/SenateDownloadsMenu-24310-Csv.htm). -* [*Wright STV*](https://www.aph.gov.au/Parliamentary_Business/Committees/House_of_Representatives_Committees?url=em/elect07/subs/sub051.1.pdf): Rules proposed by Anthony van der Craats designed for computer counting, involving reset and re-iteration of the count after each candidate exclusion. Validated against the [EVE Online reference implementation](https://github.com/ccpgames/ccp-wright-stv) for the [CSM 15 election](https://www.eveonline.com/news/view/meet-the-new-council). -* [*PRSA 1977*](https://www.prsa.org.au/rule1977.htm): Simple rules designed for hand counting, using the exclusive Gregory method, with counting automatically performed in thousandths of a vote. Validated against [example 1](https://www.prsa.org.au/example1.pdf) of the PRSA's [*Proportional Representation Manual*](https://www.prsa.org.au/publicat.htm#p2). -* [*ERS97*](https://www.electoral-reform.org.uk/latest-news-and-research/publications/how-to-conduct-an-election-by-the-single-transferable-vote-3rd-edition/): More complex rules designed for hand counting, using the exclusive Gregory method. Validated against the ERS97 model election. - * *ERS76*: Former rules from the 1976 2nd edition. The quota is always calculated to 2 decimal places – for full ERS76 compliance, set *Round quota to 0 d.p.* when the quota is more than 100. - * *ERS73*: Former rules from the 1973 1st edition. The quota is always calculated to 2 decimal places – for full ERS73 compliance, set *Round quota to 0 d.p.* when the quota is 100 or more. + + + + + + + + + + + + + + + + +
MethodDescriptionExceptionsValidated against
OpenTally WIGMA recommended set of simple STV rules designed for computer counting, using the weighted inclusive Gregory method and rational arithmetic.
Scottish STVRules from the Scottish Local Government Elections Order 2011, using the weighted inclusive Gregory method.2007 Linn ward local election (eSTV 2.0.16)
Meek STVAdvanced STV rules designed for computer counting, recognised by the Proportional Representation Society of Australia (Victoria–Tasmania) as the superior STV system.
• OpenTally MeekOperates according to the original 1987 Hill–Wichmann–Woodall ‘Algorithm 123’ specification of Meek STV, except that (a) ties are broken backwards then at random, (b) fixed-point arithmetic with 5 decimal places is used, and (c) candidates are elected on strictly exceeding the quota.Ballot papers derived from the ERS97 model election (Hill–Wichmann–Woodall implementation)
• Meek STV (2006)Operates according to Hill's 2006 revisions. This is the algorithm referred to in OpenSTV/OpaVote as ‘Meek STV’, and forms the basis of New Zealand's Meek STV rules.[E1]Ballot papers derived from the ERS97 model election (OpenSTV 1.7)
• Meek STV (New Zealand)Operates according to Schedule 1A of the Local Electoral Regulations 2001.[E1]Ballot papers derived from the ERS97 model election (OpenSTV 1.7, Hill's nzmeek 6.7.7)
Australian Senate STVRules from the Commonwealth Electoral Act 1918, using the unweighted inclusive Gregory method.[E2] [E3]2019 Tasmanian Senate election (AEC EasyCount)
Western Australia STVRules from the Electoral Act 1907 (WA), using the weighted inclusive Gregory method.[E2] [E3]
Wright STVRules proposed by Anthony van der Craats designed for computer counting, involving reset and re-iteration of the count after each candidate exclusion.EVE Online CSM 15 election (EVE reference implementation)
PRSA 1977Simple rules designed for hand counting, using the exclusive Gregory method, with counting performed in thousandths of a vote.Example 1 of the PRSA's Proportional Representation Manual
ERS97More complex rules designed for hand counting, using the exclusive Gregory method.Ballot papers derived from the ERS97 model election
• ERS76Former rules from the 1976 2nd edition.[E4]
• ERS73Former rules from the 1973 1st edition.[E4]
Church of EnglandRules from the Church of England Single Transferable Vote Rules 2020, similar to ERS73.
+ +[E1]: When generating random numbers, OpenTally uses a [deterministic random number generator based on SHA-256](rng.md), rather than the Wichmann–Hill(-based) algorithm. + +[E2]: When breaking ties forwards/backwards, OpenTally selects the candidate who had more/fewer votes at the first/last stage when *any* tied candidate had more/fewer votes than the others, rather than when each all had unequal votes. + +[E3]: A tie between 2 candidates for the final vacancy will be broken backwards then at random, rather than the method described in the legislation. + +[E4]: The quota is always calculated to 2 decimal places. For full ERS76 (ERS73) compliance, set *Round quota to 0 d.p.* when the quota is more than 100 (100 or more). This functionality is not available on the command line. @@ -202,12 +215,12 @@ When *Surplus method* is set to *Meek method*: * --round-tvs instead controls the rounding of each intermediate product when computing candidates' votes * --round-votes controls the rounding of the final number of votes credited to each candidate -### Sum surplus transfers (--sum-surplus-transfers) +### (Gregory) Sum surplus transfers (--sum-surplus-transfers) This option allows you to specify how the numbers of votes credited to candidates in a surplus transfer is calculated. In each case, votes are grouped according to the next available preference for a continuing candidate. Subsequently: * *Single step*: The total value of all votes expressing a next available preference for that candidate is multiplied by the surplus fraction. The product is credited to that candidate. -* *By value*: The votes expressing a next available preference for that candidate are further divided according to value. For each group of votes at a particular value, the total value of all such votes is multiplied by the surplus fraction. The product is credited to that candidate. +* *By value*: The votes expressing a next available preference for that candidate are further divided according to value. For each group of votes at a particular value, the total value of all such votes is multiplied by the surplus fraction. The product is credited to that candidate. This is distinct to *Single step* only for weighted inclusive Gregory. * *Per ballot*: For each individual vote expressing a next available preference for that candidate, the value of the vote is multiplied by the surplus fraction. The product is credited to that candidate. This option affects the result only insofar as rounding (due to use of fixed-precision arithmetic, or due to an explicit rounding option) is concerned. diff --git a/html/index.html b/html/index.html index 7b84ae8..00c7591 100644 --- a/html/index.html +++ b/html/index.html @@ -38,17 +38,19 @@ - + + + @@ -247,6 +249,7 @@