Code covered by the BSD License  

Highlights from
election

Be the first to rate this file! 5 Downloads (last 30 days) File Size: 12.78 KB File ID: #28521

election

by Ben Petschel

 

20 Aug 2010

Implements many different methods for determining the winner of an election given voter preferences.

| Watch this File

File Information
Description

Voting theory is a branch of mathematics with lots of interesting paradoxes. For example, the candidate with the most primary votes might also be at the bottom of the most voters preferences. It is also possible for a candidate with no primary votes to be more preferred pairwise than any other candidate. Pairwise majority preferences can also be cyclic.

Many different election systems have been proposed over the years, some of them nontrivial to compute. This function implements over 20 different election methods.

Example (vector result implies a tie):

[winner,method]=election([1,2,3; 1,2,3; 2,3,1; 3,2,1],'all');
fmt = '%-20s%s\n';
fprintf(1,fmt,'Method:','Winner(s):');
for i=1:numel(winner)
  fprintf(1,fmt,method{i},mat2str(winner{i}));
end;

Method: Winner(s):
dictator 1
hat 1
FPP 1
runoff [1 2 3]
exhaustive 1
pref 1
contingent [1 2 3]
Coombs 2
Borda 2
Nanson [1 2]
Baldwin [1 2]
Bucklin 2
Smith [1 2 3]
Schwartz [1 2]
Landau [1 2 3]
Copeland 2
minimaxwinvote [1 2]
minimaxmargin [1 2]
minimaxvote [1 2]
Kemeny-Young [1 2]
rankedpairs [1 2]
Schulze [1 2]

For more information, see the help file or the article at http://www.math4realworld.com.

MATLAB release MATLAB 7.10 (2010a)
Other requirements Uses tilde notation for unassigned outputs - to work with R2009a or earlier replace "~," with "tmp,".
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
election Ben Petschel 23 Aug 2010 10:03:44
voting Ben Petschel 23 Aug 2010 10:03:44

Contact us at files@mathworks.com