RuleMaximin¶

class
whalrus.
RuleMaximin
(*args, converter: whalrus.converters_ballot.converter_ballot.ConverterBallot = None, matrix_weighted_majority: whalrus.matrices.matrix.Matrix = None, **kwargs)[source]¶ Maximin rule. Also known as SimpsonKramer rule.
The score of a candidate is the minimal nondiagonal coefficient on its raw of the matrix.
Parameters:  args – Cf. parent class.
 converter (ConverterBallot) – Default:
ConverterBallotToOrder
.  matrix_weighted_majority (Matrix) – Default:
MatrixWeightedMajority
.  kwargs – Cf. parent class.
Examples
>>> rule = RuleMaximin(ballots=['a > b > c', 'b > c > a', 'c > a > b'], weights=[4, 3, 3]) >>> rule.matrix_weighted_majority_.as_array_of_floats_ array([[0. , 0.7, 0.4], [0.3, 0. , 0.7], [0.6, 0.3, 0. ]]) >>> rule.scores_as_floats_ {'a': 0.4, 'b': 0.3, 'c': 0.3} >>> rule.winner_ 'a'

average_score_
¶ The average score.
Type: Number

average_score_as_float_
¶ The average score as a float. It is the same as
average_score_
, but converted to a float.Type: float

best_score_as_float_
¶ The best score as a float. It is the same as
RuleScore.best_score_
, but converted to a float.Type: float

compare_scores
(one: numbers.Number, another: numbers.Number) → int¶ 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 thananother
, a negative number otherwise.Return type: int

matrix_weighted_majority_
¶ The weighted majority matrix (once computed with the given profile).
Type: Matrix

n_candidates_
¶ Number of candidates.
Type: int

scores_as_floats_
¶ Scores as floats. It is the same as
scores_
, but converted to floats.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 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

worst_score_as_float_
¶ The worst score as a float. It is the same as
RuleScore.worst_score_
, but converted to a float.Type: float