Overview

We have three types of collective decision procedures:

  1. Voting Method: given edata, outputs a sorted list of candidates, representing tied winners;

  2. Probabilistic Voting Method: given edata, outputs a dictionary whose keys are candidates and whose values are probabilities;

  3. Social Welfare Function: given edata, outputs a Ranking of the candidates.

We further categorize collective decision procedures based on the input from the voters:

  1. Ordinal procedures take as input a Profile, ProfilesWithTies, MajorityGraph, MarginGraph, and/or SupportGraph. These procedures are discussed in the following:

  2. Cardinal procedures take as input a UtilityProfile and/or a GradeProfile. These procedures are discussed in the following:

VotingMethod Class and Decorator

class pref_voting.voting_method.VotingMethod(vm, name=None, properties=None, input_types=None, skip_registration=False)[source]

A class to add functionality to voting methods.

Parameters:
  • vm (function) – An implementation of a voting method. The function should accept a Profile, ProfileWithTies, MajorityGraph, and/or MarginGraph, and a keyword parameter curr_cands to find the winner after restricting to curr_cands.

  • name (string) – The Human-readable name of the voting method.

  • properties (VotingMethodProperties) – The properties of the voting method.

  • input_types (list) – The types of input that the voting method can accept.

choose(edata, curr_cands=None)[source]

Return a randomly chosen element from the winning set.

display(edata, curr_cands=None, cmap=None, **kwargs)[source]

Display the winning set of candidates.

prob(edata, curr_cands=None)[source]

Return a dictionary representing the even-chance tiebreaking for the voting method.

set_name(new_name)[source]

Set the name of the voting method.

pref_voting.voting_method.vm(name=None, properties=None, input_types=None, skip_registration=False)[source]

A decorator used when creating a voting method.

ProbVotingMethod Function Class and Decorator

class pref_voting.prob_voting_method.ProbVotingMethod(pvm, name=None)[source]

A class to add functionality to probabilistic voting methods

Parameters:
  • pvm (function) – An implementation of a probabilistic voting method. The function should accept any type of profile, and a keyword parameter curr_cands to find the winner after restricting to curr_cands.

  • name (string) – The human-readable name of the social welfare function.

choose(edata, curr_cands=None, **kwargs)[source]

Return a randomly chosen element according to the probability.

display(edata, curr_cands=None, cmap=None, **kwargs)[source]

Display the winning set of candidates.

set_name(new_name)[source]

Set the name of the social welfare function.

support(edata, curr_cands=None, **kwargs)[source]

Return the sorted list of the set of candidates that have non-zero probability.

pref_voting.prob_voting_method.pvm(name=None)[source]

A decorator used when creating a social welfare function.

SocialWelfareFunction Class and Decorator

class pref_voting.social_welfare_function.SocialWelfareFunction(swf, name=None)[source]

A class to add functionality to social welfare functions

Parameters:
  • swf (function) – An implementation of a voting method. The function should accept any type of profile, and a keyword parameter curr_cands to find the winner after restricting to curr_cands.

  • name (string) – The Human-readable name of the social welfare function.

display(edata, curr_cands=None, **kwargs)[source]

Display the result of the social welfare function.

set_name(new_name)[source]

Set the name of the social welfare function.

winners(edata, curr_cands=None, **kwargs)[source]

Return a sorted list of the first place candidates.

pref_voting.social_welfare_function.swf(name=None)[source]

A decorator used when creating a social welfare function.

Helper Functions: Converting between Voting Methods and Social Welfare Functions

pref_voting.helper.swf_from_vm(vm, tie_breaker=None)[source]

Given a voting method, returns a social welfare function that uses the voting method to rank the candidates (winners are ranked first; then they are excluded from curr_cands and the new winners are ranked second; etc.).

Parameters:
  • vm (function) – A voting method.

  • tie_breaker (str) – The tie-breaking method to use. Options are “alphabetic”, “random”, and None. Default is None.

Returns:

A social welfare function that uses the voting method to rank the candidates.

Return type:

function

pref_voting.helper.vm_from_swf(swf)[source]

Given a social welfare function, returns a voting method that selects all the candidates ranked first according to the swf.

Parameters:

swf (function) – A social welfare function.

Returns:

A voting method that uses the swf to find the winning set.

Return type:

function