From b317affd08988ec81cdbf901f5ec7e29d2785699 Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Sun, 20 Nov 2022 18:59:02 +1100 Subject: [PATCH] Use --round-subtransfers per_ballot and --round-values 4 for Minneapolis STV --- html/presets.js | 2 +- tests/tests_impl/minneapolis.rs | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/html/presets.js b/html/presets.js index 93974ca..1641bc6 100644 --- a/html/presets.js +++ b/html/presets.js @@ -251,7 +251,7 @@ function changePreset() { document.getElementById('chkRoundSFs').checked = true; document.getElementById('txtRoundSFs').value = '4'; document.getElementById('chkRoundValues').checked = false; - document.getElementById('selSumTransfers').value = 'single_step'; + document.getElementById('selSumTransfers').value = 'per_ballot'; document.getElementById('selSurplus').value = 'by_size'; document.getElementById('selMethod').value = 'wig'; document.getElementById('selPapers').value = 'both'; diff --git a/tests/tests_impl/minneapolis.rs b/tests/tests_impl/minneapolis.rs index 0708bb2..fce02d3 100644 --- a/tests/tests_impl/minneapolis.rs +++ b/tests/tests_impl/minneapolis.rs @@ -1,5 +1,5 @@ /* OpenTally: Open-source election vote counting - * Copyright © 2021 Lee Yingtong Li (RunasSudo) + * Copyright © 2021–2022 Lee Yingtong Li (RunasSudo) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -24,7 +24,9 @@ use opentally::stv; fn minneapolis_boe09_rational() { let stv_opts = stv::STVOptionsBuilder::default() .round_surplus_fractions(Some(4)) + .round_values(Some(4)) .round_quota(Some(0)) + .round_subtransfers(stv::RoundSubtransfersMode::PerBallot) .quota_criterion(stv::QuotaCriterion::GreaterOrEqual) //.early_bulk_elect(true) .bulk_exclude(true) @@ -32,7 +34,7 @@ fn minneapolis_boe09_rational() { .immediate_elect(false) .build().unwrap(); - assert_eq!(stv_opts.describe::(), "--round-surplus-fractions 4 --round-quota 0 --quota-criterion geq --bulk-exclude --defer-surpluses --no-immediate-elect"); + assert_eq!(stv_opts.describe::(), "--round-surplus-fractions 4 --round-values 4 --round-quota 0 --round-subtransfers per_ballot --quota-criterion geq --bulk-exclude --defer-surpluses --no-immediate-elect"); utils::read_validate_election::("tests/data/Mppls-2009-BOE-full.csv", "tests/data/Mppls-2009-BOE-full.blt", stv_opts, Some(4), &[]); } @@ -41,7 +43,9 @@ fn minneapolis_boe09_rational() { fn minneapolis_pal13_rational() { let stv_opts = stv::STVOptionsBuilder::default() .round_surplus_fractions(Some(4)) + .round_values(Some(4)) .round_quota(Some(0)) + .round_subtransfers(stv::RoundSubtransfersMode::PerBallot) .quota_criterion(stv::QuotaCriterion::GreaterOrEqual) //.early_bulk_elect(true) .bulk_exclude(true) @@ -49,7 +53,7 @@ fn minneapolis_pal13_rational() { .immediate_elect(false) .build().unwrap(); - assert_eq!(stv_opts.describe::(), "--round-surplus-fractions 4 --round-quota 0 --quota-criterion geq --bulk-exclude --defer-surpluses --no-immediate-elect"); + assert_eq!(stv_opts.describe::(), "--round-surplus-fractions 4 --round-values 4 --round-quota 0 --round-subtransfers per_ballot --quota-criterion geq --bulk-exclude --defer-surpluses --no-immediate-elect"); utils::read_validate_election::("tests/data/2013-Park-At-Large-CVR.csv", "tests/data/2013-Park-At-Large-CVR.blt", stv_opts, Some(4), &[]); }