RuleScore¶
-
class
whalrus.RuleScore(*args, tie_break: whalrus.priorities.priority.Priority = Priority.UNAMBIGUOUS, converter: whalrus.converters_ballot.converter_ballot.ConverterBallot = None, **kwargs)[source]¶ A voting rule with scores (which are not necessarily numbers).
Each candidate is assigned a score (not necessarily a number), and the the cowinners are the candidates with the best score, in the sense defined by
compare_scores().-
property
best_score_¶ The best score.
- Type
object
-
compare_scores(one: object, another: object) → int[source]¶ Compare two scores.
- Parameters
one (object) – A score.
another (object) – A score.
- Returns
0 if they are equal, a positive number if
oneis greater thananother, a negative number otherwise.- Return type
int
-
property
n_candidates_¶ Number of candidates.
- Type
int
-
property
order_¶ Result of the election as a (weak) order over the candidates. It is a list of
NiceSet. The first set contains the candidates that have the best score, the second set contains those with the second best score, etc.- Type
list
-
property
scores_¶ The scores. To each candidate, this dictionary assigns a score (non necessarily a number).
- Type
-
property
strict_order_¶ Result of the election as a strict order over the candidates. The first element is the winner, etc. This may use the tie-breaking rule.
- Type
list
-
property
trailer_¶ The “trailer” of the election. This is the last candidate in
strict_order_and also the unfavorable choice of the tie-breaking rule incotrailers_.- Type
object
-
property
winner_¶ The winner of the election. This is the first candidate in
strict_order_and also the choice of the tie-breaking rule incowinners_.- Type
object
-
property
worst_score_¶ The worst score.
- Type
object
-
property