RuleSchulze¶

class
whalrus.
RuleSchulze
(*args, converter: whalrus.converters_ballot.converter_ballot.ConverterBallot = None, matrix_schulze: whalrus.matrices.matrix.Matrix = None, **kwargs)[source]¶ Schulze’s Rule.
A candidate is a Schulze winner if it has no defeat in the Schulze matrix.
Parameters:  args – Cf. parent class.
 converter (ConverterBallot) – Default:
ConverterBallotToOrder
.  matrix_schulze (Matrix) – The Schulze matrix. Default:
MatrixSchulze
.  kwargs – Cf. parent class.
Examples
>>> rule = RuleSchulze(['a > b > c', 'b > c > a', 'c > a > b'], weights=[4, 3, 2]) >>> rule.matrix_schulze_.as_array_ array([[0, Fraction(2, 3), Fraction(2, 3)], [Fraction(5, 9), 0, Fraction(7, 9)], [Fraction(5, 9), Fraction(5, 9), 0]], dtype=object) >>> 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

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