Add new ERS97 test

This commit is contained in:
RunasSudo 2021-08-09 18:19:06 +10:00
parent 764ebd98e6
commit 5024496f61
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
5 changed files with 112 additions and 4 deletions

View File

@ -5,9 +5,9 @@ STV-counting software is frequently validated empirically by comparing the resul
| Method | Election | Comparator | Included test case | | Method | Election | Comparator | Included test case |
|-|-|-|-| |-|-|-|-|
| Scottish STV | [2007 Glasgow council Linn ward election](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) | eSTV 2.0.16 (official) | ✓ | | Scottish STV | [2007 Glasgow council Linn ward election](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) | eSTV 2.0.16 (official) | ✓ |
| OpenTally Meek | [Ballot papers derived from the ERS97 model election](https://yingtongli.me/blog/2021/01/04/ers97.html) | [Algorithm 123](https://www.dia.govt.nz/diawebsite.NSF/Files/meekm/%24file/meekm.pdf) | ✓ | | OpenTally Meek | [Reverse engineered ballot papers for the ERS97 model election](https://yingtongli.me/blog/2021/01/04/ers97.html) | [Algorithm 123](https://www.dia.govt.nz/diawebsite.NSF/Files/meekm/%24file/meekm.pdf) | ✓ |
| Meek STV (2006) | Ballot papers derived from the ERS97 model election | [OpenSTV 1.7](https://github.com/Conservatory/openstv) | ✓ | | Meek STV (2006) | Reverse engineered ballot papers for the ERS97 model election | [OpenSTV 1.7](https://github.com/Conservatory/openstv) | ✓ |
| Meek STV (New Zealand) | Ballot papers derived from the ERS97 model election | OpenSTV 1.7, [Hill's nzmeek 6.7.7](https://yingtongli.me/blog/2021/07/08/nzmeek.html) | ✓ | | Meek STV (New Zealand) | Reverse engineered ballot papers for the ERS97 model election | OpenSTV 1.7, [Hill's nzmeek 6.7.7](https://yingtongli.me/blog/2021/07/08/nzmeek.html) | ✓ |
| Australian Senate STV | [2019 Tasmanian Senate election](https://results.aec.gov.au/24310/Website/SenateDownloadsMenu-24310-Csv.htm) | EasyCount (official) | ✓ | | 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 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) | ✓ | | 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) | ✓ |
@ -16,7 +16,8 @@ STV-counting software is frequently validated empirically by comparing the resul
| 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) | ✓ | | 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) | ✓ | | 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) | ✓ | | 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) | ✓ |
| ERS97 | Ballot papers derived from the ERS97 model election | [Model result](https://www.electoral-reform.org.uk/latest-news-and-research/publications/how-to-conduct-an-election-by-the-single-transferable-vote-3rd-edition/#sub-section-24) (official) | ✓ | | ERS97 | [Reverse engineered ballot papers for the ERS97 model election](https://yingtongli.me/blog/2021/01/04/ers97.html) | [Model result](https://www.electoral-reform.org.uk/latest-news-and-research/publications/how-to-conduct-an-election-by-the-single-transferable-vote-3rd-edition/#sub-section-24) (official) | ✓ |
| ERS97 | [Joe Otten/eSTV ballot papers for the ERS97 model election](https://web.archive.org/web/20020606014623/http://estv.otten.co.uk/) | [Model result](https://www.electoral-reform.org.uk/latest-news-and-research/publications/how-to-conduct-an-election-by-the-single-transferable-vote-3rd-edition/#sub-section-24) (official) | ✓ |
# References # References

71
tests/data/ers97.blt Normal file
View File

@ -0,0 +1,71 @@
# Comment: Ballot papers for the ERS97 model election - all votes - ERS97
# Source: Joe Otten, bundled with eSTV 1.40 at https://web.archive.org/web/20020606014623/http://estv.otten.co.uk/
# Contributor: RunasSudo
11 6
8 1 2 0
3 1 3 0
14 1 4 0
34 1 5 0
1 1 6 0
4 1 7 0
1 1 8 0
4 1 9 3 0
3 1 9 4 0
2 1 9 6 0
3 1 9 7 0
4 1 9 8 0
9 1 9 0
4 1 10 3 0
5 1 10 4 0
3 1 10 6 0
3 1 10 7 0
6 1 10 8 0
10 1 10 0
1 1 11 5 0
1 1 11 0
11 1 0
105 2 0
91 3 0
90 4 0
81 5 0
64 6 0
11 7 6 0
36 7 8 0
12 7 0
55 8 0
3 9 3 0
2 9 4 0
2 9 5 3 0
1 9 5 4 0
15 9 5 0
2 9 6 0
2 9 8 0
2 10 3 0
2 10 4 0
2 10 5 6 0
1 10 5 7 6 0
2 10 5 8 0
11 10 5 0
1 10 6 0
1 10 7 4 0
1 10 8 0
1 10 0
2 11 2 0
4 11 3 0
1 11 4 0
5 11 7 8 0
10 11 8 0
1 11 0
0
"Smith"
"Duke"
"Prince"
"Freeman"
"Carpenter"
"Baron"
"Abbot"
"Vicar"
"Wright"
"Glazier"
"Monk"
"ERS Model - 1997 Edition"

15
tests/data/ers97.csv Normal file
View File

@ -0,0 +1,15 @@
Stage:,1,,2,,4,,6,,7,,8,
Comment:,First preferences,,Surplus of Smith,,Exclusion of Monk,,"Exclusion of Glazier, Wright",,Surplus of Carpenter,,Exclusion of Abbot,
Smith,134,EL,107.58,EL,107.58,EL,107.58,EL,107.58,EL,107.58,EL
Duke,105,H,106.68,H,108.68,EL,108.68,EL,108.68,EL,108.68,EL
Prince,91,H,91.63,H,95.63,H,102.31,H,104.31,EL,104.31,EL
Freeman,90,H,92.94,H,93.94,H,99.62,H,100.62,H,101.62,EL
Carpenter,81,H,88.14,H,88.35,H,122.35,EL,107.58,EL,107.58,EL
Baron,64,H,64.21,H,64.21,H,68.26,H,70.26,H,82.26,H
Abbot,59,H,59.84,H,64.84,H,67.1,H,68.1,H,2.1,EX
Vicar,55,H,55.21,H,65.21,H,70.31,H,72.31,H,113.31,EL
Wright,27,H,32.25,H,32.25,H,0,EX,0,EX,0,EX
Glazier,24,H,30.51,H,30.51,H,0,EX,0,EX,0,EX
Monk,23,H,23.42,H,0,EX,0,EX,0,EX,0,EX
Non-transferable,0,,0.59,,1.8,,6.79,,13.56,,25.56,
Votes required,,,,,,,105.87,,104.13,,96.41,
1 Stage: 1 2 4 6 7 8
2 Comment: First preferences Surplus of Smith Exclusion of Monk Exclusion of Glazier, Wright Surplus of Carpenter Exclusion of Abbot
3 Smith 134 EL 107.58 EL 107.58 EL 107.58 EL 107.58 EL 107.58 EL
4 Duke 105 H 106.68 H 108.68 EL 108.68 EL 108.68 EL 108.68 EL
5 Prince 91 H 91.63 H 95.63 H 102.31 H 104.31 EL 104.31 EL
6 Freeman 90 H 92.94 H 93.94 H 99.62 H 100.62 H 101.62 EL
7 Carpenter 81 H 88.14 H 88.35 H 122.35 EL 107.58 EL 107.58 EL
8 Baron 64 H 64.21 H 64.21 H 68.26 H 70.26 H 82.26 H
9 Abbot 59 H 59.84 H 64.84 H 67.1 H 68.1 H 2.1 EX
10 Vicar 55 H 55.21 H 65.21 H 70.31 H 72.31 H 113.31 EL
11 Wright 27 H 32.25 H 32.25 H 0 EX 0 EX 0 EX
12 Glazier 24 H 30.51 H 30.51 H 0 EX 0 EX 0 EX
13 Monk 23 H 23.42 H 0 EX 0 EX 0 EX 0 EX
14 Non-transferable 0 0.59 1.8 6.79 13.56 25.56
15 Votes required 105.87 104.13 96.41

BIN
tests/data/ers97.ods Normal file

Binary file not shown.

View File

@ -40,3 +40,24 @@ fn ers97old_rational() {
utils::read_validate_election::<Rational>("tests/data/ers97old.csv", "tests/data/ers97old.blt", stv_opts, None, &["nt", "vre"]); utils::read_validate_election::<Rational>("tests/data/ers97old.csv", "tests/data/ers97old.blt", stv_opts, None, &["nt", "vre"]);
} }
#[test]
fn ers97_rational() {
let stv_opts = stv::STVOptionsBuilder::default()
.round_surplus_fractions(Some(2))
.round_values(Some(2))
.round_votes(Some(2))
.round_quota(Some(2))
.quota(stv::QuotaType::DroopExact)
.quota_criterion(stv::QuotaCriterion::GreaterOrEqual)
.quota_mode(stv::QuotaMode::ERS97)
.surplus(stv::SurplusMethod::EG)
.transferable_only(true)
.exclusion(stv::ExclusionMethod::ByValue)
.early_bulk_elect(false)
.bulk_exclude(true)
.defer_surpluses(true)
.build().unwrap();
utils::read_validate_election::<Rational>("tests/data/ers97.csv", "tests/data/ers97.blt", stv_opts, None, &["nt", "vre"]);
}