from http://www.ccrc.wustl.edu/~lorracks/dsv/diss/
by Lorrie Cranor
The paradox of voting was discovered over 200 years ago by M. Condorcet, a French mathematician, philosopher, economist, and social scientist. However, it received little attention until Duncan Black explained its significance in a series of essays he began in the 1940s. The importance of the voting paradox was not fully realized until several years after Kenneth Arrow published Social Choice and Individual Values in 1951, which contained his General Possibility Theorem. The essence of this theorem is that there is no method of aggregating individual preferences over three or more alternatives that satisfies several conditions of fairness and always produces a logical result.
For this problem, you must write a program that evaluates different voting strategies on voter preferences. We consider just the case of 3 candidates, and each vote orders the candidates according to their preferences. There are a total of 5 schemes you need to consider:
Note that in all votes, each voter casts their vote for the candidate they like most who is on the ballot (as a result of the voting paradox, this doesn't always maximize the chance that a candidate they like will be elected).
You do not need to worry about election ties; none will occur in the data sets you will be tested on.
Your input will be a series of voter preferences, each consisting of 3 integers on a line. These numbers consist of the voter's first, second and third choice; each choice will be a number in the range 1-3. If the first number is 0, it means that this set of voter preferences is complete, and you should print the results for this set and then read in another set. If the first number is -1, it indicates end of input. This set of voter preferences is complete and is the last set of voter preferences; you should print the results and terminate.
For each set of voter preferences, you should print a header, the plurality election winner, the exhaustive ballot winner, and the winner if two of the candidates are paired in a primary first. The sample output shows the appropriate format, but don't worry about the number of spaces.
Input: | Output: |
---|---|
1 2 3 1 2 3 1 2 3 2 1 3 2 3 1 3 1 2 0 0 0 1 3 2 1 3 2 1 3 2 1 2 3 1 3 2 3 2 1 2 3 1 2 3 1 2 3 1 3 2 1 3 2 1 2 3 1 -1 -1 -1 |
-------- election 1 plurality winner 1 exhaustive ballot 1 12 primary 1 13 primary 1 23 primary 1 -------- election 2 plurality winner 1 exhaustive ballot 2 12 primary 3 13 primary 3 23 primary 3 |
Input | Output |
---|