Overview¶
We have three types of collective decision procedures:
Voting Method: given edata, outputs a sorted list of candidates, representing tied winners;
Probabilistic Voting Method: given edata, outputs a dictionary whose keys are candidates and whose values are probabilities;
Social Welfare Function: given edata, outputs a Ranking of the candidates.
We further categorize collective decision procedures based on the input from the voters:
Ordinal procedures take as input one or more of the following types of edata: Profile, ProfilesWithTies, MajorityGraph, MarginGraph, and SupportGraph. These procedures are discussed in the following:
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, input_types=None, skip_registration=False, properties_file=None)[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 tocurr_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.
- check_property(prop, include_counterexample=True)[source]¶
Check if the voting method satisfies a property.
- display(edata, curr_cands=None, cmap=None, **kwargs)[source]¶
Display the winning set of candidates.
- get_violation_witness(prop, minimal_resolute=False, minimal=False)[source]¶
Return the election that witnesses a violation of prop.
- prob(edata, curr_cands=None)[source]¶
Return a dictionary representing the even-chance tiebreaking for the voting method.
- save_properties(filename=None, timeout=10)[source]¶
Save the properties of the voting method to a JSON file.
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 tocurr_cands
.name (string) – The human-readable name of the social welfare function.
- Returns:
A dictionary that represents the probability on the set of candidates.
- choose(edata, curr_cands=None, **kwargs)[source]¶
Return a randomly chosen element according to the probability.
SocialWelfareFunction Class and Decorator¶
A class to add functionality to social welfare functions
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 tocurr_cands
.name (string) – The Human-readable name of the social welfare function.
A ranking (Ranking) of the candidates.
Display the result of the social welfare function.
Set the name of the social welfare function.
Return a sorted list of the first place candidates.
A decorator used when creating a social welfare function.