votesim.votesystems.condorcet

Condorcet voting methods & helper functions.

Function Summary

ranked_pairs(ranks[, numwin])

Ranked-pairs or Tideman election system.

ranked_pairs_test2(ranks[, numwin])

smith_minimax([ranks, numwin, matrix])

Condorcet Smith Minimax voting algorithm for ranked ballots.

smith_score(data[, numwin])

Smith then score voting variant

Module Functions

ranked_pairs

votesim.votesystems.condorcet.ranked_pairs(ranks, numwin=1)

Ranked-pairs or Tideman election system.

Parameters

ranks (array shaped (a, b)) –

Election voter rankings, from [1 to b]. Data composed of candidate rankings, with

  • Voters as the rows

  • Candidates as the columns.

Use 0 to specify unranked (and therefore not to be counted) ballots.

  • a : number of voters dimension. Voters assign ranks for each candidate.

  • bnumber of candidates. A score is assigned for each candidate

    from 0 to b-1.

Returns

  • winners (array of shape (numwin,)) – Winning candidates index.

  • ties (array of shape (tienum,)) – Tied candidates index for the last round, numbering tienum.

  • output (dict) – Dictionary with additional election data

    pairsarray shaped (a, 3)

    Win-Loss candidate pairs - column 0 = winning candidate - column 1 = losing candidate - column 2 = margin of victory

    locked_pairsarray shaped (b, 3)

    Win-Loss candidate pairs, with low margin-of-victory winners who create a cycle eliminated. - column 0 = winning candidate - column 1 = losing candidate - column 2 = margin of victory

ranked_pairs_test2

votesim.votesystems.condorcet.ranked_pairs_test2(ranks, numwin=1)

smith_minimax

votesim.votesystems.condorcet.smith_minimax(ranks=None, numwin=1, matrix=None)

Condorcet Smith Minimax voting algorithm for ranked ballots.

Parameters

ranks (array shaped (a, b)) –

Election voter rankings, from [1 to b]. Data composed of candidate rankings, with

  • Voters as the rows

  • Candidates as the columns.

Use 0 to specify unranked (and therefore not to be counted) ballots.

  • a : number of voters dimension. Voters assign ranks for each candidate.

  • bnumber of candidates. A score is assigned for each candidate

    from 0 to b-1.

Returns

  • winners (array of shape (numwin,)) – Winning candidates index.

  • ties (array of shape (tienum,)) – Tied candidates index for the last round, numbering tienum.

smith_score

votesim.votesystems.condorcet.smith_score(data, numwin=1)

Smith then score voting variant