# Reference Meek Rule

## Reference Rule: Meek’s Method

Count multiple-seat elections as follows.

**Initialize Election**

Set each candidate’s state to*hopeful*or*withdrawn*. Set each*hopeful*candidate’s keep factor*kf*to 1, and each*withdrawn*candidate’s keep factor to 0. Set*omega*to 0.000001 (1/10^{6}).**Rounds****Test count complete**. Proceed to step C if all seats are filled, or if the number of*elected*plus*hopeful*candidates is less than or equal to the number of seats.**Iterate**.**Distribute votes**. For each ballot: set ballot weight*w*to 1, and then for each candidate, in order of rank on that ballot: add*w*multiplied by the keep factor*kf*of the candidate (to 9 decimal places, rounded up) to that candidate’s vote*v*, and reduce*w*by the same amount, until no further candidate remains on the ballot or until the ballot’s weight*w*is 0.**Update quota**. Set quota*q*to the sum of the vote*v*for all candidates (step B.2.a), divided by one more than the number of seats to be filled, truncated to 9 decimal places, plus 0.000000001 (1/10^{9}).**Find winners**. Elect each*hopeful*candidate with a vote*v*greater than or equal to the quota (*v*≥*q*).**Calculate the total surplus**s, as the sum of the individual surpluses (*v*–*q*) of the*elected*candidates, but not less than 0.**Test for iteration finished**. If step B.2.c elected a candidate, continue at B.1. Otherwise, if the total surplus*s*is less than*omega*, or (except for the first iteration) if the total surplus*s*is greater than or equal to the surplus*s*in the previous iteration, continue at B.3.**Update keep factors**. Set the keep factor*kf*of each*elected*candidate to the candidate’s current keep factor*kf*, multiplied by the current quota*q*(to 9 decimal places, rounded up), and then divided by the candidate’s current vote*v*(to 9 decimal places, rounded up). Continue iteration at step B.2.a.

**Defeat low candidate**. Defeat the*hopeful*candidate*c*with the lowest vote*v*, breaking any tie per procedure T, where each candidate*c'*is tied with*c*if vote*v'*for*c'*is less than or equal to*v*plus total surplus*s*. Set the keep factor*kf*of*c*to 0.**Continue**. Proceed to the next round at step B.1.

**Count Complete****Elect remaining**. If any seats are unfilled, elect remaining*hopeful*candidates.**Defeat remaining**. Otherwise defeat remaining*hopeful*candidates.

Election count is complete.

**Breaking ties**

Ties can arise in B.3, when selecting a candidate for defeat. Use the defined tiebreaking procedure to select for defeat one candidate from the group of tied candidates.

## Notes

### Elect or defeat

“Elect or defeat candidate” mean “set candidate’s state to *elected* or *defeated*, respectively”.

### Multiple simultaneous defeats

In the interest of reducing the number of rounds and avoiding inconsequential ties, a sub-step may be added to defeat sure losers. At the end of step B.2.e, if the iteration is not otherwise complete:

Find the

hopefulcandidatecwith the highest votevsuch that the sum of the votes for that candidate and all candidatesc'whose votev'is less than or equal tov, plus the total surpluss, is less than the lowest votev"greater thanv, and such that the number ofhopefulcandidates with votes greater thanvis greater than or equal to the number of unfilled seats.If such a candidate

cis found, defeat candidatecand all candidatesc', set the keep factorkfof thedefeatedcandidate(s) to 0, and continue at step B1.

Alternative formulation:

Find the largest set of

hopefulcandidates meeting the following conditions:

- For each candidate
cwith votevin the set, anyhopefulcandidate with vote less than or equal tovis also in the set.- The sum of the votes for the candidates in the set plus the total surplus
s[B.2.d] is less than the lowest vote for anyhopefulcandidate not in the set.- The number of
hopefulcandidates not in the set is greater than or equal to the number of unfilled seats.If the resulting set is not empty, defeat all candidates in the set, set the keep factor

kfof thedefeatedcandidate(s) to 0, and continue at step B1.

Hello,

I am trying to understand the difference between Meek and meek-prf and their working (Math behind it). Will it be possible for you to share an example for Meek-prf ?

Thanks in advance

Meek-prf is meant to be a straightforward and readable implementation of a “good” set of parameters (precision and such), without unneeded complications such as batch defeats. Meek, on the other hand, supports a collection of options and implements batch defeats. It’s useful for experimentation, and playing around with those options, but in return the code is significantly more complex and harder to follow. Especially if you’re trying to understand a Meek count for the first time, stick to Meek-prf. It’s also a good choice to use if you’re specifying a Meek method for a real-world election.