Add documentation on options

This commit is contained in:
RunasSudo 2021-06-13 16:32:21 +10:00
parent c9d714bf25
commit e324036530
No known key found for this signature in database
GPG Key ID: 7234E476BF21C61A

157
docs/options.md Normal file
View File

@ -0,0 +1,157 @@
# Options and advanced options
## Preset
The preset dropdown allows you to choose from a hardcoded list of preloaded STV counting rules. These are:
* *Recommended 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).
* *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).
* [*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](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).
This functionality is not available on the command line.
## Quota-related options
### Quota (-q/--quota)
The quota dropdowns allow you to define the quota used in the election, and the quota criterion used to elect candidates. The quota may be set to:
* *Droop* and *Droop (exact)*: *V*/(*S*+1)
* *Hare* and *Hare (exact)*: *V*/*S*
where *V* is the number of votes and *S* is the number of seats.
The *(exact)* version of each quota has effect only if *Round quota to [n] d.p.* is enabled. When that setting is enabled, *Droop* and *Hare* will increment the quota up to the next available rounded unit (even if the quotient is exact already), while the *(exact)* versions will round the quota up if and only if the quotient is not already exact.
When *Round quota to [n] d.p.* is not enabled, *Droop* (or *Droop (exact)*) is also known as the NewlandBritton or Hagenbach-Bischoff quota.
### Quota criterion (-c/--quota-criterion)
The quota criterion may be set to *>=* (candidates are elected if they meet or exceed the quota) or *>* (candidates are elected only if they strictly exceed the quota).
Note that the combination *>= Droop (exact)* (with *Round quota to [n] d.p.* enabled) can result in more candidates meeting the quota than there are available vacancies, hence this particular combination is not recommended.
### Quota mode (--quota-mode)
This option allows you to specify whether the votes required for election can change during the count. The options are:
* *Static quota*: The quota is calculated once after all first-preference votes are allocated, and remains constant throughout the count.
* *Static with ERS97 rules*: The quota is static, but candidates may be elected if their vote exceeds (or equals, according to the *Quota criterion*) the total active vote, divided by (*S* + 1) (or *S*, according to the *Quota* option).
## STV variants
### Surplus order (--surplus-order)
This dropdown allows you to select in what order surpluses are distributed:
* *By size* (default): When multiple candidates exceed the quota, the largest surplus is transferred (even if it arose at a later stage of the count).
* *By order*: When multiple candidates exceed the quota, the surplus of the candidate elected first is transferred (even if it is smaller than another). Candidates are always declared elected in descending order of number of votes.
Some STV counting rules provide, for example, that no surplus shall be transferred before a surplus that arose earlier in the counting whether larger or not (PRSA 1977). In this case, the option *By order* should be selected.
### Surplus method (-s/--surplus)
This dropdown allows you to select how ballots are transferred during surplus transfers. The recommended methods are:
* *Weighted inclusive Gregory* (default): During surplus transfers, all applicable ballot papers of the transferring candidate are examined. Transfers are weighted according to the weights of the ballot papers.
* *Meek STV*: Transfers are computed as described at <http://www.dia.govt.nz/diawebsite.NSF/Files/meekm/%24file/meekm.pdf>.
Other methods are supported, but not recommended:
* *Unweighted inclusive Gregory*: During surplus transfers, all applicable ballot papers of the transferring candidate are examined. Transfers are not weighted, and each ballot paper has equal value in the calculation.
* *Exclusive Gregory (last bundle)*: During surplus transfers, only the ballot papers received in the last transfer are examined. Transfers are not weighted.
Other surplus transfer methods, such as non-fractional transfers (e.g. random sample) are not supported at this time.
### Papers to examine in surplus transfer (--transferable-only)
* *Include non-transferable papers* (default): When this option is selected, all ballot papers of the transferring candidate are examined. Non-transferable papers are always exhausted at the relevant surplus fractions.
* *Use transferable papers only* (CLI: --transferable-only): When this option is selected, only transferable papers of the transferring candidate are examined. Non-transferable papers are exhausted only if the value of the transferable papers is less than the surplus.
### Exclusion method (--exclusion)
* *Exclude in one round* (default): When excluding candidate(s), transfer all their ballot papers in one stage.
* *Exclude by parcel (by order)*: When excluding a candidate, transfer their ballot papers one parcel at a time, in the order each was received. Each parcel forms a separate stage, i.e. if a transfer allows another candidate to meet the quota criterion, no further papers are transferred to that candidate. This option cannot be combined with bulk exclusion.
* *Exclude by value*: When excluding candidate(s), transfer their ballot papers in descending order of accumulated transfer value. Each transfer of all ballots of a certain transfer value forms a separate stage.
### Ties (-t/--ties)
This dropdown allows you to select how ties (in surplus transfer or exclusion) are broken. The options are:
* *Backwards*: Ties are broken according to which tied candidate had the most/fewest votes at the end of the *most recent* stage where one tied candidate had more/fewer votes than the others, if such a stage exists.
* *Fowards*: Ties are broken according to which tied candidate had the most/fewest votes at the end of the *earliest* stage where one tied candidate had more/fewer votes than the others, if such a stage exists.
* *Random*: Ties are broken at random (see *Random seed*).
* *Prompt*: The user is prompted to break the tie.
Multiple tie breaking methods can be specified. If the first method cannot resolve the tie, the next is tried, and so on. In the web application, 4 options are available (*Backwards then random*, *Forwards then random*, *Random* and *Prompt*). On the command line, the `--ties` option can take multiple arguments (e.g. `--ties backwards random`).
### Random seed (--random-seed)
This option allows you to input an arbitrary value to seed the deterministic random number generator used to break ties when *Ties* is set to *Random*. When the same seed value is used, ties will always be broken in the same way, allowing the breaking of ties to be independently verified.
The default value is the current date, formatted YYYYMMDD.
The algorithm used by the random number generator is specified at [rng.md](rng.md).
## Numeric representation
### Numbers (-n/--numbers), Decimal places (--decimals)
This dropdown allows you to select how numbers (vote totals, etc.) are represented internally in memory. The options are:
* *Fixed*: Numbers are represented as fixed-precision decimals, up to a certain number of decimal places (default: 5).
* *Rational*: Numbers are represented exactly as fractions, resulting in the elimination of rounding error, but increasing computational complexity when the number of surplus transfers is very large.
* *Float (64-bit)*: Numbers are represented as native 64-bit floating-point numbers. This is fast, but not recommended as unexpectedly large rounding errors may be introduced in some circumstances.
### Display up to [n] d.p. (--pp-decimals)
This option allows you to specify to how many decimal places votes will be reported in the results report. It does not affect the internal precision of calculations.
### Normalise ballots (--normalise-ballots)
In the BLT file format, each set of preferences can have a specified weight this is typically used to indicate multiple voters who had the same preferences.
When ballots are not normalised (default), a set of preferences with weight *n* > 1 is represented as a single ballot with value *n*. This is known as [tree-packed ballots](http://www.votingmatters.org.uk/ISSUE21/I21P1.pdf).
When ballots are normalised, a set of preferences with weight *n* > 1 is instead converted to *n* ballots each with value 1. This is generally required only when the rules directly deal with individual ballot weights, such as when *Sum surplus transfers* is set to *Per ballot*.
## Count optimisations
### Bulk exclusion (--bulk-exclude)
When bulk exclusion is disabled (default), only one candidate is ever excluded per stage.
When bulk exclusion is enabled, as many candidates are excluded as possible at once per stage, provided that sufficient candidates remain to fill the vacancies, and the bulk exclusion could not change the order of exclusion. If 2 or more candidates are tied, either all are bulk excluded or none are. The ballot papers of all excluded candidates are considered together, and transferred according to the *Exclusion method*.
### Defer surpluses (--defer-surpluses)
When deferred surpluses is disabled (default), all surpluses must be transferred before candidates can be excluded.
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).
## Rounding
### Round quota/votes/surplus fractions/ballot weights to [n] d.p. (--round-quota, --round-votes, --round-tvs, --round-weights)
When rounding is enabled, the specified values are rounded to the specified number of decimal places. This enables, for example, votes to be counted only in integers, while ballot weights and surplus fractions are calculated to higher precision (according to the *Numbers* option).
When enabled, the quota is incremented or rounded up (according to the *Quota* option), whereas votes, surplus fractions and weights are always rounded down.
In relation to *Round surplus fractions to [n] d.p.* note that surplus fractions are used in STV in calculations of the form *A* × (*B*/*C*), where (*B*/*C*) is the surplus fraction. The order of operations depends on this setting:
* When this option is disabled (default), (*A* × *B*) is calculated first, then divided by *C*. This minimises rounding errors.
* When this option is enabled, (*B*/*C*) is calculated separately first and rounded to the specified precision, before being multiplied by *A*. Many STV rules designed for hand counting prescribe this method of manipulating surplus fractions.
In Australia, surplus fractions are often known as transfer values; however, the term value is reserved in OpenTally for referring to the values of votes.
### 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.
* *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.