This is a major update to VoteKit that includes some breaking changes for the API and a major refactoring of the code base to make it more organized, maintainable, and (hopefully) easier to contribute to in the future.
Added
- The election methods thanks to @kevin-q2. The newest election methods are
PluralityVeto
,
RandomDictator
, andBoostedRandomDictator
. - More comprehensive tests for the
Ballot
class. - More comprehensive tests for all of the election types.
- More comprehensive tests for the
PreferenceProfile
class. - Tests for potential errors in the
BallotGenerator
classes.
Changed
-
Moved the following election methods to sorted folders in
src/votekit/elections/election_types
:approval
Approval
BlockPlurality
ranking
RankingElection
Alaska
BoostedRandomDictator
Borda
CondoBorda
DominatingSets
PluralityVeto
Plurality
SNTV
RandomDictator
scores
GeneralRating
Limited
Rating
Cumulative
-
Updated / added the following methods to
src/votekit/utils.py
:ballots_by_first_cand
remove_cand
add_missing_cands
validate_score_vector
score_profile
first_place_votes
mentions
borda_scores
tie_broken_ranking
score_dict_to_ranking
elect_cands_from_set_ranking
expand_tied_ballot
resolve_profile_ties
-
Changed the way that the
ElectionState
class operates. It now operates as a dataclass
storing the following data:round_number
: The round number of the election.remaining
: The remaining candidates in the election that have not been elected.elected
: The set of candidates that have been elected.eliminated
: The set of candidates that have been eliminated.tiebreak_winners
: The set of candidates that were elected due to a tiebreak within a round.scores
: The scores for each candidate in the election.
-
The
PreferenceProfile
class is now a frozen dataclass with the idea being that, once the
ballots and candidates for an election have been set, they should not be changed.- Several validators have also been added to the
PreferenceProfile
class to ensure that
the ballots and candidates are valid.
- Several validators have also been added to the
-
Updated all documentation to reflect major changes in the API of the package.
New Contributors
- @kevin-q2 made their first contribution in #130
- @peterrrock2 made their first contribution in #151
Full Changelog: v2.0.1...v3.0.0