- class svvamp.RuleSTAR(**kwargs)[source]#
STAR (Scoring Then Automatic Runoff).
- Parameters:
min_grade (number) – Minimal grade allowed.
max_grade (number) – Maximal grade allowed.
step_grade (number) –
Interval between two consecutive allowed grades.
If
step_grade = 0
, all grades in the interval [min_grade
,max_grade
] are allowed (‘continuous’ set of grades).If
step_grade > 0
, authorized grades are the multiples ofstep_grade
lying in the interval [min_grade
,max_grade
]. In addition, the gradesmin_grade
andmax_grade
are always authorized, even if they are not multiples ofstep_grade
.
rescale_grades (bool) –
Whether sincere voters rescale their utilities to produce grades.
If
rescale_grades
=True
, then each sincere voterv
applies an affine transformation to send her utilities into the interval [min_grade
,max_grade
].If
rescale_grades
=False
, then each sincere voterv
clips her utilities into the interval [min_grade
,max_grade
].
See
ballots
for more details.Options
------- –
>>> RuleSTAR.print_options_parameters() cm_option: ['exact']. Default: 'exact'. icm_option: ['exact']. Default: 'exact'. iia_subset_maximum_size: is_number. Default: 2. im_option: ['exact']. Default: 'exact'. max_grade: isfinite. Default: 1. min_grade: isfinite. Default: 0. rescale_grades: is_bool. Default: True. step_grade: isfinite. Default: 0. tm_option: ['exact']. Default: 'exact'. um_option: ['exact']. Default: 'exact'.
Notes
Each voter attributes a grade to each candidate. By default, authorized grades are all numbers in the interval [
min_grade
,max_grade
]. To use a discrete set of notes, modify attributestep_grade
.The two candidates with highest average grades are selected for a virtual second round. During this second round, the two candidates are compared by majority voting: the score of one candidate is the number of voters who gave her a strictly larger grade than to the other candidate.
Default behavior of sincere voters: voter
v
applies an affine transformation to her utilitiespreferences_ut
[v, :]
to get her grades, such that her least-liked candidate receivesmin_grade
and her most-liked candidate receivesmax_grade
. To modify this behavior, use attributerescale_grades
. For more details about the behavior of sincere voters, seeballots
.is_cm_()
,is_icm_()
,is_im_()
,is_tm_()
,is_um_()
: Exact in polynomial time.
STAR does not
meets_majority_favorite_c_ut
:>>> profile = Profile(preferences_ut=[ ... [ 0. , 0. , 0. , -1. , -0.5, 0. ], ... [ 0.5, 0.5, 0.5, 1. , 0. , -1. ], ... [ 0. , -0.5, -1. , 1. , -1. , -1. ], ... ], preferences_rk=[ ... [2, 0, 5, 1, 4, 3], ... [3, 0, 1, 2, 4, 5], ... [3, 0, 1, 4, 5, 2], ... ]) >>> RuleSTAR()(profile).w_ 0 >>> profile.majority_favorite_ut 3
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 = RuleSTAR()(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 = [[1. 0.5 0. ] [1. 0. 0.75] [1. 1. 0. ] [0.5 0. 1. ] [0. 0. 1. ]] scores = [[3.5 1.5 2.75] [3. 0. 2. ]] candidates_by_scores_best_to_worst [0 2 1] scores_best_to_worst [[3.5 2.75 1.5 ] [3. 2. 0. ]] w = 0 score_w = [3.5 3. ] 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 = False is_based_on_rk = False 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 (False) || || || || || || || V V || || V V Condorcet_c_ut_abs_ctb (False) ==> Condorcet_ut_abs_c (False) || || || || || V V || || maj_fav_c_rk_ctb (False) ==> maj_fav_c_rk (False) || || || || || V V V V majority_favorite_c_ut_ctb (False) ==> majority_favorite_c_ut (False) || || 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 = False log_im: im_option = exact candidates_im = [0. 0. 0.] ********************************* * Trivial Manipulation (TM) * ********************************* is_tm = False log_tm: tm_option = exact candidates_tm = [0. 0. 0.] ******************************** * Unison Manipulation (UM) * ******************************** is_um = False log_um: um_option = exact candidates_um = [0. 0. 0.] ********************************************* * 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 = False log_cm: cm_option = exact candidates_cm = [0. 0. 0.] necessary_coalition_size_cm = [0. 3. 3.] sufficient_coalition_size_cm = [0. 3. 3.]
- property candidates_by_scores_best_to_worst_#
1d array of integers.
candidates_by_scores_best_to_worst[k]
is the candidate withk
-th best score. Finalists are sorted by their score at second round. Other candidates are sorted by their score at first round.
- property scores_#
2d array of numbers.
scores_[0, c]
is the total grade of candidatec
.scores_[1, c]
the number of voters who vote forc
during the second round (and 0 ifc
is not selected for the second round).