Skip to content

Instantly share code, notes, and snippets.

@anga4
Created August 24, 2019 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anga4/9c47aa78ab6539683812007dabfff4d6 to your computer and use it in GitHub Desktop.
Save anga4/9c47aa78ab6539683812007dabfff4d6 to your computer and use it in GitHub Desktop.

Summary

I have worked on the Agora voting library during my summers with AOSSIE, in which my work involved implementing new voting algorithms in Scala along with their unit tests. I also implemented some new quotas and some new methods of breaking ties.

Project repository

AOSSIE

GSOC-2019 TAG

TODO

Merge Requests

My Merged requests

  1. Implemeted the Imperiali Quota

  2. Implemented Hagenbach Bischoff Quota

  3. Implemented D'hondt Quotient Quota

  4. Implemented Webster-Sainte-Lague Quota

  5. Implemented Huntington-Hill quota

  6. Implement DMP ballot

  7. Implemented Bucklin method

    • Bucklin voting is a class of voting methods that can be used for single-member and multi-member districts. Voters are allowed rank preference ballots (first, second, third, etc.). First choice votes are first counted. If one candidate has a majority, that candidate wins. Otherwise the second choices are added to the first choices. Again, if a candidate with a majority vote is found, the winner is the candidate with the most votes accumulated. Lower rankings are added as needed.
  8. Implemented veto method

    • In the Veto rule each candidate with the exception of the candidate at the last position gains one point per vote. As for Plurality the candidates with maximum score are the winners.

Open

  1. Implemented super majority method

    • A majority vote, or more than half the votes cast, is a common voting basis. There is already an implementation of this algorithm in Agora. Instead of the basis of a majority, a supermajority can be specified using any fraction or percentage which is greater than one-half (i.e., 50%). It can also be called a qualified majority. Common supermajorities include three fifths (60%), two thirds (67%), and three quarters (75%). This can be easily added by modifying the runScrutiny function of MajorityRuleMethod.
  2. Implemented scottish stv

    • Scotland enacted these rules for local elections in 2007. This is a straightforward implementation of STV and recommended to organizations using STV for the first time. Scottish STV is just a variant of the STV method implemented in Agora library
  3. Implemented Cambridge STV method

    • The Cambridge STV is yet another variation of STV that was introduced by Cambridge to elect its city council.
  4. Implemented San Francisco RCV method

    • The city of San Francisco uses the San Francisco RCV rules for city elections. San Francisco enacted IRV in 2002, its first election with IRV was in 2004, and it has been used annually since then.
  5. Implemented Black voting method

    • The Black rule is a 'combined' voting rule that returns the Condorcet winner, if such a winner exists, or otherwise the Borda winner(s).
  6. Implemented instant runoff voting an equivalent of Oakland RCV

    • This method implements IRV as used by the cities of Oakland, San Leandro, and Berkeley. All three cities had their first IRV elections in 2010.
  7. Added prior round exclusion tie resolution

    • This is a tie breaking technique that looks at the prior round to determine which candidate amongst the tied candidate had a better score and hence is made the winner.
  8. Implemented later preference exclusion tie resolution

    • This is a tie breaking method which verifies which of the tied candidate has highest second choice score of all voters. This tie breaking technique works only for elections in which multiple candidates are selected by the voters (preferential ballots) and not for single choice ballots.
  9. Added Documentation about GSoC 2019 work

Addition of various voting algorithms

I have added various voting algorithms that I found out on Wikipedia and Opavote. They involve Super Majority, Bucklin Vote, Scottish STV, Cambridge STV, San Francisco RCV, Oakland RCV, Veto etc.

Addition of new method of breaking ties

I have added some new methods of breaking ties which are particularly useful for some STV algorithms. These methods include Prior-round tie breaking and Later-preference tie breaking methods

Addition of algorithms to calculate quotas

Some new algorithms used to calculate quotas have implemented such as Hagenbach-Bischoff, D’Hondt-Quotient, Imperiali-quota, Webster-Sainte-Lague etc. Some of which are used by the new vote counting methods that have been added.

Addition of new ballot

A new ballot type has been added to the library which is known as DMP (Dual member proportional representation) ballot. This will be used in conjunction with the Dual member proportional representation method.

Things left to tackle

The Dual member proportional representation method has not yet been implemented and scrutiny tables for the rest of the algorithms are not created yet which will need some work and discussion with mentors and project admins.

I would like to thank my mentors at AOSSIE for being highly supportive and co-operative with me during the coding period. With their constant support I was able to learn a lot during these 3 months of coding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment