TwoRound¶
-
class
svvamp.TwoRound(population, **kwargs)[source]¶ Two Round System.
Inherits functions and optional parameters from superclasses
ElectionResultandElection.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 toExhaustiveBallot(notIRV).In case of a tie, candidates with lowest index are privileged.
not_IIA(): Non-polynomial or non-exact algorithms from superclassElection.CM(),ICM(),IM(),TM(),UM(): Exact in polynomial time.-
ballots¶ 2d array of integers.
ballots[v, r]is the candidate for which votervvotes at roundr, wherer= 0 (first round) orr= 1 (second round).
-
candidates_by_scores_best_to_worst¶ 1d array of integers.
candidates_by_scores_best_to_worst[k]is the candidate withkth 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 candidatecat roundr, wherer= 0 (first round) orr= 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).
-