Friday, September 14, 2007

Proposed MMP Algorithm for Ontario

For those writing software or spreadsheets, or who just want to know the details, here are the steps to follow in order to figure out who is elected under the proposed MMP system for Ontario.

1) In each riding, note who got the most local votes, that is the MPP.

2) For FPTP, and for the FPTP seats in MMP, that is where the algorithm ends. Let's continue. Look up the party affiliation of each riding winner, and add up how many ridings each party has. You can add all the independents together if you like.

3) Count the party ballots, and see how many party votes each party got province-wide. Discard the ballots where this part of the ballot is spoiled (Note: it seems to be possible to spoil only half of a ballot, for instance by voting for two candidates but only one party)

4) Calculate the 3% threshold, by taking the total number of unspoiled party ballots and multiplying by 0.03

5) Discard all the ballots cast for parties having fewer total votes than the threshold, and get a revised total number of eligible party ballots.

6) Calculate the First Hare Quota. This is the total number of seats (90+39=129) in the legislature divided by the total number of eligible party ballots.

7) Calculate the number of Quotas for each party. This is the number of party votes for that party, divided by the First Hare Quota.

8) Calculate the Full Quota Seats for each party. This is the number of Quotas rounded down to the nearest integer (the part of the number before the decimal point)

9) Note the Remainder for each party; this is the part of the Quotas number after the decimal point.

10) Add up the full quota seats from all parties, and subtract that number from the total number of seats (90+39=129) in the legislature. This is the number of surplus seats remaining to be allocated.

11) Find the largest one of all the Remainders above and allocate one surplus seat to that party; repeat with the next largest Remainder until the number of surplus seats calculated in the previous step has been allocated.

12) For each party, add the full quota seats and the surplus seats together to get the total seats for that party.

13) For each party, calculate the number of list seats by subtracting the party’s number of ridings (step 2) from the total seats for that party in the previous step.

14) If one or more of the number of list seats is negative, or if any independents have been elected, there is an “overhang”. Continue to the next step. Otherwise skip ahead to step 26

15) Discard all the ballots cast for parties having an “overhang”, and get a revised total number of eligible party ballots. Editorializing: we may well be discarding a large part if not the majority of the votes in this step.

16) Calculate the Seats of Remaining Parties. This is the total number of seats (90+39=129) in the legislature minus the number of ridings won by the parties having overhangs minus the number of independents.

17) Calculate the total votes of remaining parties. This is the total number of eligible party ballots minus the votes received by parties having overhangs. Note: there is no indication that the 3% quota is re-calculated.

18) Calculate the Second Hare Quota. This is the number of Remaining Seats divided by the total votes of remaining parties.

19) Calculate the number of Quotas for each remaining party. This is the number of eligible party votes for that party, divided by the Second Hare Quota.

20) Calculate the Full Quota Seats for each remaining party. This is the number of Quotas rounded down to the nearest integer (the part of the number before the decimal point)

21) Note the Remainder for each remaining party; this is the part of the Quotas number after the decimal point.

22) Add up the full quota seats, and subtract that number from the total number of Seats of Remaining Parties. This is the number of surplus seats remaining to be allocated.

23) Find the largest remainder above and allocate one surplus seat to that party; repeat with the next largest remainder until the number of surplus calculated in the previous step has been allocated.

24) The total of the independent seats, of the riding seats for the parties having overhangs, and of the full quota seats and the surplus seats of the remaining parties should add up to 129, and the the total of the full quota seats and the surplus seats of the remaining parties should not be less than the number of riding seats for that party. If not, you’re in trouble. I don't know if it is a mathematical certainty that they add up.

25) For each party, calculate the number of list seats by subtracting the party’s number of ridings (step 2) from the total seats. Independents and parties with an overhang should have zero list seats.

26) To allocate members to list seats, for each party take the highest-ranked member of the party’s list that is not already a member (for instance, that person may have been elected in a local riding for that party or for another party) and make them a member of the legislature. Continue until all of that party’s list seats have been allocated, and repeat for all remaining parties.

27) If you run out of people on the party’s list, you’re in trouble.

28) In case of any re-count, return to step 1. The list allocation of any party can be affected by any change in any other party’s results.