Where I'd said "(If some but not all candidates are unbeaten:)", I'd neglected to add, below that, the program statement that contains that "if":
If NBeaten > 0 AND NBeaten < NC Also, instead of just specifying that the section is the same as the previous one except for two changes, I should write the section out. So the program-listing below is complete. As before, it is preceded by some explanatory text, since this posting is intended to replace the previous one. This pseudocode is for counting Symmetrical ICT, a rank-count which, I claim, avoids the strategy problems otherwise distort voters sincere expression of preferences--does so better than any other rank-count. It meets FBC; is defection-resistant (maning that it avoids the Chicken Dilemma); meets the Condorcet Criterion, if equal-top-ranking and equal-bottom-ranking are counted consistent with the intent and wishes of people voting in that way; and meets LNHe. The program will be divided into numbered and named sections. There may be comments here and there. If so, they'll be in parentheses, sometimes on their own line (in which case they refer to what's below them if they end in a colon--otherwise they refer to what's above them). Maybe sometimes they'll be at the end of a line, referring to that line. The Symmetrical ICT count pseudocode: (I have an initialization section that initializes a number of global variables. I usually also initialize them at the appropriate place in the program too. No harm in doing it twice.) NC is the number of candidates. NB is the number of ballots. R(k,i) is the array for the rank at which candidate i is ranked on ballot k. 1. Initialization: NBeaten = 0 (No one initially beaten) (Initialize everyone unbeaten:) For i = 1 to NC ...Beaten(i) = 0 ...Win(i) = 0 ...NTop(i) = 0 Next i (Initialize everyone at bottom on every ballot:) For k = 1 to NB ...For i = 1 to NC ......Bottom(k,i) = 1 ...Next i Next k (Initialize all the pairwise totals to zero:) For i = 1 to NC ...For j = 1 to NC ...V(i,j) = 0 (votes for i over j) ...ET(i,j) = 0 (ballots with i and j top ranked) ...EB(i,j) = 0 (ballots with i and j at bottom) Next j Next i (at bottom means not ranked over anyone on that ballot) (Below, some of the indentation isn't correct, because it was necessary to fix an error) 2. Pairwise totals: (i's top-count, i-j pairwise vote totals and equal-top:) For k = 1 to NB ...For i = 1 to NC ......If R(k,i) = 1 then: ......Top(k,i) = 1 .......NTop(i) = NTop(i) + 1 ......Endif ......For j = 1 to NC .........If R(k,i) < R(k,j) then ............V(i,j) = V(i,j) + 1 .........Endif .........If R(k,i) = 1 AND R(k,j) = 1 AND i<>j then ............ET(i,j) = ET(i,j) + 1 .........Endif ......Next j ...Next i (Is i at bottom on ballot k?:) For i = 1 to NC ...For j = 1 to NC ......If R(k,i) < R(k,j) then .........Bottom(k,i) = 0 (i is not at bottom) ......Endif ...Next j Next i (Increment i-j equal bottom count?:) For i = 1 to NC ...For j = 1 to NC ......If Bottom(k,i) = 1 AND Bottom(k,j) = 1 AND i<>j then .........EB(i,j) = EB(i,j) +1 ......Endif ...Next j Next i Next k 3. Is candidate i unbeaten? For i = 1 to NC ...For j = 1 to NC ......If V(j,i) + EB(i,j) > V(i,j) + ET(i,j) then .........Beaten(i) = 1 ......Endif ...Next j ...If Beaten(i) = 1 then ......NBeaten = NBeaten + 1 ...Endif Next i 4. Find winners: (If exactly 1 candidate is unbeaten:) If Nbeaten = NC - 1 then: ...For i = 1 to NC ......If Beaten(i) = 0 then .........Win(i) = 1 .........Print Name(i), "_Wins." ......Endif ...Next i Stop Endif (If all or no candidates are unbeaten:) (Find maximum top-score:) If NBeaten = 0 OR NBeaten = NC ...Max = 0 ...For i = 1 to NC ......If NTop(i) > Max then: .........Max = NTop(i) ......Endif ...Next i (Find who has that top-score:) ...For i = 1 to NC ......If NTop(i) = Max then: .........Win(i) = 1 .........Print Name(i), "_Wins." ......Endif ...Next i Stop Endif (If some but not all candidates are unbeaten:) If NBeaten > 0 AND NBeaten < NC (Find maximum top-score:) ...Max = 0 ...For i = 1 to NC ......If NTop(i) > Max AND Beaten(i) = 0 then: .........Max = NTop(i) ......Endif ...Next i (Find who has that top-score:) ...For i = 1 to NC ......If NTop(i) = Max AND Beaten(i) = 0 then: .........Win(i) = 1 .........Print Name(i), "_Wins." ......Endif ...Next i Stop Endif [End of program] Here is rudimentary code to manually enter rankings into the program: For k = 1 to NB ...For i = 1 to NC ......Print Name(i) ......Input "Rank", R(k,i) ...Next i Next k [end of manual ranking-entry program] As I said, if that manual ranking-entry program is used, then it should be appended to the beginning of the main program described above. ---- Election-Methods mailing list - see http://electorama.com/em for list info
