On November 5 Minneapolis Minnesota held elections. The process of voting could not have been easier. In less than five minutes I participated in our democracy.
Finding out who won the various offices up for election was another story. Our mayoral race had a large number of candidates. The total number of mayoral candidates was 35 (pulling from the vote information).
It took over two days for the votes to be tabulated by hand using ranked choice voting. I thought it could be done more quickly.
And, having a little free time yesterday I wrote up a sample implementation of ranked choice voting.
For the curious, the sample implementation program to calculate the election ran the actual mayoral election data in roughly 18 seconds!
Programs:
election.py
provides: ranked-choice voting
input: csv file containing all votes for an election (1 vote per line, a line consists of 1+ choices for a candidate)
output: run it and see
e.g. election.py election_csv_file.csv
election_votes_generator.py
provides: a simple way to create a csv of ranked-choice votes
input: arguments (OUTPUT_FILE VOTERS CANDIDATES ALLOWED_CHOICES)
e.g. election_votes_generator.py out.csv 200000 15 3
This would create a simulated set of votes containing 200000 votes, with 15 candidates, where a vote is for 3 candidates in ranked order.
Note: I did not realize the actual votes had been posted recently. Therefore, I wrote up this election simulator. I have added the actual voting information of the mayoral race to the git repo for reference.
Reference links: