Invariance Axioms¶
Block Invariance¶
- pref_voting.invariance_axioms.has_block_invariance_violation(edata, vm, verbose=False)[source]¶
Returns True if adding a block of all linear orders changes the set of winners.
- Parameters:
edata (Profile, ProfileWithTies) – the election data.
vm (VotingMethod) – A voting method to test.
verbose (bool, default=False) – If a violation is found, display the violation.
- Returns:
Returns True if there is a violation and False otherwise.
- Return type:
Result of the test (bool)
- pref_voting.invariance_axioms.find_all_block_invariance_violations(edata, vm, verbose=False)[source]¶
Returns the symmetric difference of the winners before and after adding a block of all linear orders.
- Parameters:
edata (Profile, ProfileWithTies) – the election data.
vm (VotingMethod) – A voting method to test.
verbose (bool, default=False) – If a violation is found, display the violation.
- Returns:
A list of the symmetric difference between the old and new winners.
- Return type:
return_value
Upward Block Preservation¶
- pref_voting.invariance_axioms.has_upward_block_preservation_violation(edata, vm, verbose=False)[source]¶
Returns True if adding a block of all linear orders causes some winner to lose.
- Parameters:
edata (Profile, ProfileWithTies) – the election data.
vm (VotingMethod) – A voting method to test.
verbose (bool, default=False) – If a violation is found, display the violation.
- Returns:
Returns True if there is a violation and False otherwise.
- Return type:
Result of the test (bool)
- pref_voting.invariance_axioms.find_all_upward_block_preservation_violations(edata, vm, verbose=False)[source]¶
Returns the set of winners who lose as a result of adding a block of all linear orders.
- Parameters:
edata (Profile, ProfileWithTies) – the election data.
vm (VotingMethod) – A voting method to test.
verbose (bool, default=False) – If a violation is found, display the violation.
- Returns:
the set of winners who lose as a result of adding a block of all linear orders.
- Return type:
return_value
Upward Block Preservation¶
- pref_voting.invariance_axioms.has_downward_block_preservation_violation(edata, vm, verbose=False)[source]¶
Returns True if adding a block of all linear orders causes some loser to win.
- Parameters:
edata (Profile, ProfileWithTies) – the election data.
vm (VotingMethod) – A voting method to test.
verbose (bool, default=False) – If a violation is found, display the violation.
- Returns:
Returns True if there is a violation and False otherwise.
- Return type:
Result of the test (bool)
- pref_voting.invariance_axioms.find_all_downward_block_preservation_violations(edata, vm, verbose=False)[source]¶
Returns the set of losers who win as a result of adding a block of all linear orders.
- Parameters:
edata (Profile, ProfileWithTies) – the election data.
vm (VotingMethod) – A voting method to test.
verbose (bool, default=False) – If a violation is found, display the violation.
- Returns:
the set of losers who win as a result of adding a block of all linear orders.
- Return type:
return_value
Homogeneity¶
- pref_voting.invariance_axioms.has_homogeneity_violation(edata, vm, num_copies, verbose=False)[source]¶
Returns True if replacing each ranking with num_copies of that ranking changes the set of winners.
- Parameters:
edata (Profile, ProfileWithTies) – the election data.
vm (VotingMethod) – A voting method to test.
num_copies (int) – The number of copies to multiply each ranking by.
verbose (bool, default=False) – If a violation is found, display the violation.
- Returns:
Returns True if there is a violation and False otherwise.
- Return type:
Result of the test (bool)
- pref_voting.invariance_axioms.find_all_homogeneity_violations(edata, vm, num_copies, verbose=False)[source]¶
Returns the symmetric difference of the winners before and after multiplying the number of copies of each ranking.
- Parameters:
edata (Profile, ProfileWithTies) – the election data.
vm (VotingMethod) – A voting method to test.
num_copies (int) – The number of copies to multiply each ranking by.
verbose (bool, default=False) – If a violation is found, display the violation.
- Returns:
A list of the symmetric difference between the old and new winners.
- Return type:
return_value
Upward Homogeneity¶
- pref_voting.invariance_axioms.has_upward_homogeneity_violation(edata, vm, num_copies, verbose=False)[source]¶
Returns True if replacing each ranking with num_copies of that ranking causes some winner to lose.
- Parameters:
edata (Profile, ProfileWithTies) – the election data.
vm (VotingMethod) – A voting method to test.
num_copies (int) – The number of copies to multiply each ranking by.
verbose (bool, default=False) – If a violation is found, display the violation.
- Returns:
Returns True if there is a violation and False otherwise.
- Return type:
Result of the test (bool)
- pref_voting.invariance_axioms.find_all_upward_homogeneity_violations(edata, vm, num_copies, verbose=False)[source]¶
Returns the set of winners who lose as a result of replacing each ranking with num_copies of that ranking.
- Parameters:
edata (Profile, ProfileWithTies) – the election data.
vm (VotingMethod) – A voting method to test.
num_copies (int) – The number of copies to multiply each ranking by.
verbose (bool, default=False) – If a violation is found, display the violation.
- Returns:
the set of winners who lose as a result of replacing each ranking with num_copies of that ranking.
- Return type:
return_value
Downward Homogeneity¶
- pref_voting.invariance_axioms.has_downward_homogeneity_violation(edata, vm, num_copies, verbose=False)[source]¶
Returns True if replacing each ranking with num_copies of that ranking causes some loser to win.
- Parameters:
edata (Profile, ProfileWithTies) – the election data.
vm (VotingMethod) – A voting method to test.
num_copies (int) – The number of copies to multiply each ranking by.
verbose (bool, default=False) – If a violation is found, display the violation.
- Returns:
Returns True if there is a violation and False otherwise.
- Return type:
Result of the test (bool)
- pref_voting.invariance_axioms.find_all_downward_homogeneity_violations(edata, vm, num_copies, verbose=False)[source]¶
Returns the set of losers who win as a result of replacing each ranking with num_copies of that ranking.
- Parameters:
edata (Profile, ProfileWithTies) – the election data.
vm (VotingMethod) – A voting method to test.
num_copies (int) – The number of copies to multiply each ranking by.
verbose (bool, default=False) – If a violation is found, display the violation.
- Returns:
the set of losers who win as a result of replacing each ranking with num_copies of that ranking.
- Return type:
return_value
Preferential Equality¶
- pref_voting.invariance_axioms.has_preferential_equality_violation(prof, vm, verbose=False)[source]¶
Check if a profile has a preferential equality violation for the voting method vm.
See Definition 2.1 and Lemma 2.4 from the paper “Characterizations of voting rules based on majority margins” by Y. Ding, W. Holliday, and E. Pacuit.
- pref_voting.invariance_axioms.find_all_preferential_equality_violations(prof, vm, verbose=False)[source]¶
Return all the preferential equality violations for the voting method vm. Returns a list of tuples of three profiles (prof, prof_I, prof_J) such that vm(prof_I) != vm(prof_J) and prof_I and prof_J are as defined Lemma 2.4 from the paper “Characterizations of voting rules based on majority margins” by Y. Ding, W. Holliday, and E. Pacuit (see also Definition 2.1).