""" File: axiom.py Author: Wes Holliday (wesholliday@berkeley.edu) and Eric Pacuit (epacuit@umd.edu) Date: April 27, 2023 Define the Axiom class. """
[docs]classAxiom(object):""" A class to represent voting method axioms. Args: name (string): The human-readable name of the axiom. has_violation (function): function that returns a Boolean which is True when there is a violation of the axiom. find_all_violations (function): function that returns all instances of violations of the axiom. satisfying_vms (list): list of voting methods satisfying the axiom. violating_vms (list): list of voting methods violating the axiom. """def__init__(self,name,has_violation,find_all_violations):self.name=nameself.has_violation=has_violationself.find_all_violations=find_all_violationsself.satisfying_vms=list()self.violating_vms=list()defsatisfies(vm):returnvm.nameinself.satisfying_vmsdefviolates(vm):returnvm.nameinself.violating_vmsdefadd_satisfying_vms(vms):self.satisfying_vms+=vmsdefadd_violating_vms(vms):self.violating_vms+=vms