RuleNanson

class whalrus.RuleNanson(*args, base_rule: whalrus.rules.rule.Rule = None, elimination: whalrus.eliminations.elimination.Elimination = None, **kwargs)[source]

Nanson’s rule.

At each round, all candidates whose Borda score is lower than the average Borda score are eliminated.

Parameters:

Examples

>>> rule = RuleNanson(['a > b > c > d', 'a > b > d > c'])
>>> rule.eliminations_[0].rule_.gross_scores_
{'a': 6, 'b': 4, 'c': 1, 'd': 1}
>>> rule.eliminations_[1].rule_.gross_scores_
{'a': 2, 'b': 0}
>>> rule.eliminations_[2].rule_.gross_scores_
{'a': 0}
>>> rule.winner_
'a'
cotrailers_

“Cotrailers” of the election, i.e. the candidates that fare worst in the election. This is the last equivalence class in order_. For example, in RuleScoreNum, it is the candidates that are tied for the worst score.

Type:NiceSet
cowinners_

Cowinners of the election, i.e. the candidates that fare best in the election.. This is the first equivalence class in order_. For example, in RuleScoreNum, it is the candidates that are tied for the best score.

Type:NiceSet
eliminations_

The elimination rounds. A list of Elimination objects. The first one corresponds to the first round, etc.

Type:list
n_candidates_

Number of candidates.

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