RuleSequentialTieBreak¶

class
whalrus.
RuleSequentialTieBreak
(*args, rules: list = None, **kwargs)[source]¶ A rule by sequential tiebreak.
Parameters:  args – Cf. parent class.
 rules (list of Rule) –
 kwargs – Cf. parent class.
Examples
The winner is determined by the first rule. If there is a tie, it is broken by the second rule. Etc. There may still be a tie at the end: in that case, it is broken by the tiebreaking rule of this object.
>>> rule = RuleSequentialTieBreak( ... ['a > d > e > b > c', 'b > d > e > a > c', 'c > d > e > a > b', ... 'd > e > b > a > c', 'e > d > b > a > c'], ... weights=[2, 2, 2, 1, 1], ... rules=[RulePlurality(), RuleBorda()], tie_break=Priority.ASCENDING) >>> rule.rules_[0].gross_scores_ {'a': 2, 'b': 2, 'c': 2, 'd': 1, 'e': 1} >>> rule.rules_[1].gross_scores_ {'a': 14, 'b': 14, 'c': 8, 'd': 25, 'e': 19} >>> rule.order_ [{'a', 'b'}, {'c'}, {'d'}, {'e'}] >>> 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, inRuleScoreNum
, 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, inRuleScoreNum
, it is the candidates that are tied for the best score.Type: NiceSet

n_candidates_
¶ Number of candidates.
Type: int

rules_
¶ The rules (once applied to the profile).
Type: list

strict_order_
¶ Result of the election as a strict order over the candidates. The first element is the winner, etc. This may use the tiebreaking rule.
Type: list

trailer_
¶ The “trailer” of the election. This is the last candidate in
strict_order_
and also the unfavorable choice of the tiebreaking rule incotrailers_
.Type: object

winner_
¶ The winner of the election. This is the first candidate in
strict_order_
and also the choice of the tiebreaking rule incowinners_
.Type: object