RuleScoreNumRowSum¶
-
class
whalrus.RuleScoreNumRowSum(*args, matrix: whalrus.matrices.matrix.Matrix = None, **kwargs)[source]¶ Rule where the winner is the candidate having the highest row sum in some matrix.
The score of a candidate is the sum of the non-diagonal elements of its row in
matrix_.- Parameters
args – Cf. parent class.
matrix (Matrix) – The matrix upon which the scores are based.
kwargs – Cf. parent class.
-
property
average_score_¶ The average score.
- Type
Number
-
property
average_score_as_float_¶ The average score as a float. It is the same as
average_score_, but converted to a float.- Type
float
-
property
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
oneis greater thananother, a negative number otherwise.- Return type
int
-
property
n_candidates_¶ Number of candidates.
- Type
int
-
property
scores_as_floats_¶ Scores as floats. It is the same as
scores_, but converted to floats.- Type
-
property
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
-
property
trailer_¶ The “trailer” of the election. This is the last candidate in
strict_order_and also the unfavorable choice of the tie-breaking rule incotrailers_.- Type
object
-
property
winner_¶ The winner of the election. This is the first candidate in
strict_order_and also the choice of the tie-breaking rule incowinners_.- Type
object
-
property
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