TwoRound

class svvamp.TwoRound(population, **kwargs)[source]

Two Round System.

Inherits functions and optional parameters from superclasses ElectionResult and Election.

Example:
>>> import svvamp
>>> pop = svvamp.PopulationSpheroid(V=100, C=5)
>>> election = svvamp.TwoRound(pop)

Two rounds are actually held, which means that manipulators can change their vote between the first and second round. Hence for C = 3, this voting system is equivalent to ExhaustiveBallot (not IRV).

In case of a tie, candidates with lowest index are privileged.

not_IIA(): Non-polynomial or non-exact algorithms from superclass Election.

CM(), ICM(), IM(), TM(), UM(): Exact in polynomial time.

ballots

2d array of integers. ballots[v, r] is the candidate for which voter v votes at round r, where r = 0 (first round) or r = 1 (second round).

candidates_by_scores_best_to_worst

1d array of integers. candidates_by_scores_best_to_worst[k] is the candidate with kth best score. Finalists are sorted by their score at second round. Other candidates are sorted by their score at first round.

By definition, candidates_by_scores_best_to_worst[0] = w.

scores

2d array. scores[r, c] is the number of voters who vote for candidate c at round r, where r = 0 (first round) or r = 1 (second round).

selected_one

Integer. The candidate with highest score at first round.

selected_two

Integer. The candidate with second highest score at first round.

w

Integer (winning candidate).