From b58922c57b6ecde05c5c9f40fa85f54a104f9d43 Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Sat, 7 Aug 2021 18:51:48 +1000 Subject: [PATCH] WIP: no immediate election? --- docs/options.md | 14 +- docs/validation.md | 2 + html/index.html | 5 +- html/index.js | 27 +- src/main.rs | 6 +- src/parser/blt.rs | 1 - src/stv/gregory.rs | 25 + src/stv/meek.rs | 4 +- src/stv/mod.rs | 28 +- src/stv/sample.rs | 2 +- src/stv/wasm.rs | 4 +- tests/data/2013-Park-At-Large-CVR.blt | 950 +++++++++++++++++++++++++ tests/data/2013-Park-At-Large-CVR.csv | 13 + tests/data/2013-Park-At-Large-CVR.ods | Bin 0 -> 16687 bytes tests/data/Mppls-2009-BOE-full.csv | 958 +++++++++++++------------- tests/data/Mppls-2009-BOE-full.ods | Bin 28111 -> 27449 bytes tests/meek.rs | 3 +- tests/minneapolis.rs | 20 +- 18 files changed, 1546 insertions(+), 516 deletions(-) create mode 100644 tests/data/2013-Park-At-Large-CVR.blt create mode 100644 tests/data/2013-Park-At-Large-CVR.csv create mode 100644 tests/data/2013-Park-At-Large-CVR.ods diff --git a/docs/options.md b/docs/options.md index 45ce382..51170b1 100644 --- a/docs/options.md +++ b/docs/options.md @@ -15,6 +15,7 @@ The preset dropdown allows you to choose from a hardcoded list of preloaded STV | 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. | [E2] [E3] [E4] | ✓ | | Western Australia STV | Rules from the [*Electoral Act 1907* (WA)](https://www.legislation.wa.gov.au/legislation/prod/filestore.nsf/FileURL/mrdoc_29498.pdf/$FILE/Electoral%20Act%201907%20-%20[17-a0-06].pdf), using the weighted inclusive Gregory method. | [E2] [E3] | | | Australian Capital Territory STV | Rules from the [*Electoral Act 1992* (ACT)](https://www.legislation.act.gov.au/View/a/1992-71/current/PDF/1992-71.PDF), using the exclusive Gregory method. | | ✓ | +| Minneapolis STV | Rules from chapter 167 of the [*Minneapolis Code of Ordinances*](https://library.municode.com/mn/minneapolis/codes/code_of_ordinances?nodeId=COOR_TIT8.5EL_CH167MUELRUCO), using the weighted inclusive Gregory method. | | ✓ | | Cambridge STV | Rules in force in Cambridge, Massachusetts, using random sample transfers. These rules are derived from the [former chapter 54A of the Massachusetts General Laws](https://www.cambridgema.gov/-/media/Files/electioncommission/massachusettsgenerallawschapter54a.pdf), but have by regulation been modified to incorporate the procedures set out in Article IX of the former [1938 Charter of the City of Cincinnati](https://catalog.hathitrust.org/Record/001754258). See also [here](https://web.archive.org/web/20081118104049/http://www.fairvote.org/media/1993countmanual.pdf). | | ✓ | | [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. | | ✓ | | [PRSA 1977](https://www.prsa.org.au/rule1977.htm) | Simple rules designed for hand counting, using the exclusive Gregory method, with counting performed in thousandths of a vote. | | ✓ | @@ -216,12 +217,17 @@ When deferred surpluses is disabled (default), all surpluses must be transferred When deferred surpluses is enabled, the transfer of all surpluses is deferred if doing so could not change the order of exclusion (including of a bulk exclusion, if that is enabled). -### (Meek) Immediate election (--meek-immediate-elect) +### Immediate election (--no-immediate-elect) -When *Surplus method* is set to *Meek method*, this option controls when candidates are elected: +When *Surplus method* is set to a Gregory or random sample method, this option controls when candidates are elected: -* When immediate election is disabled (default), all current surpluses are distributed and keep values finalised, before any candidates exceeding the quota are then declared elected. This is the method specified in the 1987 Meek rules. -* When immediate election is enabled, a candidate meeting the quota interrupts a surplus distribution. The candidate is immediately declared elected, before the distribution of all surpluses of all now-elected candidates continues. This is the method specified in the 2006 Meek rules. +* When immediate election is enabled (default), a candidate is declared at the end of the stage once reaching the quota. This is typical of most STV rules. +* When immediate election is disabled, a candidate is declared elected only once their surplus is transferred. This is the method specified by the Minneapolis rules. + +Likewise, when *Surplus method* is set to *Meek method*: + +* When immediate election is enabled (default), a candidate meeting the quota interrupts a surplus distribution. The candidate is immediately declared elected, before the distribution of all surpluses of all now-elected candidates continues. This is the method specified in the 2006 Meek rules. +* When immediate election is disabled, all current surpluses are distributed and keep values finalised, before any candidates exceeding the quota are then declared elected. This is the method specified in the 1987 Meek rules. ### Minimum threshold (--min-threshold) diff --git a/docs/validation.md b/docs/validation.md index e558b99..5414526 100644 --- a/docs/validation.md +++ b/docs/validation.md @@ -11,6 +11,8 @@ STV-counting software is frequently validated empirically by comparing the resul | Australian Senate STV | [2019 Tasmanian Senate election](https://results.aec.gov.au/24310/Website/SenateDownloadsMenu-24310-Csv.htm) | EasyCount (official) | ✓ | | Australian Senate STV | [2019 NSW Senate election](https://results.aec.gov.au/24310/Website/SenateDownloadsMenu-24310-Csv.htm) | EasyCount (official) | | | Australian Capital Territory STV | [2020 Kurrajong Legislative Assembly election](https://www.elections.act.gov.au/elections_and_voting/2020_legislative_assembly_election/ballot-paper-preference-data-2020-election) | [eVACS 2020](https://www.elections.act.gov.au/elections_and_voting/electronic_voting_and_counting) (official) | ✓ | +| Minneapolis STV | [2009 Minneapolis Board of Estimate and Taxation election](https://vote.minneapolismn.gov/results-data/election-results/2009/bet/) | Results sheet (official) | ✓ | +| Minneapolis STV | [2013 Minneapolis Parks & Recreation Commissioner At Large election](https://vote.minneapolismn.gov/results-data/election-results/2013/park-board-at-large/) | Results sheet (official) | ✓ | | Cambridge STV | [2003 Cambridge City Council election](https://web.archive.org/web/20070204083508/http://stv.sourceforge.net/) | OpenSTV 1.7, [ChoicePlus Pro 2.1](https://www.votingsolutions.com/cpdetail.htm) (official) | ✓ | | Wright STV | [EVE Online CSM 15 election](https://www.eveonline.com/news/view/meet-the-new-council) | [ccp-wright-stv](https://github.com/ccpgames/ccp-wright-stv) (official) | ✓ | | PRSA 1977 | [*Proportional Representation Manual*](https://www.prsa.org.au/publicat.htm#p2) [example 1](https://www.prsa.org.au/utopiatc.pdf) | [Model result](https://www.prsa.org.au/example1.pdf) (official) | ✓ | diff --git a/html/index.html b/html/index.html index a8a0c5d..5827e52 100644 --- a/html/index.html +++ b/html/index.html @@ -45,7 +45,7 @@ - + @@ -226,8 +226,7 @@ Defer surpluses