From 4cf9053681528d9e3804dfeed38d9093455687f5 Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Sun, 11 Jun 2023 21:47:37 +1000 Subject: [PATCH] Implement --surplus-assume-total This replaces and extends the former --subtract-nontransferable option #4 --- docs/FnSpecs.tex | 2 ++ docs/options.md | 9 +++++---- html/index.html | 1 + html/presets.js | 2 +- src/cli/stv.rs | 6 +++--- src/stv/gregory/mod.rs | 15 ++++++++++----- src/stv/options.rs | 14 +++++--------- src/stv/wasm.rs | 4 ++-- tests/tests_impl/nswlg.rs | 6 +++--- 9 files changed, 32 insertions(+), 27 deletions(-) diff --git a/docs/FnSpecs.tex b/docs/FnSpecs.tex index 7c715cf..ac73c93 100644 --- a/docs/FnSpecs.tex +++ b/docs/FnSpecs.tex @@ -325,6 +325,8 @@ \subsection\label{surplus-wig-sf}\paragraph If \textit{--papers} is \textit{both}, divide the elected candidate's surplus by their progress total. + % FIXME: Update this for new --transferable-only, --surplus-assume-total flags + \subsectionc\paragraph If \textit{--papers} is \textit{transferable}, for each parcel held by the elected candidate, multiply the number of transferable ballots in the parcel by the parcel's value, and sum the products. Divide the elected candidate's surplus by the sum. \subsectionc\paragraph If \textit{--papers} is \textit{subtract_nontransferable}, for each parcel held by the elected candidate, multiply the number of non-transferable ballots in the parcel by the parcel's value, and sum the products. Subtract the sum from the elected candidate's progress total. Divide the elected candidate's surplus by the difference. diff --git a/docs/options.md b/docs/options.md index a4ebbab..064d3ff 100644 --- a/docs/options.md +++ b/docs/options.md @@ -109,11 +109,12 @@ Random sample methods are also supported, but also not recommended: A random sample method will usually be used with a *Quota criterion* set to *>=*. -### Ballots to examine in surplus transfer (--transferable-only/--subtract-nontransferable) +### Ballots to examine in surplus transfer (--transferable-only/--surplus-assume-total) -* *Include non-transferable ballots* (default): When this option is selected, all ballots of the transferring candidate are examined. Non-transferable ballots are always exhausted at the relevant surplus fractions. This is the method typically used with the weighted inclusive Gregory or Meek methods. -* *Use transferable ballots only* (--transferable-only): When this option is selected, only transferable ballots of the transferring candidate are examined. Non-transferable ballots are exhausted only if the value of the transferable ballots is less than the surplus. This is the method typically used with other surplus distribution methods. -* *Subtract non-transferables* (--transferable-only --subtract-nontransferable): Same as *Use transferable ballots only*, but the value of the transferable ballots is calculated by subtracting the value of non-transferable ballots from the progress total. This has effect only as far as concerns rounding. +* *Include non-transferable ballots* (default): When this option is selected, all ballots of the transferring candidate are examined. The denominator of the surplus fraction is the total value of the ballots. Non-transferable ballots are always exhausted at the relevant surplus fractions. This is the method typically used with the weighted inclusive Gregory or Meek methods. +* *Assume progress total* (--surplus-assume-total): Same as *Include non-transferable ballots*, but the denominator of the surplus fraction is the candidate's recorded progress total. This has effect only as far as concerns rounding, and only in the weighted inclusive Gregory method. +* *Use transferable ballots only* (--transferable-only): When this option is selected, only transferable ballots of the transferring candidate are examined. The denominator of the surplus fraction is the total value of the transferable ballots. Non-transferable ballots are exhausted only if the value of the transferable ballots is less than the surplus. This is the method typically used with other surplus distribution methods. +* *Subtract non-transferables* (--transferable-only --surplus-assume-total): Same as *Use transferable ballots only*, but the value of the transferable ballots is calculated by subtracting the value of non-transferable ballots from the progress total. This has effect only as far as concerns rounding, and only in the weighted inclusive Gregory method. ### (Gregory) Exclusion method (--exclusion) diff --git a/html/index.html b/html/index.html index 8f93997..72fe54f 100644 --- a/html/index.html +++ b/html/index.html @@ -123,6 +123,7 @@