andrewcmyers / civs

Condorcet Internet Voting System
http://civs1.civs.us
MIT License
82 stars 26 forks source link

Incorporate ballot weighting, for when voters have unequal influence, or increase the ballot qty limitation #26

Open avinewman opened 5 years ago

avinewman commented 5 years ago

I am trying to use Civs to do an election for my condo association. Not everyone has a computer so ballots are done on paper but we need Civs to help us calculate the winner. Because I aggregate the ballots myself, I use a test poll with the ballots uploaded (preferably as a single file).

Need 1: We need to be able to calculate the top N winners, which Civs already handles nicely because it ranks the winners when showing the results. Awesome!

Need 2: We need to weight different ballots depending on the membership share of each voter. This could be easily solved by counting each ballot as many ballots, commesure with their weight. For example, a small condo unit might get 207 votes, which a large unit might get 851 votes.

The problem is that my test file is being rejected on account of it exceeding the ballot qty limitation of 1000 ballots. Perhaps the limitation is only per file, but if I had to upload each ballot individually, it would be too burdensome. Therefore I am requesting that the ballot limitation (for test polls) be increased from 1000, to 1 million.

avinewman commented 5 years ago

Perhaps a better way to solve this would be to incorporate ballot weight directly into the algorithm? Using many ballots per person to simulate ballot weighting is a hack.

andrewcmyers commented 5 years ago

The solution is to add ballot weight into the algorithm. However, this is a non-trivial modification of the codebase with implications in many places.

avinewman commented 5 years ago

@andrewcmyers Maybe I can roll my own solution to process a file that contains several hundred thousands ballots. Can you please point me at the part of the code base that does the voting calculations?

andrewcmyers commented 5 years ago

It's controlled by the script results, which is unfortunately the ugliest part of the codebase. The actual algorithms for calculations are in beatpath2.pm, runoff.pm, minimax.pm, etc. (See %algorithms in results) However, this change would also alter the schema (see election.pm), so would affect much of the rest of the code in subtle ways. It would also need to be coded to be backward compatible with the tens of thousands of elections already stored persistently.