Use --round-subtransfers per_ballot and --round-values 4 for Minneapolis STV

This commit is contained in:
RunasSudo 2022-11-20 18:59:02 +11:00
parent 1a1153b666
commit b317affd08
No known key found for this signature in database
GPG Key ID: 7234E476BF21C61A
2 changed files with 8 additions and 4 deletions

View File

@ -251,7 +251,7 @@ function changePreset() {
document.getElementById('chkRoundSFs').checked = true; document.getElementById('chkRoundSFs').checked = true;
document.getElementById('txtRoundSFs').value = '4'; document.getElementById('txtRoundSFs').value = '4';
document.getElementById('chkRoundValues').checked = false; 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('selSurplus').value = 'by_size';
document.getElementById('selMethod').value = 'wig'; document.getElementById('selMethod').value = 'wig';
document.getElementById('selPapers').value = 'both'; document.getElementById('selPapers').value = 'both';

View File

@ -1,5 +1,5 @@
/* OpenTally: Open-source election vote counting /* OpenTally: Open-source election vote counting
* Copyright © 2021 Lee Yingtong Li (RunasSudo) * Copyright © 20212022 Lee Yingtong Li (RunasSudo)
* *
* This program is free software: you can redistribute it and/or modify * 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 * 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() { fn minneapolis_boe09_rational() {
let stv_opts = stv::STVOptionsBuilder::default() let stv_opts = stv::STVOptionsBuilder::default()
.round_surplus_fractions(Some(4)) .round_surplus_fractions(Some(4))
.round_values(Some(4))
.round_quota(Some(0)) .round_quota(Some(0))
.round_subtransfers(stv::RoundSubtransfersMode::PerBallot)
.quota_criterion(stv::QuotaCriterion::GreaterOrEqual) .quota_criterion(stv::QuotaCriterion::GreaterOrEqual)
//.early_bulk_elect(true) //.early_bulk_elect(true)
.bulk_exclude(true) .bulk_exclude(true)
@ -32,7 +34,7 @@ fn minneapolis_boe09_rational() {
.immediate_elect(false) .immediate_elect(false)
.build().unwrap(); .build().unwrap();
assert_eq!(stv_opts.describe::<Rational>(), "--round-surplus-fractions 4 --round-quota 0 --quota-criterion geq --bulk-exclude --defer-surpluses --no-immediate-elect"); assert_eq!(stv_opts.describe::<Rational>(), "--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::<Rational>("tests/data/Mppls-2009-BOE-full.csv", "tests/data/Mppls-2009-BOE-full.blt", stv_opts, Some(4), &[]); utils::read_validate_election::<Rational>("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() { fn minneapolis_pal13_rational() {
let stv_opts = stv::STVOptionsBuilder::default() let stv_opts = stv::STVOptionsBuilder::default()
.round_surplus_fractions(Some(4)) .round_surplus_fractions(Some(4))
.round_values(Some(4))
.round_quota(Some(0)) .round_quota(Some(0))
.round_subtransfers(stv::RoundSubtransfersMode::PerBallot)
.quota_criterion(stv::QuotaCriterion::GreaterOrEqual) .quota_criterion(stv::QuotaCriterion::GreaterOrEqual)
//.early_bulk_elect(true) //.early_bulk_elect(true)
.bulk_exclude(true) .bulk_exclude(true)
@ -49,7 +53,7 @@ fn minneapolis_pal13_rational() {
.immediate_elect(false) .immediate_elect(false)
.build().unwrap(); .build().unwrap();
assert_eq!(stv_opts.describe::<Rational>(), "--round-surplus-fractions 4 --round-quota 0 --quota-criterion geq --bulk-exclude --defer-surpluses --no-immediate-elect"); assert_eq!(stv_opts.describe::<Rational>(), "--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::<Rational>("tests/data/2013-Park-At-Large-CVR.csv", "tests/data/2013-Park-At-Large-CVR.blt", stv_opts, Some(4), &[]); utils::read_validate_election::<Rational>("tests/data/2013-Park-At-Large-CVR.csv", "tests/data/2013-Park-At-Large-CVR.blt", stv_opts, Some(4), &[]);
} }