Anti-Harassment Tools/SecurePoll Improvements/Test Results/20 4 5000 8910242957

Comments
SecurePoll elects candidates 4, 6, 12 and 13.

OpenSTV elects candidates 1, 6, 13, and 18.

I don't yet understand what causes the discrepancy. I see that SecurePoll eliminates candidates 14 and 17 in round 4, while OpenSTV only eliminates candidate 17. But, in round 6 OpenSTV also eliminates candidate 14, so by round 7 we should be back to parity.

Election of candidate 12 might be explained by the simultaneous elimination of candidates 16 and 20 in round 12. Moreover, OpenSTV eliminates candidate 12, which gives a lot of votes to candidate 1.

I notice that, for example, in SecurePoll the most votes candidate 1 gets is ~871. In OpenSTV, the most votes candidate 1 gets is 882.

Note: This election was generated by this script, which simulates an election where voters are equally likely to vote for each candidate.

Election setup

 * Candidates: 20
 * Seats: 4
 * Votes: 5000

Actual
Output from SecurePoll: https://phabricator.wikimedia.org/P16897

Expected
Output from OpenSTV: Loading ballots from file 20_4_5000_8910242957.blt. Ballot file contains 20 candidates and 5000 ballots. No candidates have withdrawn. Ballot file contains 5000 non-empty ballots.

Counting votes for ElectionTitle using Meek STV. 20 candidates running for 4 seats.

R|1         |2          |3          |4          |5          |6 |---+---+---+---+---+--- |7          |8          |9          |10         |11         |12           |---+---+---+---+---+---  |13         |14         |15         |16         |17         |18           |---+---+---+---+---+---  |19         |20         |Exhausted  |Surplus    |Threshold

=
============================================================= 1| 264.000000| 227.000000| 245.000000| 262.000000| 258.000000| 258.000000 | 252.000000| 221.000000| 262.000000| 243.000000| 243.000000| 255.000000  | 271.000000| 232.000000| 243.000000| 260.000000| 233.000000| 257.000000  | 253.000000| 261.000000|   0.000000|   0.000000|1000.000001  |---  | Count of first choices.

=
============================================================= 2| 280.000000| 237.000000| 255.000000| 275.000000| 268.000000| 274.000000 | 263.000000|           | 275.000000| 253.000000| 253.000000| 268.000000  | 278.000000| 246.000000| 254.000000| 266.000000| 241.000000| 275.000000  | 262.000000| 266.000000|  11.000000|   0.000000| 997.800001  |---  | Count after eliminating 8 and transferring votes. All losing | candidates are eliminated.

=
============================================================= 3| 290.000000|          | 269.000000| 284.000000| 278.000000| 287.000000  | 277.000000|           | 286.000000| 265.000000| 265.000000| 281.000000  | 292.000000| 255.000000| 263.000000| 279.000000| 255.000000| 298.000000  | 278.000000| 276.000000|  22.000000|   0.000000| 995.600001  |---  | Count after eliminating 2 and transferring votes. All losing | candidates are eliminated.

=
============================================================= 4| 302.000000|          | 275.000000| 300.000000| 294.000000| 303.000000  | 299.000000|           | 303.000000| 278.000000| 280.000000| 292.000000  | 309.000000| 275.000000| 272.000000| 288.000000|           | 316.000000  | 282.000000| 297.000000|  35.000000|   0.000000| 993.000001  |---  | Count after eliminating 17 and transferring votes. All losing | candidates are eliminated. Candidates 14 and 17 were tied when | choosing candidates to eliminate. Candidate 17 was chosen by breaking | the tie at round 2.

=
============================================================= 5| 318.000000|          | 289.000000| 320.000000| 308.000000| 317.000000  | 311.000000|           | 325.000000| 291.000000| 308.000000| 304.000000  | 326.000000| 283.000000|           | 304.000000|           | 332.000000  | 297.000000| 318.000000|  49.000000|   0.000000| 990.200001  |---  | Count after eliminating 15 and transferring votes. All losing | candidates are eliminated.

=
============================================================= 6| 334.000000|          | 308.000000| 337.000000| 318.000000| 332.000000  | 329.000000|           | 345.000000| 310.000000| 322.000000| 328.000000  | 339.000000|           |           | 334.000000|           | 348.000000  | 318.000000| 334.000000|  64.000000|   0.000000| 987.200001  |---  | Count after eliminating 14 and transferring votes. All losing | candidates are eliminated.

=
============================================================= 7| 359.000000|          |           | 358.000000| 336.000000| 354.000000  | 341.000000|           | 367.000000| 335.000000| 333.000000| 345.000000  | 367.000000|           |           | 350.000000|           | 367.000000  | 335.000000| 358.000000|  95.000000|   0.000000| 981.000001  |---  | Count after eliminating 3 and transferring votes. All losing | candidates are eliminated.

=
============================================================= 8| 386.000000|          |           | 382.000000| 355.000000| 377.000000  | 369.000000|           | 389.000000| 359.000000|           | 364.000000  | 392.000000|           |           | 371.000000|           | 394.000000  | 359.000000| 378.000000| 125.000000|   0.000000| 975.000001  |---  | Count after eliminating 11 and transferring votes. All losing | candidates are eliminated.

=
============================================================= 9| 409.000000|          |           | 408.000000|           | 409.000000  | 399.000000|           | 418.000000| 396.000000|           | 396.000000  | 420.000000|           |           | 400.000000|           | 414.000000  | 387.000000| 397.000000| 147.000000|   0.000000| 970.600001  |---  | Count after eliminating 5 and transferring votes. All losing | candidates are eliminated.

=
============================================================= 10| 443.000000|          |           | 439.000000|           | 454.000000  | 421.000000|           | 458.000000| 423.000000|           | 423.000000  | 452.000000|           |           | 424.000000|           | 444.000000  |           | 429.000000| 190.000000|   0.000000| 962.000001  |---  | Count after eliminating 19 and transferring votes. All losing | candidates are eliminated.

=
============================================================= 11| 475.000000|          |           | 476.000000|           | 497.000000  |           |           | 488.000000| 461.000000|           | 474.000000  | 481.000000|           |           | 469.000000|           | 486.000000  |           | 467.000000| 226.000000|   0.000000| 954.800001  |---  | Count after eliminating 7 and transferring votes. All losing | candidates are eliminated.

=
============================================================= 12| 525.000000|          |           | 521.000000|           | 548.000000  |           |           | 524.000000|           |           | 524.000000  | 527.000000|           |           | 510.000000|           | 534.000000  |           | 510.000000| 277.000000|   0.000000| 944.600001  |---  | Count after eliminating 10 and transferring votes. All losing | candidates are eliminated.

=
============================================================= 13| 581.000000|          |           | 578.000000|           | 619.000000  |           |           | 566.000000|           |           | 578.000000  | 589.000000|           |           | 572.000000|           | 587.000000  |           |           | 330.000000|   0.000000| 934.000001  |---  | Count after eliminating 20 and transferring votes. All losing | candidates are eliminated. Candidates 16 and 20 were tied when | choosing candidates to eliminate. Candidate 20 was chosen by breaking | the tie at round 11.

=
============================================================= 14| 659.000000|          |           | 661.000000|           | 683.000000  |           |           |           |           |           | 636.000000  | 658.000000|           |           | 649.000000|           | 654.000000  |           |           | 400.000000|   0.000000| 920.000001  |---  | Count after eliminating 9 and transferring votes. All losing | candidates are eliminated.

=
============================================================= 15| 748.000000|          |           | 739.000000|           | 775.000000  |           |           |           |           |           |             | 769.000000|           |           | 736.000000|           | 741.000000  |           |           | 492.000000|   0.000000| 901.600001  |---  | Count after eliminating 12 and transferring votes. All losing | candidates are eliminated.

=
============================================================= 16| 882.000000|          |           | 861.000000|           | 900.000000  |           |           |           |           |           |             | 878.000000|           |           |           |           | 865.000000  |           |           | 614.000000|  28.399997| 877.200001  |---  | Count after eliminating 16 and transferring votes. All losing | candidates are eliminated. Candidates 1, 6, and 13 have reached the | threshold and are elected.

=
============================================================= 17| 881.696123|          |           | 866.752156|           | 878.184384  |           |           |           |           |           |             | 883.106784|           |           |           |           | 870.597612  |           |           | 619.662941|  14.785055| 876.067412  |---  | Count after transferring surplus votes. Keep factors of candidates who | have exceeded the threshold: 1, 0.994558; 6, 0.974667; and 13, | 0.999089.

=
============================================================= 18| 877.879225|          |           | 869.804175|           | 878.442469  |           |           |           |           |           |             | 877.702385|           |           |           |           | 873.555862  |           |           | 622.615884|   7.593607| 875.476824  |---  | Count after transferring surplus votes. Keep factors of candidates who | have exceeded the threshold: 1, 0.988209; 6, 0.972318; and 13, | 0.991126.

=
============================================================= 19| 876.481177|          |           | 871.366250|           | 876.331889  |           |           |           |           |           |             | 876.609687|           |           |           |           | 875.074298  |           |           | 624.136699|   3.904770| 875.172661  |---  | Count after transferring surplus votes. Keep factors of candidates who | have exceeded the threshold: 1, 0.985505; 6, 0.969036; and 13, | 0.988613.

=
============================================================= 20| 875.677754|          |           | 872.171631|           | 875.683001  |           |           |           |           |           |             | 875.692303|           |           |           |           | 875.856049  |           |           | 624.919262|   2.844515| 875.016148  |---  | Count after transferring surplus votes. Keep factors of candidates who | have exceeded the threshold: 1, 0.984034; 6, 0.967755; and 13, | 0.986993. Candidate 18 has reached the threshold and is elected.

Winners are 1, 6, 13, and 18.

Files

 * blt: https://github.com/dominic998/SecurePoll-Test-Data/blob/main/test_data/20_4_5000_8910242957.blt
 * php:

Environment

 * Where you tested: local docker using PHPUnit
 * Version of SecurePoll: commit 552e3bcc1e177a54f04c7fb641bceef87d1b8df8 (patch 17 from https://gerrit.wikimedia.org/r/c/mediawiki/extensions/SecurePoll/+/704454/)