- class svvamp.Rule(with_two_candidates_reduces_to_plurality=False, is_based_on_rk=False, is_based_on_ut_minus1_1=False, meets_iia=False, precheck_um=True, precheck_tm=True, precheck_icm=True, log_identity='RULE', **kwargs)[source]#
A voting rule.
- Parameters:
with_two_candidates_reduces_to_plurality (bool) –
True
iff, when using this voting system with only two candidates, it amounts to Plurality (with voter and candidate tie-breaking).is_based_on_rk (bool) –
True
iff this voting system is based only on strict rankings (no cardinal information, indifference not allowed).is_based_on_ut_minus1_1 (bool) –
True
iff:This voting system is based only on utilities (not rankings, i.e. does not depend on how voters break ties in their own preferences),
And for a
c
-manipulator (IM or CM), it is optimal to pretend thatc
has utility 1 and other candidates have utility -1.
meets_iia (bool) –
True
iff this voting system meets Independence of Irrelevant Alternatives.precheck_um (bool) – If
True
, then before computing CM, we check whether there is UM.precheck_tm (bool) – If
True
, then before computing CM, we check whether there is TM.precheck_icm (bool) – If
True
, then before computing CM, we check whether there is ICM. Remark: when the voting system meets InfMC_c_ctb, then precheck on ICM will not do better than other basic prechecks.kwargs – Additional keyword parameters. See
options_parameters
for allowed and default options.
Notes
This is an ‘abstract’ class. As an end-user, you should always use its subclasses
RuleApproval
,RulePlurality
, etc.This class and its subclasses are suitable for voting rules that are deterministic and anonymous (treating all voters equally). As a consequence, they are not neutral (because they need to break ties in totally symmetric situations). As of now, SVVAMP does not support other kinds of voting systems.
Ties in a voter’s utilities
When a sincere voter
v
must provide a strict order in a specific voting system, she usespreferences_rk
[v, :]
(which breaks possible ties in her utilities).In contrast, to know if a voter
v
wants to manipulate for a candidatec
againstw
, we always use her utilitiespreferences_ut
[v, :]
. If she attributes the same utility tow
andc
, she is not interested in this manipulation.Some ordinal voting systems in SVVAMP may be adapted to accept weak orders of preferences as ballots. This is future work.
Ties in the result of an election
The voting system itself may need to break ties, for example if candidates
c
andd
have the same score in a score-based system. The standard tie-breaking in SVVAMP, referred to as Candidate Tie-Breaking (CTB), consists of breaking ties by lowest index:c
is favored overd
ifc
<d
. This tie-breaking rule is used for example in ‘A note on manipulability of large voting schemes’ (Peleg, 1979). Future voting rules implemented as a subclass ofRule
may use another tie-breaking rule.Options for manipulation
Attributes allow to choose the algorithm used to compute different kinds of manipulation:
cm_option
,icm_option
,im_option
,tm_option
andum_option
.To know what options are accepted for a given voting system, use
options_parameters
. Here is a non-exhaustive list of typical values for these options.'exact'
: Exact algorithm. Can always decide manipulation: it answersTrue
orFalse
. Other algorithms may also answernumpy.nan
, which is the SVVAMP convention meaning that the algorithm was not able to decide. For a given voting system, if the exact algorithm runs in polynomial time, then it is the only accepted option.'slow'
: Non-polynomial algorithm, but not exact. For voting systems accepting this option, it is however faster than ‘exact’ (in a little-o sense) and more precise than ‘fast’.'fast'
: Polynomial algorithm, not exact. If the exact algorithm runs in polynomial time, this option is not available.'lazy'
: Perform only some preliminary checks. Run in polynomial time (unless deciding the winner of the election is not polynomial, like forKemeny
). Like other non-exact algorithms, it can decide manipulation toTrue
,False
or returnnumpy.nan
(undecided).
For a given voting system, the default option is the most precise algorithm running in polynomial time.
Option for Independence of Irrelevant Alternatives (IIA)
The default algorithm for
not_iia
first performs some preliminary checks based on the known properties of the voting system under study. For example, if it meets the Condorcet criterion, then the algorithm exploits if. If it meets the majority favorite criterion (see below) and ifw_
is a majority favorite, then it decides IIA immediately.If the preliminary checks do not allow to decide, the default algorithm then uses brute force to test subsets of candidates including the sincere winner
w_
. This can be non-polynomial or non-exact, depending on the attributeiia_subset_maximum_size
.Implication diagram between criteria
Cf. corresponding attributes below for the definition of these criteria. See Durand et al., ‘Condorcet Criterion and Reduction in Coalitional Manipulability’.
Condorcet_c_ut_rel_ctb ==> Condorcet_c_ut_rel || Condorcet_c_rk_ctb ==> Condorcet_c_rk || || || || || || || V V || || V V Condorcet_c_ut_abs_ctb ==> Condorcet_c_ut_abs || || || || || V V || || majority_favorite_c_rk_ctb ==> majority_favorite_c_rk || || || || || V V V V majority_favorite_c_ut_ctb ==> majority_favorite_ut_c || || V V IgnMC_c_ctb ==> IgnMC_c || || V V InfMC_c_ctb ==> InfMC_c
- property ballots_#
Ballots cast by the voters.
Default type: 2d array of integers. Default behavior:
ballots[v, k]
=preferences_rk
[v, k]
.
- property c_has_supporters_#
1d array of booleans.
c_has_supporters_[c]
isTrue
iff at least one voter prefers candidatec
to the sincere winnerw_
.
- 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 candidates_cm_#
1d array of booleans (or
numpy.nan
).candidates_cm_[c]
isTrue
if CM for candidatec
is possible,False
otherwise. If the algorithm cannot decide, thennumpy.nan
. For the sincere winnerw_
, we have by conventioncandidates_cm_[w_] = False
.
- property candidates_icm_#
1d array of booleans (or
numpy.nan
).candidates_icm_[c]
isTrue
if ICM for candidatec
is possible,False
otherwise. If the algorithm cannot decide, thennumpy.nan
. For the sincere winnerw_
, we have by conventioncandidates_icm[w_] = False
.
- property candidates_im_#
1d array of booleans (or
numpy.nan
).candidates_im[c]
isTrue
if there exists a voter who can manipulate for candidatec
,False
otherwise. If the algorithm cannot decide, thennumpy.nan
. For the sincere winnerw_
, we have by conventioncandidates_im_[w_] = False
.
- property candidates_tm_#
1d array of booleans (or
numpy.nan
).candidates_tm[c]
isTrue
if a TM for candidatec
is possible,False
otherwise. If the algorithm cannot decide, thennumpy.nan
(but as of now, this value is not never for TM). For the sincere winnerw_
, we have by conventioncandidates_tm[w] = False
.
- property candidates_um_#
1d array of booleans (or
numpy.nan
).candidates_um_[c]
isTrue
if UM for candidatec
is possible,False
otherwise. If the algorithm cannot decide, thennumpy.nan
. For the sincere winnerw_
, we have by conventioncandidates_um_[w_] = False
.
- classmethod check_option_allowed(option, value)[source]#
Check whether a pair (option, value) is allowed.
Examples
Raise an error if the option is not in
options_parameters
:>>> Rule.check_option_allowed('not_existing_option', 42) Traceback (most recent call last): ValueError: Option 'not_existing_option' is unknown for Rule.
Raise an error if the value is not authorized for this option:
>>> Rule.check_option_allowed('cm_option', 'unexpected_value') Traceback (most recent call last): ValueError: 'cm_option' = 'unexpected_value' is not allowed in Rule.
- property cm_option#
String. Option used to compute
is_cm_()
and related methods.To know what options are accepted for a given voting system, use
options_parameters
.
- property cm_power_index_#
CM power index. For each candidate c != w, it is n_s / x_c (where n_s is the number of sincere voters and x_c the minimal number of manipulators that can make c win (cf
necessary_coalition_size_cm_
). Globally, it is the max over the candidates c != w.
- demo_manipulation_(log_depth=1)[source]#
Demonstrate the manipulation methods of
Rule
class.- Parameters:
log_depth (int) – Integer from 0 (basic info) to 3 (verbose).
- demo_profile_(log_depth=1)[source]#
Demonstrate the attributes of the loaded profile.
- Parameters:
log_depth (int) – Integer from 0 (basic info) to 3 (verbose).
- demo_results_(log_depth=1)[source]#
Demonstrate the methods related to the result of the election (without manipulation).
- Parameters:
log_depth (int) – Integer from 0 (basic info) to 3 (verbose).
- property elects_condorcet_winner_rk_even_with_cm_#
True iff there is a Condorcet winner, she is elected by sincere voting and it is not CM.
- Type:
- property example_subset_iia_#
1d array of booleans. If the election is not IIA,
example_subset_iia
provides a subset of candidates breaking IIA.example_subset_iia[c]
isTrue
iff candidatec
belongs to the subset. If the election is IIA (or if the algorithm cannot decide), thenexample_subset_iia = numpy.nan
.
- property example_winner_iia_#
Integer (candidate). If the election is not IIA,
example_winner_iia
is the winner corresponding to the counter-exampleexample_subset_iia
. If the election is IIA (or if the algorithm cannot decide), thenexample_winner_iia = numpy.nan
.
- property icm_option#
String. Option used to compute
is_icm_()
and related methods.To know what options are accepted for a given voting system, use
options_parameters
.
- property iia_subset_maximum_size#
Float or
numpy.inf
. Maximum size of any subset of candidates that is used to computenot_iia()
(and related methods). For a given voting system, this attribute has no effect if there is an exact algorithm running in polynomial time implemented in SVVAMP.
- property im_option#
String. Option used to compute
is_im_()
and related methods.To know what options are accepted for a given voting system, use
options_parameters
.
- property is_cm_#
Boolean (or
numpy.nan
).True
if a CM is possible,False
otherwise. If the algorithm cannot decide, thennumpy.nan
.We say that a situation is Coalitionally Manipulable (CM) for
c
!=
w_
iff voters who preferc
tow_
can cast ballots so thatc
is elected (while other voters still vote sincerely).
- property is_icm_#
Boolean (or
numpy.nan
).True
if an ICM is possible,False
otherwise. If the algorithm cannot decide, thennumpy.nan
.We say that a situation is Ignorant-Coalition Manipulable (ICM) for
c
!=
w_
iff the voters who preferc
tow_
can cast ballots so that, whatever the other voters do,c
is elected.
- is_icm_c_with_bounds_(c)[source]#
Ignorant-Coalition Manipulation, focus on one candidate, with bounds.
- property is_iia_#
Boolean. Cf.
is_not_iia
.
- property is_im_#
Boolean.
True
if there exists a voter who can and wants to manipulate,False
otherwise. If the algorithm cannot decide, thennumpy.nan
.Voter
v
can and wants to manipulate for candidatec
iff:v
strictly prefersc
tow_
(in the sense ofpreferences_ut
).And by changing her vote, she can make
c
win instead ofw_
.
- property is_not_iia_#
Boolean.
True
if there exists a subset of candidates including the sincere winnerw_
, such that if the election is held with this subset of candidates, thenw_
is not the winner anymore. If the algorithm cannot decide, then the result isnumpy.nan
.
- property is_tm_#
Boolean (or
numpy.nan
).True
if TM is possible,False
otherwise. If the algorithm cannot decide, thennumpy.nan
(but as of now, this value is never used for TM).For ordinal voting systems, we call trivial manipulation for candidate
c
againstw_
the fact of puttingc
on top (compromising),w_
at the bottom (burying), while keeping a sincere order on the other candidates.For cardinal voting systems, we call trivial manipulation for
c
(againstw_
) the fact of putting the maximum grade forc
and the minimum grade for the other candidates.In both cases, the intuitive idea is the following: if I want to make
c
win and I only know that candidatew_
is ‘dangerous’ (but I know nothing else), then trivial manipulation is my ‘best’ strategy.We say that a situation is trivially manipulable for
c
(implicitly: coalitionally) iff, when all voters preferringc
to the sincere winnerw_
use trivial manipulation, candidatec
wins.
- property is_um_#
Boolean (or
numpy.nan
).True
if UM is possible,False
otherwise. If the algorithm cannot decide, thennumpy.nan
.We say that a situation is unison-manipulable for a candidate
c
!=
w_
iff all voters who preferc
to the sincere winnerw_
can cast the same ballot so thatc
is elected (while other voters still vote sincerely).
- log_(method_name)[source]#
Log corresponding to a particular manipulation method.
Examples
>>> rule = Rule() >>> rule.log_('whatever_iia_whatever') 'iia_subset_maximum_size = 2.0' >>> rule.log_('whatever_im_whatever') 'im_option = lazy' >>> rule.log_('whatever_icm_whatever') 'icm_option = lazy' >>> rule.log_('whatever_tm_whatever') 'tm_option = exact' >>> rule.log_('whatever_um_whatever') 'um_option = lazy' >>> rule.log_('whatever_cm_whatever') 'cm_option = lazy, um_option = lazy, icm_option = lazy, tm_option = exact'
- property log_iia_#
String. Parameters used to compute
is_not_iia_()
and related methods.
- property losing_candidates_#
1d of Integers. List of losing candidates, in a decreasing order of (heuristic) dangerousness
This attribute is mostly intended for SVVAMP developers. It is used in most manipulation algorithms. The idea is to try first the candidates for whom we think manipulation is more likely to succeed, in order to gain time.
Losing candidates are sorted from the ‘most dangerous’ to the ‘least dangerous’ (for the sincere winner
w_
). By default, they are sorted by their score againstw_
in thematrix_duels_ut
(which is the number of potential manipulators for a given candidate). This behavior can be redefined in the subclass implementing a specific voting system.
- property meets_condorcet_c_rk#
Boolean.
True
iff the voting system meets the Condorcet criterion (rk). I.e. if a candidate is acondorcet_winner_rk
, then she wins.Is implied by:
meets_condorcet_c_rk_ctb
.Implies:
meets_condorcet_c_ut_abs
,meets_majority_favorite_c_rk
.
- property meets_condorcet_c_rk_ctb#
if a candidate is a
condorcet_winner_rk_ctb
, she wins.Implies:
meets_condorcet_c_rk
,meets_condorcet_c_ut_abs_ctb
,meets_majority_favorite_c_rk_ctb
.- Type:
Boolean.
True
iff the voting system meets the ‘Condorcet criterion (rk) with ctb’. I.e.
- property meets_condorcet_c_ut_abs#
Boolean.
True
iff the voting system meets the absolute Condorcet criterion. I.e. if a candidate is acondorcet_winner_ut_abs
, then she wins.Is implied by:
meets_condorcet_c_rk
,meets_condorcet_c_ut_rel
,meets_condorcet_c_ut_abs_ctb
.Implies:
meets_majority_favorite_c_ut
.
- property meets_condorcet_c_ut_abs_ctb#
if a candidate is a
condorcet_winner_ut_abs_ctb
, she wins.Is implied by:
meets_condorcet_c_rk_ctb
,meets_condorcet_c_ut_rel_ctb
.Implies:
meets_condorcet_c_ut_abs
,meets_majority_favorite_c_ut_ctb
.- Type:
Boolean.
True
iff the voting system meets the ‘absolute Condorcet criterion with ctb’. I.e.
- property meets_condorcet_c_ut_rel#
Boolean.
True
iff the voting system meets the relative Condorcet criterion. I.e. if a candidate is acondorcet_winner_ut_rel
, then she wins.Is implied by:
meets_condorcet_c_ut_rel_ctb
.Implies:
meets_condorcet_c_ut_abs
.
- property meets_condorcet_c_ut_rel_ctb#
if a candidate is a
condorcet_winner_ut_rel_ctb
, she wins.Implies:
meets_condorcet_c_ut_rel
,meets_condorcet_c_ut_abs_ctb
.- Type:
Boolean.
True
iff the voting system meets the ‘relative Condorcet criterion with ctb’. I.e.
- property meets_ignmc_c#
Boolean.
True
iff the voting system meets the ignorant majority coalition criterion. I.e. any ignorant coalition of size strictly more thann_v
/2 can make any candidate win. See Durand et al.: ‘Condorcet Criterion and Reduction in Coalitional Manipulability’.Ignorant means that they can choose their ballot without knowing what other voters will do.
Is implied by:
meets_majority_favorite_c_ut
,meets_IgnMC_c_ctb
.Implies:
meets_InfMC_c
.
- property meets_ignmc_c_ctb#
Boolean.
True
iff the voting system meets the ‘ignorant majority coalition criterion with ctb’. I.e.:It
meets_IgnMC_c
,And any ignorant coalition of size
n_v
/2 can make candidate 0 win.
Is implied by:
meets_majority_favorite_c_ut_ctb
.Implies:
meets_InfMC_c_ctb
,meets_IgnMC_c
.
- property meets_infmc_c#
Boolean.
True
iff the voting system meets the informed majority coalition criterion. I.e. any informed coalition of size strictly more thann_v
/2 can make any candidate win. See Durand et al.: ‘Condorcet Criterion and Reduction in Coalitional Manipulability’.Informed means that they know other voters’ ballots before choosing their own.
Is implied by:
meets_IgnMC_c
,meets_InfMC_c_ctb
.
- property meets_infmc_c_ctb#
Boolean.
True
iff the voting system meets the ‘informed majority coalition criterion with ctb’. I.e.:It
meets_InfMC_c
,And any informed coalition of size
n_v
/2 can make candidate 0 win.
Is implied by:
meets_IgnMC_c_ctb
.Implies:
meets_InfMC_c
.
- property meets_majority_favorite_c_rk#
Boolean.
True
iff the voting system meets the majority favorite criterion (rk). I.e. if strictly more thann_v
/2 voters rank a candidate first (rk), then she wins.Is implied by:
meets_condorcet_c_rk
,meets_majority_favorite_c_rk_ctb
.Implies:
_meets_majority_favorite_c_ut
.
- property meets_majority_favorite_c_rk_ctb#
Boolean.
True
iff the voting system meets the ‘majority favorite criterion (rk) with ctb’. I.e.:And if
n_v
/2 voters rank candidate 0 first (rk), she wins.
Is implied by:
meets_condorcet_c_rk_ctb
.Implies:
meets_majority_favorite_c_ut_ctb
,meets_majority_favorite_c_rk
.
- property meets_majority_favorite_c_ut#
Boolean.
True
iff the voting system meets the majority favorite criterion (ut). I.e. if strictly more thann_v
/2 voters strictly prefer a candidate to all others (ut), she wins.Is implied by:
meets_condorcet_c_ut_abs
,meets_majority_favorite_c_ut_ctb
,meets_majority_favorite_c_rk
.Implies:
meets_IgnMC_c
.
- property meets_majority_favorite_c_ut_ctb#
Boolean.
True
iff the voting system meets the ‘majority favorite criterion (ut) with ctb’. I.e.:And if
n_v
/2 voters strictly prefer candidate 0 to all other candidates, she wins.
Is implied by:
meets_condorcet_c_ut_abs_ctb
,meets_majority_favorite_c_rk_ctb
.Implies:
meets_IgnMC_c_ctb
,meets_majority_favorite_c_ut
.
- property nb_candidates_cm_#
Number of candidates who can benefit from CM.
- property necessary_coalition_size_cm_#
1d array of integers.
necessary_coalition_size_cm_[c]
is the lower bound found by the algorithm for \(x_c\) (cf. below). For the sincere winnerw_
, we have by conventionnecessary_coalition_size_cm_[w_] = 0
.Internally, to decide the problem of CM, SVVAMP studies the following question. When considering the sub-population of voters who do not prefer
c
tow_
(sincere voters), what is the minimal number \(x_c\) ofc
-manipulators needed to perform CM? For all voting system currently implemented in SVVAMP, it means that CM is possible iff there are \(x_c\) voters or more who preferc
tow_
. (A sufficient condition on the voting system is that, if a population electsc
, then an additional voter may always cast a ballot so thatc
stays elected)For information only, the result of SVVAMP’s computations about \(x_c\) is given in outputs
necessary_coalition_size_cm_
andsufficient_coalition_size_cm_
. By definition, we havenecessary_coalition_size_cm_[c]
\(\leq x_c \leq\)sufficient_coalition_size_cm_[c]
.When
cm_option
='exact'
, the exactness concerns the CM decision problems (Boolean results), not the numerical evaluation of \(x_c\). It means that for all Boolean answers, SVVAMP will not answernumpy.nan
( undecided). But it is possible thatnecessary_coalition_size_cm_[c]
<sufficient_coalition_size_cm_[c]
.
- property necessary_coalition_size_icm_#
1d array of integers.
necessary_coalition_size_icm[c]
is the lower bound found by the algorithm for \(x_c\) (see below). For the sincere winnerw_
, we have by conventionnecessary_coalition_size_icm_[w_] = 0
.Internally, to decide the problem of ICM, SVVAMP studies the following question. When considering the sub-population of voters who do not prefer
c
tow_
(sincere voters), what is the minimal number \(x_c\) ofc
-manipulators needed to perform ICM? For all voting system currently implemented in SVVAMP, it means that ICM is possible iff there are \(x_c\) voters or more who preferc
tow_
.For information only, the result of SVVAMP’s computations about \(x_c\) is given in outputs
necessary_coalition_size_icm_
andsufficient_coalition_size_icm_
. By definition, we havenecessary_coalition_size_icm_[c]
\(\leq x_c \leq\)sufficient_coalition_size_icm_[c]
.When
icm_option
='exact'
, the exactness concerns the ICM decision problems (boolean results below), but not the numerical evaluation of \(x_c\). It means that for all boolean answers, SVVAMP will not answernumpy.nan
( undecided). But it is possible thatnecessary_coalition_size_icm_[c]
<sufficient_coalition_size_icm_[c]
.
- options_parameters = {'cm_option': {'allowed': ['lazy', 'exact'], 'default': 'lazy'}, 'icm_option': {'allowed': ['lazy'], 'default': 'lazy'}, 'iia_subset_maximum_size': {'allowed': <function is_number>, 'default': 2}, 'im_option': {'allowed': ['lazy', 'exact'], 'default': 'lazy'}, 'tm_option': {'allowed': ['lazy', 'exact'], 'default': 'exact'}, 'um_option': {'allowed': ['lazy', 'exact'], 'default': 'lazy'}}#
Options parameters. It is a dictionary of allowed and default options. Allowed is a minimal check that will be performed before launching big simulations, but other checks might be performed when setting the option. Allowed is either a list of values, like [‘lazy’, ‘fast’, ‘exact’], or a function checking if the parameter is correct. Example:
{'max_grade': dict(allowed=np.isfinite, default=1), 'option_example': dict(allowed=[42, 51], default=42)}
.- Type:
- property score_w_#
Score of the sincere winner.
Default type: number or 1d array.
Default behavior:
- 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 scores_best_to_worst_#
Scores of the candidates, from the winner to the last candidate of the election.
Default type: 1d or 2d array.
Default behavior:
scores_best_to_worst_
is derived fromscores_
andcandidates_by_scores_best_to_worst_
.If
scores_
is a 1d array, then so isscores_best_to_worst_
. It is defined byscores_best_to_worst_
=scores_[candidates_by_scores_best_to_worst_]
. Then by definition,scores_best_to_worst_[0]
=score_w_
.If
scores_
is a 2d array, then so isscores_best_to_worst_
. It is defined byscores_best_to_worst_
=scores_[:, candidates_by_scores_best_to_worst_]
. Then by definition,scores_best_to_worst_[:, 0]
=score_w_
.
- property sufficient_coalition_size_cm_#
1d array of integers or
numpy.inf
.sufficient_coalition_size_cm_[c]
is the upper bound found by the algorithm for \(x_c\) (cf.necessary_coalition_size_cm_
). For the sincere winnerw_
, we have by conventionsufficient_coalition_size_cm_[w_] = 0
.
- property sufficient_coalition_size_icm_#
1d of integers or
numpy.inf
.sufficient_coalition_size_icm[c]
is the upper bound found by the algorithm for \(x_c\) (seenecessary_coalition_size_icm_()
). For the sincere winnerw_
, we have by conventionsufficient_coalition_size_icm_[w_] = 0
.
- property tm_option#
String. Option used to compute
is_tm_()
and related methods.To know what options are accepted for a given voting system, use
options_parameters
.
- property um_option#
String. Option used to compute
is_um_()
and related methods.To know what options are accepted for a given voting system, use
options_parameters
.
- update_options(options)[source]#
Update options.
For example, instead of
rule.cm_option='exact'
, you can writerule.update_options{'cm_option': 'exact'}
.- Parameters:
options (dict) – Key: option name. Value: option value.
- property v_im_for_c_#
2d array of booleans.
v_im_for_c_[v, c]
isTrue
if voterv
can manipulate for candidatec
,False
otherwise. If the algorithm cannot decide, thennumpy.nan
. For the sincere winner :attr:w_`, we have by conventionv_im_for_c_[v, w_] = False
.
- property v_might_im_for_c_#
2d array of booleans. `
v_might_im_for_c_[v, c]` is True unless it is clearly and easily excluded that
v
has an individual manipulation in favor ofc
. Typically, ifv
is not pivotal (at all), then it is False. Specific implementations of this function in subclasses can also test ifv
is interested in manipulating forc
, but it is not mandatory.A non-trivial redefinition of this function is useful for voting systems where computing IM is costly. For voting systems where it is cheap, it it not worth the effort.
- property v_wants_to_help_c_#
2d array of booleans.
v_wants_to_help_c[v, c]
isTrue
iff voterv
strictly prefers candidatec
to the sincere winnerw_
. Ifv
attributes the same utility toc
andw_
, thenv
is not interested.
- property voters_im_#
1d array of booleans (or
numpy.nan
).voters_im_[v]
isTrue
if voterv
can and wants to manipulate for at least one candidate,False
otherwise. If the algorithm cannot decide, thennumpy.nan
.
- property w_#
Integer (winning candidate).
Default behavior: the candidate with highest value in vector
scores_
is declared the winner. In case of a tie, the tied candidate with lowest index wins.
- property w_is_condorcet_admissible_#
Boolean.
True
iff the sincere winnerw_
is Condorcet-admissible. Cf.condorcet_admissible_candidates
.
- property w_is_condorcet_winner_rk_#
Boolean. True iff the sincere winner
w_
is acondorcet_winner_rk
.
- property w_is_condorcet_winner_rk_ctb_#
Boolean. True iff the sincere winner
w_
is acondorcet_winner_rk_ctb
.
- property w_is_condorcet_winner_ut_abs_#
Boolean. True iff the sincere winner
w_
is acondorcet_winner_ut_abs
.
- property w_is_condorcet_winner_ut_abs_ctb_#
Boolean. True iff the sincere winner
w_
is acondorcet_winner_ut_abs_ctb
.
- property w_is_condorcet_winner_ut_rel_#
Boolean. True iff the sincere winner
w_
is acondorcet_winner_ut_rel
.
- property w_is_condorcet_winner_ut_rel_ctb_#
Boolean. True iff the sincere winner
w_
is acondorcet_winner_ut_abs_ctb
.
- property w_is_not_condorcet_admissible_#
Boolean.
True
iff the sincere winnerw_
is not a Condorcet-admissible candidate (whether some exist or not). Cf.condorcet_admissible_candidates
.
- property w_is_not_condorcet_winner_rk_#
Boolean. True iff the sincere winner
w_
is not acondorcet_winner_rk
(whether one exists or not).
- property w_is_not_condorcet_winner_rk_ctb_#
Boolean. True iff the sincere winner
w_
is not acondorcet_winner_rk_ctb
(whether one exists or not).
- property w_is_not_condorcet_winner_ut_abs_#
Boolean. True iff the sincere winner
w_
is not acondorcet_winner_ut_abs
(whether one exists or not).
- property w_is_not_condorcet_winner_ut_abs_ctb_#
Boolean. True iff the sincere winner
w_
is not acondorcet_winner_ut_abs_ctb
(whether one exists or not).
- property w_is_not_condorcet_winner_ut_rel_#
Boolean. True iff the sincere winner
w_
is not acondorcet_winner_ut_rel
(whether one exists or not).
- property w_is_not_condorcet_winner_ut_rel_ctb_#
Boolean. True iff the sincere winner
w_
is not acondorcet_winner_ut_abs_ctb
(whether one exists or not).
- property w_is_not_resistant_condorcet_winner_#
Boolean. True iff the sincere winner
w_
is not aresistant_condorcet_winner
(whether one exists or not).
- property w_is_not_weak_condorcet_winner_#
Boolean. True iff the sincere winner
w_
is not a Weak Condorcet winner (whether some exist or not). Cf.weak_condorcet_winners
.
- property w_is_resistant_condorcet_winner_#
Boolean. True iff the sincere winner
w_
is aresistant_condorcet_winner
.
- property w_is_weak_condorcet_winner_#
Boolean. True iff the sincere winner
w_
is a Weak Condorcet winner. Cf.weak_condorcet_winners
.
- property w_missed_condorcet_admissible_#
Boolean. True iff the sincere winner
w_
is not a Condorcet-admissible candidate, despite the fact that at least one exists. Cf.condorcet_admissible_candidates
.
- property w_missed_condorcet_winner_rk_#
Boolean. True iff the sincere winner
w_
is not thecondorcet_winner_rk
, despite the fact that she exists.
- property w_missed_condorcet_winner_rk_ctb_#
Boolean. True iff the sincere winner
w_
is not thecondorcet_winner_rk_ctb
, despite the fact that she exists.
- property w_missed_condorcet_winner_ut_abs_#
Boolean. True iff the sincere winner
w_
is not thecondorcet_winner_ut_abs
, despite the fact that she exists.
- property w_missed_condorcet_winner_ut_abs_ctb_#
Boolean. True iff the sincere winner
w_
is not thecondorcet_winner_ut_abs_ctb
, despite the fact that she exists.
- property w_missed_condorcet_winner_ut_rel_#
Boolean. True iff the sincere winner
w_
is not thecondorcet_winner_ut_rel
, despite the fact that she exists.
- property w_missed_condorcet_winner_ut_rel_ctb_#
Boolean. True iff the sincere winner
w_
is not thecondorcet_winner_ut_abs_ctb
, despite the fact that she exists.
- property w_missed_resistant_condorcet_winner_#
Boolean. True iff the sincere winner
w_
is not theresistant_condorcet_winner
, despite the fact that she exists.
- property w_missed_weak_condorcet_winner_#
Boolean. True iff the sincere winner
w_
is not a Weak Condorcet winner, despite the fact that at least one exists. Cf.weak_condorcet_winners
.
- property worst_relative_welfare_with_cm_#
Worst relative social welfare (sincere winner or candidate who can benefit from CM).