Implement the algorithm as suggested in: T281035#7116140.
General algorithm (source)
- Compute the quota.
- Assign votes to candidates by first preferences.
- Declare as winners all candidates who received at least the quota.
- Transfer the excess votes from winners to hopefuls.
- Repeat 3–4 until no new candidates are elected. (Under some systems, votes could initially be transferred in this step to prior winners or losers. This might affect the outcome.)
If all seats have winners, the process is complete. Otherwise:
- Eliminate one or more candidates, typically either the lowest candidate or all candidates whose combined votes are less than the vote of the lowest remaining candidate.
- Transfer the votes of the losers to remaining hopeful candidates.
- Repeat 3–7 until all seats are full.
The quota we will use (step 1) is the Droop quota (source):
floor( no. votes / (no. seats + 1) ) + 1
The method for transferring votes from elected or eliminated candidates will be the Meek method:
Acceptance criteria:
- Add an implementation for STVTallier::finishTally (should be modular and will probably call out to several private methods)
- Add STVTallierTest with test cases for finishTally
It may or may not be desirable to implement addVote for this task. Tallying won't work via the interface without it, but this task is only concerned with providing the algorithm, not the full tallying capability.
It would help to look at SchulzeTallier and PairwiseTallier for how to structure this.