mggg / VoteKit

A Swiss Army Knife for computational social choice research
https://votekit.readthedocs.io/en/latest/
MIT License
10 stars 12 forks source link

Enable points based voting #118

Closed cdonnay closed 7 months ago

cdonnay commented 9 months ago

Here are some updates that allow for points based voting methods, as well as some general features.

  1. Added a by_bloc parameter to generate_profile. If True, this returns a dictionary of PreferenceProfiles by bloc. This is very helpful for analyzing the behavior of a single bloc of voters. Defaults to False for backwards compatibility.
  2. Created a Cumulative ballot generator class. The Cumulative class works like PL, but samples with replacement instead of without. The ranking order does not matter here, simply that candidates are listed on the ballot with multiplicity.
  3. Created a HighestScore election class. This takes in a profile and a score vector, and returns the $m$ candidates with highest scores. There is a lot of flexibility in the score vector, so this class can run things like Borda, cumulative, etc.
  4. Created a Cumulative election class which is just a subclass of HighestScore with the score vector set to all 1s. Thus anyone appearing on the ballot gets one point for each time they appear.
  5. Wrote an __add__ method for PreferenceProfile that combines the ballot lists of two profiles.
  6. Created utility functions to compute the winners of a profile given a score vector, as well as to validate a score vector (non-negative and non-increasing).

I did not make Borda a subclass of HighestScore since it seems like there are some finer details about how short ballots/overvotes are handled in the existing Borda class.

@jamesturk @drdeford @jgibson517 @jennjwang @ziglaser

cdonnay commented 9 months ago
  1. Added a Limited ballot generator, which operates just like PL but for when the ranking is not necessarily full.
  2. Made PlackettLuce a subclass of Limited.
cdonnay commented 7 months ago
  1. Added tests for add method of PreferenceProfile.
  2. Raised a warning in computing scores from score vectors.
  3. Renamed Limited class to shortPlackettLuce.