- class svvamp.RuleWoodall(**kwargs)[source]#
Woodall Rule.
Options#
>>> RuleWoodall.print_options_parameters() cm_option: ['fast', 'slow', 'very_slow', 'exact']. Default: 'fast'. icm_option: ['exact']. Default: 'exact'. iia_subset_maximum_size: is_number. Default: 2. im_option: ['lazy', 'exact']. Default: 'lazy'. tm_option: ['exact']. Default: 'exact'. um_option: ['lazy', 'exact']. Default: 'lazy'.
Notes
Each voter must provide a strict total order. Among the candidates of the Smith set (in the sense of
smith_set_rk
), elect the one that is eliminated latest byRuleIRV
.is_cm_()
:cm_option
='fast'
: Rely onRuleIRV
’s fast algorithm. Polynomial heuristic. Can prove CM but unable to decide non-CM (except in rare obvious cases).cm_option
='slow'
: Rely onRuleExhaustiveBallot
’s exact algorithm. Non-polynomial heuristic (\(2^{n_c}\)). Quite efficient to prove CM or non-CM.cm_option
='very_slow'
: Rely onRuleIRV
’s exact algorithm. Non-polynomial heuristic (\(n_c!\)). Very efficient to prove CM or non-CM.cm_option
='exact'
: Non-polynomial algorithm from superclassRule
.
Each algorithm above exploits the faster ones. For example, if
cm_option
='very_slow'
, SVVAMP tries the fast algorithm first, then the slow one, then the ‘very slow’ one. As soon as it reaches a decision, computation stops.
Woodall does not
meets_condorcet_c_ut_abs_ctb
:>>> profile = Profile(preferences_ut=[ ... [ 0. , 0.5, -0.5], ... [ 0.5, -0.5, 1. ], ... ], preferences_rk=[ ... [1, 0, 2], ... [2, 0, 1], ... ]) >>> RuleWoodall()(profile).w_ 1 >>> profile.condorcet_winner_ut_abs_ctb 0
Woodall does not
meets_condorcet_c_ut_rel
:>>> profile = Profile(preferences_ut=[ ... [ 1. , 1. , 1. ], ... [ 0.5, -0.5, 1. ], ... ], preferences_rk=[ ... [0, 1, 2], ... [2, 0, 1], ... ]) >>> RuleWoodall()(profile).w_ 0 >>> profile.condorcet_winner_ut_rel 2
References
‘Four Condorcet-Hare Hybrid Methods for Single-Winner Elections’, James Green-Armytage, 2011.
Examples
>>> profile = Profile(preferences_ut=[ ... [ 0. , -0.5, -1. ], ... [ 1. , -1. , 0.5], ... [ 0.5, 0.5, -0.5], ... [ 0.5, 0. , 1. ], ... [-1. , -1. , 1. ], ... ], preferences_rk=[ ... [0, 1, 2], ... [0, 2, 1], ... [1, 0, 2], ... [2, 0, 1], ... [2, 1, 0], ... ]) >>> rule = RuleWoodall()(profile) >>> rule.demo_results_(log_depth=0) ************************ * * * Election Results * * * ************************ *************** * Results * *************** profile_.preferences_ut (reminder) = [[ 0. -0.5 -1. ] [ 1. -1. 0.5] [ 0.5 0.5 -0.5] [ 0.5 0. 1. ] [-1. -1. 1. ]] profile_.preferences_rk (reminder) = [[0 1 2] [0 2 1] [1 0 2] [2 0 1] [2 1 0]] ballots = [[0 1 2] [0 2 1] [1 0 2] [2 0 1] [2 1 0]] scores = [[1 0 0] [2 0 1]] candidates_by_scores_best_to_worst [0, 2, 1] scores_best_to_worst [[1 0 0] [2 1 0]] w = 0 score_w = [1 2] total_utility_w = 1.0 ********************************* * Condorcet efficiency (rk) * ********************************* w (reminder) = 0 condorcet_winner_rk_ctb = 0 w_is_condorcet_winner_rk_ctb = True w_is_not_condorcet_winner_rk_ctb = False w_missed_condorcet_winner_rk_ctb = False condorcet_winner_rk = 0 w_is_condorcet_winner_rk = True w_is_not_condorcet_winner_rk = False w_missed_condorcet_winner_rk = False *************************************** * Condorcet efficiency (relative) * *************************************** w (reminder) = 0 condorcet_winner_ut_rel_ctb = 0 w_is_condorcet_winner_ut_rel_ctb = True w_is_not_condorcet_winner_ut_rel_ctb = False w_missed_condorcet_winner_ut_rel_ctb = False condorcet_winner_ut_rel = 0 w_is_condorcet_winner_ut_rel = True w_is_not_condorcet_winner_ut_rel = False w_missed_condorcet_winner_ut_rel = False *************************************** * Condorcet efficiency (absolute) * *************************************** w (reminder) = 0 condorcet_admissible_candidates = [ True False False] w_is_condorcet_admissible = True w_is_not_condorcet_admissible = False w_missed_condorcet_admissible = False weak_condorcet_winners = [ True False False] w_is_weak_condorcet_winner = True w_is_not_weak_condorcet_winner = False w_missed_weak_condorcet_winner = False condorcet_winner_ut_abs_ctb = 0 w_is_condorcet_winner_ut_abs_ctb = True w_is_not_condorcet_winner_ut_abs_ctb = False w_missed_condorcet_winner_ut_abs_ctb = False condorcet_winner_ut_abs = 0 w_is_condorcet_winner_ut_abs = True w_is_not_condorcet_winner_ut_abs = False w_missed_condorcet_winner_ut_abs = False resistant_condorcet_winner = nan w_is_resistant_condorcet_winner = False w_is_not_resistant_condorcet_winner = True w_missed_resistant_condorcet_winner = False >>> rule.demo_manipulation_(log_depth=0) ***************************** * * * Election Manipulation * * * ***************************** ********************************************* * Basic properties of the voting system * ********************************************* with_two_candidates_reduces_to_plurality = True is_based_on_rk = True is_based_on_ut_minus1_1 = False meets_iia = False **************************************************** * Manipulation properties of the voting system * **************************************************** Condorcet_c_ut_rel_ctb (False) ==> Condorcet_c_ut_rel (False) || || || Condorcet_c_rk_ctb (False) ==> Condorcet_c_rk (True) || || || || || || || V V || || V V Condorcet_c_ut_abs_ctb (False) ==> Condorcet_ut_abs_c (True) || || || || || V V || || maj_fav_c_rk_ctb (True) ==> maj_fav_c_rk (True) || || || || || V V V V majority_favorite_c_ut_ctb (True) ==> majority_favorite_c_ut (True) || || V V IgnMC_c_ctb (True) ==> IgnMC_c (True) || || V V InfMC_c_ctb (True) ==> InfMC_c (True) ***************************************************** * Independence of Irrelevant Alternatives (IIA) * ***************************************************** w (reminder) = 0 is_iia = True log_iia: iia_subset_maximum_size = 2.0 example_winner_iia = nan example_subset_iia = nan ********************** * c-Manipulators * ********************** w (reminder) = 0 preferences_ut (reminder) = [[ 0. -0.5 -1. ] [ 1. -1. 0.5] [ 0.5 0.5 -0.5] [ 0.5 0. 1. ] [-1. -1. 1. ]] v_wants_to_help_c = [[False False False] [False False False] [False False False] [False False True] [False False True]] ************************************ * Individual Manipulation (IM) * ************************************ is_im = nan log_im: im_option = lazy candidates_im = [ 0. 0. nan] ********************************* * Trivial Manipulation (TM) * ********************************* is_tm = False log_tm: tm_option = exact candidates_tm = [0. 0. 0.] ******************************** * Unison Manipulation (UM) * ******************************** is_um = nan log_um: um_option = lazy candidates_um = [ 0. 0. nan] ********************************************* * Ignorant-Coalition Manipulation (ICM) * ********************************************* is_icm = False log_icm: icm_option = exact candidates_icm = [0. 0. 0.] necessary_coalition_size_icm = [0. 6. 4.] sufficient_coalition_size_icm = [0. 6. 4.] *********************************** * Coalition Manipulation (CM) * *********************************** is_cm = nan log_cm: cm_option = fast, um_option = lazy, tm_option = exact candidates_cm = [ 0. 0. nan] necessary_coalition_size_cm = [0. 1. 2.] sufficient_coalition_size_cm = [0. 2. 4.]
- property candidates_by_scores_best_to_worst_#
1d array of integers. All candidates, sorted from the winner to the last candidate in the election’s result.
Default behavior:
candidates_by_scores_best_to_worst[k]
is the candidate withk
-th highest value inscores_
. By definition,candidates_by_scores_best_to_worst[0]
=w_
.
- property scores_#
Scores of the candidates in the election.
See specific documentation for each voting rule. Typical type in most subclasses: 1d or 2d array. Typical behavior in most subclasses:
If
scores_
is a 1d array, thenscores_[c]
is the numerical score for candidatec
.If
scores_
is a 2d array, thenscores_[:, c]
is the score vector for candidatec
.
It is not mandatory to follow this behavior.
- property w_#
>>> profile = Profile(preferences_ut=[ ... [3, 0, 1, 2], ... [0, 1, 2, 3], ... [0, 3, 2, 1], ... [0, 3, 2, 1], ... [3, 0, 2, 1], ... [1, 0, 2, 3], ... ], preferences_rk=[ ... [0, 3, 2, 1], ... [3, 2, 1, 0], ... [1, 2, 3, 0], ... [1, 2, 3, 0], ... [0, 2, 3, 1], ... [3, 2, 0, 1], ... ]) >>> rule = RuleWoodall()(profile) >>> rule.w_ 3