-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI and config updates for Stop Tabulation Early #636
Changes from all commits
35f2a5c
b2e92b0
d7e79c7
81f4b74
e3b30ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,7 @@ class ContestConfig { | |
private static final int MAX_ROW_INDEX = 100000; | ||
private static final int MIN_MAX_RANKINGS_ALLOWED = 1; | ||
private static final int MIN_MAX_SKIPPED_RANKS_ALLOWED = 0; | ||
private static final int MIN_NUMBER_OF_ROUNDS = 0; | ||
private static final int MIN_NUMBER_OF_WINNERS = 0; | ||
private static final int MIN_DECIMAL_PLACES_FOR_VOTE_ARITHMETIC = 1; | ||
private static final int MAX_DECIMAL_PLACES_FOR_VOTE_ARITHMETIC = 20; | ||
|
@@ -701,6 +702,15 @@ && getMaxRankingsAllowed() < MIN_MAX_RANKINGS_ALLOWED)) { | |
ValidationError.RULES_MULTI_SEAT_BOTTOMS_UP_PERCENTAGE_THRESHOLD_INVALID); | ||
} | ||
|
||
if (fieldOutOfRangeOrNotInteger( | ||
getStopTabulationEarlyOnRoundRaw(), | ||
"stopEarlyOnRound", | ||
MIN_NUMBER_OF_ROUNDS, | ||
Integer.MAX_VALUE, | ||
false)) { | ||
validationErrors.add(ValidationError.RULES_STOP_TABULATION_EARLY_ON_ROUND_INVALID); | ||
} | ||
|
||
WinnerElectionMode winnerMode = getWinnerElectionMode(); | ||
if (Utils.isInt(getNumberOfWinnersRaw())) { | ||
if (getNumberOfWinners() > 0) { | ||
|
@@ -789,6 +799,10 @@ private String getNumberOfWinnersRaw() { | |
return rawConfig.rules.numberOfWinners; | ||
} | ||
|
||
private String getStopTabulationEarlyOnRoundRaw() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I'm not mistaken, this setting means that we'd stop after the specified number of rounds, right? If so, let's call it that instead to make it more clear. Stop on a round makes it sound like maybe we're stopping at the beginning of that round. |
||
return rawConfig.rules.stopTabulationEarlyOnRound; | ||
} | ||
|
||
Integer getNumberOfWinners() { | ||
return Integer.parseInt(getNumberOfWinnersRaw()); | ||
} | ||
|
@@ -947,6 +961,12 @@ boolean isContinueUntilTwoCandidatesRemainEnabled() { | |
return rawConfig.rules.continueUntilTwoCandidatesRemain; | ||
} | ||
|
||
Integer getStopTabulationEarlyOnRound() { | ||
return isNullOrBlank(getStopTabulationEarlyOnRoundRaw()) | ||
? Integer.MAX_VALUE | ||
: Integer.parseInt(getStopTabulationEarlyOnRoundRaw()); | ||
} | ||
|
||
int getNumDeclaredCandidates() { | ||
int size = getCandidateCodeList().size(); | ||
if (undeclaredWriteInsEnabled()) { | ||
|
@@ -1125,6 +1145,7 @@ enum ValidationError { | |
RULES_MIN_DECIMAL_PLACES_FOR_VOTE_ARITHMETIC_INVALID, | ||
RULES_MIN_VOTE_THRESHOLD_INVALID, | ||
RULES_MULTI_SEAT_BOTTOMS_UP_PERCENTAGE_THRESHOLD_INVALID, | ||
RULES_STOP_TABULATION_EARLY_ON_ROUND_INVALID, | ||
RULES_NUMBER_OF_WINNERS_INVALID_FOR_WINNER_ELECTION_MODE, | ||
RULES_CONTINUE_UNTIL_TWO_CANDIDATES_REMAIN_TRUE_FOR_MULTI_SEAT, | ||
RULES_BATCH_ELIMINATION_TRUE_FOR_MULTI_SEAT, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -412,7 +412,9 @@ private boolean shouldContinueTabulating() { | |
int numEliminatedCandidates = candidateToRoundEliminated.size(); | ||
int numWinnersDeclared = winnerToRound.size(); | ||
// apply config setting if specified | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's just delete this comment; it's ambiguous and doesn't add anything anyway There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can do. (Note: It wasn't part of this PR.) |
||
if (config.isContinueUntilTwoCandidatesRemainEnabled()) { | ||
if (currentRound >= config.getStopTabulationEarlyOnRound()) { | ||
keepTabulating = false; | ||
} else if (config.isContinueUntilTwoCandidatesRemainEnabled()) { | ||
// Keep going if there are more than two candidates alive. Also make sure we tabulate one last | ||
// round after we've made our final elimination. | ||
keepTabulating = numEliminatedCandidates + numWinnersDeclared + 1 < config.getNumCandidates() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
artoonie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"tabulatorVersion": "TEST", | ||
"outputSettings": { | ||
"contestName": "Stop Tabulation Early Test", | ||
"outputDirectory": "output", | ||
"contestDate": "2023-03-14", | ||
"contestJurisdiction": "Funkytown, USA", | ||
"contestOffice": "Sergeant-at-Arms", | ||
"tabulateByPrecinct": false, | ||
"generateCdfJson": false | ||
}, | ||
"cvrFileSources": [ | ||
{ | ||
"filePath" : "stop_tabulation_early_test_cvr.xlsx", | ||
"firstVoteColumnIndex" : "2", | ||
"firstVoteRowIndex" : "2", | ||
"idColumnIndex" : "1", | ||
"precinctColumnIndex" : "", | ||
"provider" : "ess", | ||
"treatBlankAsUndeclaredWriteIn": false, | ||
"overvoteLabel": "overvote", | ||
"undervoteLabel": "undervote", | ||
"undeclaredWriteInLabel": "" | ||
} ], | ||
"candidates" : [ { | ||
"name" : "Mookie Blaylock", | ||
"code" : "", | ||
"excluded" : false | ||
}, { | ||
"name" : "Yinka Dare", | ||
"code" : "", | ||
"excluded" : false | ||
}, { | ||
"name" : "George Gervin", | ||
"code" : "", | ||
"excluded" : false | ||
} ], | ||
"rules" : { | ||
"tiebreakMode": "random", | ||
"overvoteRule": "alwaysSkipToNextRank", | ||
"winnerElectionMode": "singleWinnerMajority", | ||
"randomSeed": "1", | ||
"numberOfWinners": "1", | ||
"decimalPlacesForVoteArithmetic": "4", | ||
"minimumVoteThreshold": "0", | ||
"maxSkippedRanksAllowed": "0", | ||
"maxRankingsAllowed": "3", | ||
"nonIntegerWinningThreshold": false, | ||
"hareQuota": false, | ||
"batchElimination": true, | ||
"exhaustOnDuplicateCandidate": false, | ||
"rulesDescription": "Doyle Rules", | ||
"stopTabulationEarlyOnRound": "2" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"config" : { | ||
"contest" : "Stop Tabulation Early Test", | ||
"date" : "2023-03-14", | ||
"jurisdiction" : "Funkytown, USA", | ||
"office" : "Sergeant-at-Arms", | ||
"threshold" : "4" | ||
}, | ||
"results" : [ { | ||
"round" : 1, | ||
"tally" : { | ||
"George Gervin" : "3", | ||
"Mookie Blaylock" : "3", | ||
"Yinka Dare" : "3" | ||
}, | ||
"tallyResults" : [ { | ||
"eliminated" : "Yinka Dare", | ||
"transfers" : { | ||
"exhausted" : "3" | ||
} | ||
} ] | ||
}, { | ||
"round" : 2, | ||
"tally" : { | ||
"George Gervin" : "3", | ||
"Mookie Blaylock" : "3" | ||
}, | ||
"tallyResults" : [ { | ||
"eliminated" : "George Gervin", | ||
"transfers" : { } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reading the legislation, having no transfers on this round seems correct. Let me know if anybody disagrees. (It doesn't make sense to add in last-round transfers to me, but I did want to flag just in case.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure how to answer this. @tarheel? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm inclined to agree, since transfers would only be relevant if you were going to then proceed and show the tallies for the next round. But @chughes297 and @rrojas350 may have an opinion. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, you'd only show the results of the surplus transfer in the next round. |
||
} ] | ||
} ] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be 1? If they say to stop after 0 rounds, that's the same as just not running the tabulation at all, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I figured that might be useful in some cases -- you'd still get the output files with zero rounds (similar to running a Zero Report?). I can change it to
1
though if you prefer.