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().

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 one is greater than another, a negative number otherwise.

Return type:

int

cotrailers_

“Cotrailers”. The set of candidates with the worst score.

Type:NiceSet
cowinners_

Cowinners. The set of candidates with the best score.

Type:NiceSet
n_candidates_

Number of candidates.

Type:int
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
scores_

The scores. To each candidate, this dictionary assigns a score (non necessarily a number).

Type:NiceDict
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
trailer_

The “trailer” of the election. This is the last candidate in strict_order_ and also the unfavorable choice of the tie-breaking rule in cotrailers_.

Type:object
winner_

The winner of the election. This is the first candidate in strict_order_ and also the choice of the tie-breaking rule in cowinners_.

Type:object
worst_score_

The worst score.

Type:object