[EM] IEVS 1.0 voting system comparator code now available - contribute code?

Warren Smith wds at math.temple.edu
Wed Jan 3 14:35:46 PST 2007


http://rangevoting.org/IEVS/IEVS.c

This is a 2130-line C program by Warren D. Smith.
It computes Bayesian Regret values of whatver single-winner
voting systems it has programmed, using whatever utility generators
it has programmed, with whatever voter-ignorance value you want,
and using whatever voting strategies it has programmed.

This is designed to be easily "infinitely extendible" to add more
voting systems, more utilty generators, and more strategies.

At present, includes the following 31 voting systems:
SociallyBest  /* greatest utility-sum winner */
SociallyWorst   /* least utility-sum winner */
RandomWinner    return RandInt( E->NumCands ); }
RandomBallot   /* top choice of a random ballot is elected */
Plurality   /* canddt with most top-rank votes wins */
AntiPlurality   /* canddt with fewest bottom-rank votes wins */
Dabagh   /* canddt with greatest Dabagh = 2*#top-rank-votes + 1*#second-rank-votes, wins */
VtForAgainst   /* canddt with greatest score = #votesFor - #votesAgainst,  wins */
Top2Runoff    /* Top2Runoff=top-2-runoff, 2nd round has fully-honest voting */
PlurIR    /* PlurIR=plur+immediate runoff (give ranking as vote) */
Borda  /* Borda: weighted positional with weights N-1, N-2, ..., 0  if N-canddts */
Black  /* Condorcet winner if exists, else use Borda */
RandomPair){ /* pairwise winner among 2 random candidates is elected */
NansonBaldwin  /* repeatedly eliminate Borda loser */
Nauru  /* Nauru: weighted positional with weights 1, 1/2, 1/3, 1/4,... */
CondorcetLR   /* candidate with least sum-of-pairwise-defeat-margins wins */
SimpsonKramer  /* candidate with mildest worst-defeat wins */
SchulzeBeatpaths  /* winner = X so BeatPathStrength over rivals Y exceeds strength from Y */
SmithSet  /* Smith set = smallest nonempty set of canddts that pairwise-beat all nonmembers */
SchwartzSet  /* Schwartz set = smallest nonempty set of canddts undefeated by nonmembers */
Bucklin   /* canddt with over half the voters ranking him in top-k wins (for k minimal) */
Copeland   /* canddt with largest number of pairwise-wins elected (tie counts as win/2) */
SimmonsCond  /* winner = X with least sum of top-rank-votes for rivals pairwise-beating X */
IRV   /* instant runoff; repeatedly eliminate plurality loser */
SmithIRV  /*  Eliminate plurality loser until unbeaten candidate exists. */
BTRIRV  /* Repeatedly eliminate either plur loser or 2nd-loser (whoever loses pairwise) */
Approval   /* canddt with most-approvals wins */
Range    /* canddt with highest average Score wins */
TopMedianRating    /* canddt with highest median Score wins */
LoMedianRank    /* canddt with best median ranking wins */
DMC  /* eliminate least-approved candidate until unbeaten winner exists */

At present, includes the following 3 utility generators
(but only the simplest is actually turned on right now)
GenNormalUtils( edata *E ){ /* simplest possible utlity generator: random normal numbers: */
GenIssueDistanceUtils( edata *E, uint Issues ){  /* utility = distance-based formula in Issue-space */
GenIssueDotprodUtils( edata *E, uint Issues ){  /* utility = canddt*voter vector dot-product */

At present, the only strategy that is available is HonestyStrat().

Here is some output from the program:
(NumVoters=17, NumCands=5, NumElections=9999, IgnoranceAmplitude=0.001000)
Regrets & #Agreements with Condorcet Winner (when CW exists)
0=SociallyBest                  0           5606
1=SociallyWorst            9.5902             14
2=RandomWinner            4.82072           1509
3=Plurality               1.51116           4856
4=Borda                  0.503797           6610
5=IRV                    0.988438           6889
6=Approval               0.852192           5156
7=Range                  0.296049           6049
8=SchulzeBeatpaths       0.757384           7728
9=SmithSet                1.02608           7728
10=SchwartzSet            1.01876           7728
11=CondorcetLR           0.705677           7728
12=Top2Runoff             1.08308           6430
13=SimpsonKramer         0.768418           7728
14=Bucklin                1.00365           5698
15=Copeland              0.782556           7728
16=SimmonsCond           0.777313           7728
17=SmithIRV              0.851491           7728
18=BTRIRV                0.812709           7728
19=DMC                   0.893986           7728
20=Dabagh                 0.90325           5932
21=VtForAgainst          0.838831           5628
22=AntiPlurality          1.90962           3742
23=PlurIR                 1.08308           6430
24=Black                 0.600716           7728
25=RandomBallot           3.73017           2373
26=RandomPair              3.2883           2802
27=NansonBaldwin         0.842422           7728
28=Nauru                 0.827666           6007
29=TopMedianRating       0.724379           5269
30=LoMedianRank           1.40657           5059

showing that in 5-canddt, 17-voter elections with this (low)
ignorance level and this utility generator (random normals)
range voting is the best (lowest regret) among these voting methods
(except for the artificial "SociallyBest" magic method).

I may be out of email contact for a few days, but if in the interim
a lot of people post comments and code to improve this, then
I'll try to process them then.

wds

PS: here are the number of agrements among winners for these methods in that sim:

AGREE 0    1    2    3    4    5    6    7    8    9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29   30 
 0     0    0 2009 5290 7141 6100 6351 7804 6547 6184 6195 6663 5915 6532 6041 6519 6509 6393 6464 6345 6254 6412 4614 5915 6918 2833 3145 6378 6407 6621 5408
 1     0    0 2029  343   43  140  110   16   62  235  226   58  177   79  129   66   64   97   89  136  136   98  353  177   42 1363  892   80  119   74  313
 2  2009 2029    0 2046 1980 1981 2007 2009 1944 1916 1960 1968 1986 1976 2001 1952 1949 1965 1951 1930 2025 1996 1936 1986 1951 1929 2010 1954 1994 2039 2015
 3  5290  343 2046    0 5639 6226 4244 5540 5681 5404 5427 5726 6883 5719 4639 5603 5855 5815 6102 5536 7098 6481 2870 6883 5761 3250 2966 5647 7860 5122 4535
 4  7141   43 1980 5639    0 6948 6648 7905 7750 7164 7193 7921 6650 7723 7257 7670 7595 7424 7523 7409 7237 7126 4925 6650 8881 2864 3315 7438 7339 6482 6283
 5  6100  140 1981 6226 6948    0 5450 6497 7767 7499 7473 7880 8139 7754 5919 7702 8332 9009 8201 7597 7051 6472 3789 8139 7712 3039 3270 8000 7299 5875 5462
 6  6351  110 2007 4244 6648 5450    0 6912 6010 5734 5729 6135 5102 6041 6427 6025 5921 5819 5895 5858 5656 5039 4040 5102 6353 2601 3086 5886 5512 6499 5669
 7  7804   16 2009 5540 7905 6497 6912    0 7069 6596 6639 7187 6343 7045 6489 7009 7001 6846 6969 6806 6715 6849 4834 6343 7523 2889 3185 6842 6875 7200 5789
 8  6547   62 1944 5681 7750 7767 6010 7069    0 8156 8376 9060 7237 9110 6667 8547 8622 8623 8689 8441 6914 6568 4464 7237 8868 2934 3397 8901 6997 6159 5939
 9  6184  235 1916 5404 7164 7499 5734 6596 8156    0 7914 8332 7045 8267 6263 8307 8301 8319 8323 8315 6510 6175 4273 7045 8282 2882 3330 8284 6584 5852 5608
10  6195  226 1960 5427 7193 7473 5729 6639 8376 7914    0 8250 6961 8348 6277 8282 8322 8317 8331 8288 6483 6217 4319 6961 8311 2872 3329 8343 6578 5834 5625
11  6663   58 1968 5726 7921 7880 6135 7187 9060 8332 8250    0 7408 9003 6776 8819 8871 8733 8821 8560 7010 6644 4461 7408 9039 2952 3435 9034 7129 6201 5972
12  5915  177 1986 6883 6650 8139 5102 6343 7237 7045 6961 7408    0 7229 5501 7254 7889 7836 7741 7138 6981 6730 3653 9999 7269 3127 3214 7406 7517 5663 5123
13  6532   79 1976 5719 7723 7754 6041 7045 9110 8267 8348 9003 7229    0 6653 8577 8632 8619 8693 8436 6948 6556 4432 7229 8841 2939 3386 8903 7053 6165 5902
14  6041  129 2001 4639 7257 5919 6427 6489 6667 6263 6277 6776 5501 6653    0 6561 6446 6327 6418 6423 6813 5166 3864 5501 6989 2662 3179 6485 6139 6193 7490
15  6519   66 1952 5603 7670 7702 6025 7009 8547 8307 8282 8819 7254 8577 6561    0 8797 8575 8601 8601 6784 6513 4465 7254 8788 2903 3410 8613 6894 6097 5830
16  6509   64 1949 5855 7595 8332 5921 7001 8622 8301 8322 8871 7889 8632 6446 8797    0 9280 9043 8555 6939 6662 4343 7889 8713 2964 3398 8863 7121 6078 5754
17  6393   97 1965 5815 7424 9009 5819 6846 8623 8319 8317 8733 7836 8619 6327 8575 9280    0 9020 8446 6851 6503 4249 7836 8542 2959 3380 8879 6999 6010 5699
18  6464   89 1951 6102 7523 8201 5895 6969 8689 8323 8331 8821 7741 8693 6418 8601 9043 9020    0 8522 7152 6629 4186 7741 8641 3015 3425 8827 7353 6087 5784
19  6345  136 1930 5536 7409 7597 5858 6806 8441 8315 8288 8560 7138 8436 6423 8601 8555 8446 8522    0 6672 6383 4377 7138 8527 2914 3372 8509 6745 5958 5743
20  6254  136 2025 7098 7237 7051 5656 6715 6914 6510 6483 7010 6981 6948 6813 6784 6939 6851 7152 6672    0 6419 3353 6981 7117 3119 3179 6758 8602 6280 6518
21  6412   98 1996 6481 7126 6472 5039 6849 6568 6175 6217 6644 6730 6556 5166 6513 6662 6503 6629 6383 6419    0 5348 6730 6928 3048 3190 6402 7185 5449 4780
22  4614  353 1936 2870 4925 3789 4040 4834 4464 4273 4319 4461 3653 4432 3864 4465 4343 4249 4186 4377 3353 5348    0 3653 4663 2189 2765 4357 3576 3674 3375
23  5915  177 1986 6883 6650 8139 5102 6343 7237 7045 6961 7408 9999 7229 5501 7254 7889 7836 7741 7138 6981 6730 3653    0 7269 3127 3214 7406 7517 5663 5123
24  6918   42 1951 5761 8881 7712 6353 7523 8868 8282 8311 9039 7269 8841 6989 8788 8713 8542 8641 8527 7117 6928 4663 7269    0 2937 3421 8556 7265 6395 6094
25  2833 1363 1929 3250 2864 3039 2601 2889 2934 2882 2872 2952 3127 2939 2662 2903 2964 2959 3015 2914 3119 3048 2189 3127 2937    0 2317 2974 3240 2812 2688
26  3145  892 2010 2966 3315 3270 3086 3185 3397 3330 3329 3435 3214 3386 3179 3410 3398 3380 3425 3372 3179 3190 2765 3214 3421 2317    0 3396 3210 3073 3050
27  6378   80 1954 5647 7438 8000 5886 6842 8901 8284 8343 9034 7406 8903 6485 8613 8863 8879 8827 8509 6758 6402 4357 7406 8556 2974 3396    0 6874 6022 5752
28  6407  119 1994 7860 7339 7299 5512 6875 6997 6584 6578 7129 7517 7053 6139 6894 7121 6999 7353 6745 8602 7185 3576 7517 7265 3240 3210 6874    0 6153 5780
29  6621   74 2039 5122 6482 5875 6499 7200 6159 5852 5834 6201 5663 6165 6193 6097 6078 6010 6087 5958 6280 5449 3674 5663 6395 2812 3073 6022 6153    0 5657
30  5408  313 2015 4535 6283 5462 5669 5789 5939 5608 5625 5972 5123 5902 7490 5830 5754 5699 5784 5743 6518 4780 3375 5123 6094 2688 3050 5752 5780 5657    0




More information about the Election-Methods mailing list