General purpose election running function
eRunner(etype=None, method=None, btype=None, scores=None, ranks=None, votes=None, ratings=None, numwinners=1, seed=None, rstate=None, kwargs=None)¶
Run the election & obtain results. For ties, randomly choose winner.
etype (str) –
Name of election type. Mutually exclusive with method and btype Supports the following election types:
’approval100’ - approval voting, 100% acceptance of nonzero score
’approval50’ - approval voting, 50% acceptance of nonzero score
’irv’ – Instant runoff.
’irv_stv’ – Instant runoff with single-transferable vote.
’rrv’ – Reweighted range voting.
’plurality’ – Traditional plurality & Single No Transferable Vote.
’sequential_monroe’ – PR scored method
’score’ – traditional score voting
’smith_minimax’ - Smith minimax condorcet voting
’star’ – STAR voting variant of score
Voting method function. Takes in argument data array shaped (a, b) for (voters, candidates) as well as additional kwargs. Mutually exclusive with etype.
>>> out = method(data, numwin=self.numwinneres, **kwargs)
Voting method’s ballot type. Mutually exclusive with etype, use with method.
‘rank’ – Use candidate ranking from 1 (first place) to n (last plast), with 0 for unranked.
‘score’ – Use candidate integer rating/scored method.
‘vote’ – Use traditional, single-selection vote. Vote for one (1), everyone else zero (0).
‘rating’ – Use raw ratings data.
- scoresarray shape (a, b)
- ranksarray shape (a, b)
- votesarray shape (a, b)
Plurality voting ballots
Winning candidate indices
array shape (c,)
Tie candidate indices
array shape (d,)
array shape (a, b)