Do not defer a surplus distribution if it exactly equals the difference between the 2 trailing candidates (as, depending on tie-breaking rules, this could change the order of exclusion)

This commit is contained in:
RunasSudo 2022-06-18 01:59:29 +10:00
parent 8cc694e609
commit 2987eca0c3
No known key found for this signature in database
GPG Key ID: 7234E476BF21C61A
2 changed files with 9 additions and 8 deletions

View File

@ -21,10 +21,10 @@ The preset dropdown allows you to choose from a hardcoded list of preloaded STV
| Dáil Éireann STV | Rules from the [*Electoral Act 1992* (Ireland)](http://www.irishstatutebook.ie/eli/1992/act/23/enacted/en/print), using stratified random sample transfers. | [E4] [E7] | ✓ | | Dáil Éireann STV | Rules from the [*Electoral Act 1992* (Ireland)](http://www.irishstatutebook.ie/eli/1992/act/23/enacted/en/print), using stratified random sample transfers. | [E4] [E7] | ✓ |
| [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. | | ✓ | | [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. | | ✓ | | [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. | | ✓ |
| [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. | [E8] | ✓ | | [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. | [E8] [E9] | ✓ |
| • ERS76 | Former rules from the 1976 2nd edition. | [E8] [E9] | ✓ | | • ERS76 | Former rules from the 1976 2nd edition. | [E8] [E9] [E10] | ✓ |
| • ERS73 | Former rules from the 1973 1st edition. | [E8] [E9] | | | • ERS73 | Former rules from the 1973 1st edition. | [E8] [E9] [E10] | |
| Church of England | Rules from the Church of England [*Single Transferable Vote Rules 2020*](https://www.churchofengland.org/sites/default/files/2020-02/STV%20Rules%202020%20-%20final.pdf), similar to ERS73. | | ✓ | | Church of England | Rules from the Church of England [*Single Transferable Vote Rules 2020*](https://www.churchofengland.org/sites/default/files/2020-02/STV%20Rules%202020%20-%20final.pdf), similar to ERS73. | [E8] | ✓ |
Exceptions: Exceptions:
@ -35,8 +35,9 @@ Exceptions:
* [E5] The legislation is drafted such that a consistent interpretation is impossible see <a href="https://github.com/AndrewConway/ConcreteSTV/blob/main/nsw/NSWLocalCouncilLegislation2021Commentary.md">Conway</a> for a discussion. In practice, the New South Wales Electoral Commission has applied the by parcel method of rounding subtransfers, which OpenTally follows. * [E5] The legislation is drafted such that a consistent interpretation is impossible see <a href="https://github.com/AndrewConway/ConcreteSTV/blob/main/nsw/NSWLocalCouncilLegislation2021Commentary.md">Conway</a> for a discussion. In practice, the New South Wales Electoral Commission has applied the by parcel method of rounding subtransfers, which OpenTally follows.
* [E6] The mathematically eliminated by the sum of all ranked-choice votes comparison is not implemented. * [E6] The mathematically eliminated by the sum of all ranked-choice votes comparison is not implemented.
* [E7] The quarter of a quota provision is disregarded when determining whether to defer surplus distributions. * [E7] The quarter of a quota provision is disregarded when determining whether to defer surplus distributions.
* [E8] No distinction is made between stages and substages (during exclusion). This affects only the numbering of stages and not the result. * [E8] The distribution of a surplus is not deferred if it exactly equals the difference between the 2 trailing continuing candidates.
* [E9] By default, 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). * [E9] No distinction is made between stages and substages (during exclusion). This affects only the numbering of stages and not the result.
* [E10] By default, 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).
For details of validation, see [validation.md](https://yingtongli.me/git/OpenTally/about/docs/validation.md). For details of validation, see [validation.md](https://yingtongli.me/git/OpenTally/about/docs/validation.md).

View File

@ -1239,7 +1239,7 @@ where
} }
hopefuls.sort_unstable_by(|(_, cc1), (_, cc2)| cc1.votes.cmp(&cc2.votes)); hopefuls.sort_unstable_by(|(_, cc1), (_, cc2)| cc1.votes.cmp(&cc2.votes));
if total_surpluses > &(&hopefuls[1].1.votes - &hopefuls[0].1.votes) { if total_surpluses >= &(&hopefuls[1].1.votes - &hopefuls[0].1.votes) {
return false; return false;
} }
@ -1250,7 +1250,7 @@ where
if num_to_exclude > 0 { if num_to_exclude > 0 {
let total_excluded = to_exclude.into_iter() let total_excluded = to_exclude.into_iter()
.fold(N::new(), |acc, c| acc + &state.candidates[c].votes); .fold(N::new(), |acc, c| acc + &state.candidates[c].votes);
if total_surpluses > &(&hopefuls[num_to_exclude].1.votes - &total_excluded) { if total_surpluses >= &(&hopefuls[num_to_exclude].1.votes - &total_excluded) {
return false; return false;
} }
} }