ElectionResult

class svvamp.ElectionResult(population, **kwargs)[source]

Create a simple election (without manipulation).

This is an ‘abstract’ class. As an end-user, you should always use its subclasses Approval, Plurality, etc.

Parameters:
>>> import svvamp
>>> pop = svvamp.PopulationSpheroid(V=100, C=5)
>>> election = svvamp.Approval(pop, approval_comparator='>=')
ballots

Ballots cast by the voters.

Default type in superclass ElectionResult:
2d array of integers.
Default behavior in superclass ElectionResult:
ballots[v, k] = preferences_rk[v, k].
candidates_by_scores_best_to_worst

1d array of integers. All candidates, sorted from the winner to the last candidate in the result of the election.

Default behavior in superclass ElectionResult:
candidates_by_scores_best_to_worst[k] is the candidate with kth highest value in scores.

By definition, candidates_by_scores_best_to_worst[0] = w.

demo(log_depth=1)

Demonstrate the methods of ElectionResult class. s

param log_depth:
 Integer from 0 (basic info) to 3 (verbose).
mean_utility_w

Float. The mean utility for the sincere winner w. Be careful, this makes sense only if interpersonal comparison of utilities makes sense.

options_parameters

Display options.

Display a overview of available options, their default values and a minimal indication about what values are allowed for each option. For more details about a specific option, see its documentation.

pop

A Population object. The population running the election.

score_w

Score of the sincere winner.

Default type in superclass ElectionResult:
Number or 1d array.
Default behavior in superclass ElectionResult:

If scores is a 1d array, then score_w is w‘s numerical score: score_w = scores[w].

If scores is a 2d array, then score_w is w‘s score vector: score_w = scores[:, w].

scores

Scores of the candidates in the election.

This function is not implemented in the superclass ElectionResult. See specific documentation for each voting system.

Typical type in most subclasses:
1d or 2d array.
Typical behavior in most subclasses:

If scores is a 1d array, then scores[c] is the numerical score for candidate c.

If scores is a 2d array, then scores[:, c] is the score vector for candidate c.

scores_best_to_worst

Scores of the candidates, from the winner to the last candidate of the election.

Default type in superclass ElectionResult:
1d or 2d array.
Default behavior in superclass ElectionResult:

scores_best_to_worst is derived from scores and candidates_by_scores_best_to_worst.

If scores is a 1d array, then so is scores_best_to_worst. It is defined by scores_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 is scores_best_to_worst. It is defined by scores_best_to_worst = scores[:, candidates_by_scores_best_to_worst]. Then by definition, scores_best_to_worst[:, 0] = score_w.

total_utility_w

Float. The total utility for the sincere winner w. Be careful, this makes sense only if interpersonal comparison of utilities makes sense.

w

Integer (winning candidate).

Default behavior in superclass ElectionResult:
The candidate with highest value in vector scores is declared the winner. In case of a tie, the tied candidate with lowest index wins.
w_is_condorcet_admissible

Boolean. True iff the sincere winner w is Condorcet-admissible. Cf. condorcet_admissible_candidates.

w_is_condorcet_winner_rk

Boolean. True iff the sincere winner w is a condorcet_winner_rk.

w_is_condorcet_winner_rk_ctb

Boolean. True iff the sincere winner w is a condorcet_winner_rk_ctb.

w_is_condorcet_winner_ut_abs

Boolean. True iff the sincere winner w is a condorcet_winner_ut_abs.

w_is_condorcet_winner_ut_abs_ctb

Boolean. True iff the sincere winner w is a condorcet_winner_ut_abs_ctb.

w_is_condorcet_winner_ut_rel

Boolean. True iff the sincere winner w is a condorcet_winner_ut_rel.

w_is_condorcet_winner_ut_rel_ctb

Boolean. True iff the sincere winner w is a condorcet_winner_ut_abs_ctb.

w_is_not_condorcet_admissible

Boolean. True iff the sincere winner w is not a Condorcet-admissible candidate (whether some exist or not). Cf. condorcet_admissible_candidates.

w_is_not_condorcet_winner_rk

Boolean. True iff the sincere winner w is not a condorcet_winner_rk (whether one exists or not).

w_is_not_condorcet_winner_rk_ctb

Boolean. True iff the sincere winner w is not a condorcet_winner_rk_ctb (whether one exists or not).

w_is_not_condorcet_winner_ut_abs

Boolean. True iff the sincere winner w is not a condorcet_winner_ut_abs (whether one exists or not).

w_is_not_condorcet_winner_ut_abs_ctb

Boolean. True iff the sincere winner w is not a condorcet_winner_ut_abs_ctb (whether one exists or not).

w_is_not_condorcet_winner_ut_rel

Boolean. True iff the sincere winner w is not a condorcet_winner_ut_rel (whether one exists or not).

w_is_not_condorcet_winner_ut_rel_ctb

Boolean. True iff the sincere winner w is not a condorcet_winner_ut_abs_ctb (whether one exists or not).

w_is_not_resistant_condorcet_winner

Boolean. True iff the sincere winner w is not a resistant_condorcet_winner (whether one exists or not).

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.

w_is_resistant_condorcet_winner

Boolean. True iff the sincere winner w is a resistant_condorcet_winner.

w_is_weak_condorcet_winner

Boolean. True iff the sincere winner w is a Weak Condorcet winner. Cf. weak_condorcet_winners.

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.

w_missed_condorcet_winner_rk

Boolean. True iff the sincere winner w is not the condorcet_winner_rk, despite the fact that she exists.

w_missed_condorcet_winner_rk_ctb

Boolean. True iff the sincere winner w is not the condorcet_winner_rk_ctb, despite the fact that she exists.

w_missed_condorcet_winner_ut_abs

Boolean. True iff the sincere winner w is not the condorcet_winner_ut_abs, despite the fact that she exists.

w_missed_condorcet_winner_ut_abs_ctb

Boolean. True iff the sincere winner w is not the condorcet_winner_ut_abs_ctb, despite the fact that she exists.

w_missed_condorcet_winner_ut_rel

Boolean. True iff the sincere winner w is not the condorcet_winner_ut_rel, despite the fact that she exists.

w_missed_condorcet_winner_ut_rel_ctb

Boolean. True iff the sincere winner w is not the condorcet_winner_ut_abs_ctb, despite the fact that she exists.

w_missed_resistant_condorcet_winner

Boolean. True iff the sincere winner w is not the resistant_condorcet_winner, despite the fact that she exists.

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.