socialchoicekit.deterministic_multiround module

class socialchoicekit.deterministic_multiround.SingleTransferableVote(tie_breaker: str = 'random', zero_indexed: bool = False)[source]

Bases: object

Alternative Vote, Hare (Hare, 1859), Single Transferable Vote (STV), Instant Run-off Voting (IRV), and Ranked Choice Voting (RCV)—and proceeds as follows: at each stage, the alternative with lowest plurality score is dropped from all ballots, and at the first stage for which some alternative x sits atop a majority of the ballots, x is declared the winner.

Parameters

tie_breaker{“random”, “first”}

Tie breaker used to drop alternatives, not to select winning alternatives. - “random”: pick from a uniform distribution among the losers to drop - “first”: pick the alternative with the lowest index

zero_indexedbool

If True, the output of the social welfare function and social choice function will be zero-indexed. If False, the output will be one-indexed. One-indexed by default.

scf(profile: CompleteProfile) int[source]

The social choice function for this voting rule. Returns a single winning alternative.

Notes

Complexity O(MN)

Parameters

profile: CompleteProfile

A (N, M) array, where N is the number of voters and M is the number of alternatives. The element at (i, j) indicates the voter’s preference for alternative j, where 1 is the most preferred alternative.

Returns

int

A single winning alternative.