31 CondorcetProtocol = 0x02,
39 static inline const QString LOG_EVENT_INVALID_ELECTION = QStringLiteral(
"The provided election is invalid.");
40 static inline const QString LOG_EVENT_CALC_START = QStringLiteral(
"Calculating results of election - %1");
41 static inline const QString LOG_EVENT_INPUT_COUNTS = QStringLiteral(
"There are %1 candidates, %2 ballots, and %3 seats to fill.");
42 static inline const QString LOG_EVENT_INITAL_RAW_RANKINGS = QStringLiteral(
"Initial score rankings:");
43 static inline const QString LOG_EVENT_CALC_HEAD_TO_HEAD = QStringLiteral(
"Pre-calculating head-to-head matchup results...");
46 static inline const QString LOG_EVENT_QUALIFIER = QStringLiteral(
"Performing runoff qualifier to seed candidates for the runoff.");
47 static inline const QString LOG_EVENT_QUALIFIER_TOP = QStringLiteral(
"Trying to determine remaining %1 candidate(s) to advance between:");
48 static inline const QString LOG_EVENT_QUALIFIER_ADVANCE_CANDIDATES = QStringLiteral(
"Advancing candidate(s):");
49 static inline const QString LOG_EVENT_QUALIFIER_CUT_CANDIDATES = QStringLiteral(
"Cutting candidate(s):");
50 static inline const QString LOG_EVENT_QUALIFIER_NO_RANDOM = QStringLiteral(
"Random tiebreaker is disabled.");
51 static inline const QString LOG_EVENT_QUALIFIER_UNSUCCESSFUL = QStringLiteral(
"Unable to resolve scoring round tie to reach the target number of candidates.");
52 static inline const QString LOG_EVENT_QUALIFIER_RESULT = QStringLiteral(
61 static inline const QString LOG_EVENT_DEFACTO_WINNER_CHECK = QStringLiteral(R
"(Simulating runoff for potential defacto winner "%1" between:)");
62 static inline const QString LOG_EVENT_DEFACTO_WINNER_CHECK_WIN = QStringLiteral(R
"(The first seed won against "%1".)");
63 static inline const QString LOG_EVENT_DEFACTO_WINNER_CHECK_FAIL = QStringLiteral(R
"(The first seed lost to "%1".)");
64 static inline const QString LOG_EVENT_DEFACTO_WINNER_CHECK_SUCCESS = QStringLiteral(
"The first seed wins all simulated runoffs.");
67 static inline const QString LOG_EVENT_RUNOFF = QStringLiteral(R
"(Observing runoff between "%1" and "%2".)");
68 static inline const QString LOG_EVENT_RUNOFF_HEAD_TO_HEAD_WINNER_CHECK = QStringLiteral(
"Checking for clear winner of head-to-head.");
69 static inline const QString LOG_EVENT_RUNOFF_TIE = QStringLiteral(
"The candidates in the runoff are tied in terms of preference.");
70 static inline const QString LOG_EVENT_RUNOFF_HIGHER_SCORE_CHECK = QStringLiteral(
"Checking for the candidate with the higher score.");
71 static inline const QString LOG_EVENT_RUNOFF_MORE_FIVE_STAR_CHECK = QStringLiteral(
"Checking for the candidate with more five star votes.");
72 static inline const QString LOG_EVENT_RUNOFF_CHOOSING_RANDOM_WINNER = QStringLiteral(
"Choosing runoff winner randomly.");
73 static inline const QString LOG_EVENT_RUNOFF_NO_RANDOM = QStringLiteral(
"Random tiebreaker is disabled, the runoff candidates remained tied.");
74 static inline const QString LOG_EVENT_RUNOFF_WINNER = QStringLiteral(R
"(The runoff resulted in a win for: "%1")");
75 static inline const QString LOG_EVENT_RUNOFF_UNRESOLVED = QStringLiteral(
"The runoff tie could not be broken.");
78 static inline const QString LOG_EVENT_RANK_BY_SCORE = QStringLiteral(
"Ranking relevant candidates by score (%1)...");
79 static inline const QString LOG_EVENT_RANKINGS_SCORE = QStringLiteral(
"Score rankings:");
80 static inline const QString LOG_EVENT_RANK_BY_VOTES_OF_MAX_SCORE = QStringLiteral(
"Ranking relevant candidates by votes of max score (%1)...");
81 static inline const QString LOG_EVENT_RANKINGS_VOTES_OF_MAX_SCORE = QStringLiteral(
"Votes of Max Score rankings:");
82 static inline const QString LOG_EVENT_RANK_BY_HEAD_TO_HEAD_LOSSES = QStringLiteral(
"Ranking relevant candidates by head-to-head losses (%1)...");
83 static inline const QString LOG_EVENT_RANKINGS_HEAD_TO_HEAD_LOSSES = QStringLiteral(
"Head-to-head losses rankings:");
84 static inline const QString LOG_EVENT_RANK_BY_HEAD_TO_HEAD_PREFERENCES = QStringLiteral(
"Ranking relevant candidates by head-to-head preference count (%1)...");
85 static inline const QString LOG_EVENT_RANKINGS_HEAD_TO_HEAD_PREFERENCES = QStringLiteral(
"Head-to-head preference count rankings:");
86 static inline const QString LOG_EVENT_RANK_BY_HEAD_TO_HEAD_MARGIN = QStringLiteral(
"Ranking relevant candidates by head-to-head margin (%1)...");
87 static inline const QString LOG_EVENT_RANKINGS_HEAD_TO_HEAD_MARGIN = QStringLiteral(
"Head-to-head margin rankings:");
90 static inline const QString LOG_EVENT_BREAK_TIE_MOST_FIVE_STAR = QStringLiteral(
"Breaking %1-way tie according to most five star votes...");
91 static inline const QString LOG_EVENT_BREAK_TIE_HIGHEST_SCORE = QStringLiteral(
"Breaking %1-way tie according to highest score...");
92 static inline const QString LOG_EVENT_BREAK_TIE_RANDOM = QStringLiteral(
"Breaking %1-way tie randomly...");
93 static inline const QString LOG_EVENT_BREAK_RESULT = QStringLiteral(
"Tie Break Winner(s) - { %1 }");
96 static inline const QString LOG_EVENT_FILLING_SEAT = QStringLiteral(
"Filling seat %1...");
97 static inline const QString LOG_EVENT_DIRECT_SEAT_FILL = QStringLiteral(
"Only one candidate remains, seat can be filled directly.");
98 static inline const QString LOG_EVENT_RUNOFF_CANDIDATES = QStringLiteral(R
"("%1" & "%2" advance to the runoff.)");
99 static inline const QString LOG_EVENT_NO_RUNOFF = QStringLiteral(
"The number of candidates could not be narrowed to two in order to perform the runoff.");
100 static inline const QString LOG_EVENT_DEFACTO_WINNER_SEAT_FILL = QStringLiteral(R
"(Filling seat with defacto winner "%1")");
101 static inline const QString LOG_EVENT_PERFORM_PRIMARY_RUNOFF = QStringLiteral(
"Performing primary runoff...");
104 static inline const QString LOG_EVENT_FINAL_RESULTS = QStringLiteral(
110 "Unresolved Candidates:\n"
113 "Unfilled Seats: %3\n"
117 static inline const QString LOG_EVENT_CALC_FINISH = QStringLiteral(
"Calculation complete.");
120 static inline const QString LIST_ITEM_CANDIDATE_TOTAL_SCORE = QStringLiteral(
"\t- \"%1\" <%2>");
121 static inline const QString LIST_ITEM_RANK = QStringLiteral(
"\t%1) { \"%2\" } <%3>");
122 static inline const QString LIST_ITEM_SEAT = QStringLiteral(
"\t%1) \"%2\"");
123 static inline const QString LIST_ITEM_UNRESOLVED = QStringLiteral(
"\t- \"%1\"");
124 static inline const QString LIST_ITEM_NONE = QStringLiteral(
"\t *NONE*");
129 std::unique_ptr<HeadToHeadResults> mHeadToHeadResults;
147 QualifierResult performRunoffQualifier(
const QList<Rank>& scoreRankings)
const;
148 bool checkForDefactoWinner(
const QString& firstSeed,
const QSet<QString>& overflow)
const;
149 QString performRunoff(std::pair<QString, QString> candidates)
const;
152 QList<Rank> rankByScore(
const QSet<QString>& candidates,
Rank::Order order)
const;
153 QList<Rank> rankByVotesOfMaxScore(
const QSet<QString>& candidates,
Rank::Order order)
const;
154 QList<Rank> rankByHeadToHeadLosses(
const QSet<QString>& candidates,
const HeadToHeadResults* hth,
Rank::Order order)
const;
155 QList<Rank> rankByHeadToHeadPreferences(
const QSet<QString>& candidates,
const HeadToHeadResults* hth,
Rank::Order order)
const;
156 QList<Rank> rankByHeadToHeadMargin(
const QSet<QString>& candidates,
const HeadToHeadResults* hth,
Rank::Order order)
const;
158 QSet<QString> rankBasedTiebreak(
const QList<Rank>& rankings,
const QString& note)
const;
159 QSet<QString> breakTieMostFiveStar(
const QSet<QString>& candidates)
const;
160 QSet<QString> breakTieHighestScore(
const QSet<QString>& candidates)
const;
161 QString breakTieRandom(
const QSet<QString>& candidates)
const;
164 QString createCandidateGeneralSetString(
const QSet<QString>& candidates)
const;
165 QString createCandidateToalScoreSetString(
const QSet<QString>& candidates)
const;
166 QString createCandidateRankListString(
const QList<Rank>& ranks)
const;
174 void setElection(
const Election* election);
175 void setOptions(
Options options);