[EM] Error found. Program re-posted with error fixed.

Michael Ossipoff email9648742 at gmail.com
Wed Aug 22 22:07:42 PDT 2012


I'm re-posting my Symmetrical ICT count-code posting, with the error
corrected. But first, let me show where the error is. It's in the
Pairwise Totals section, section 2. Here is the part where the error
is. I'll show it with the error, and then with the error fixed. Then
I'll show the entire posting with that correction made. Fixing the
errors meant that part of the program doesn't have proper indentation.

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
......Top(k,i) = 0 (Error, this line should have put the correct value
into Top(k,i))
......Ntop(i) = 0 (Error, that goes at the top instead)
(Here, Ntop(i) should be incremented if appropriate)
......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

Fixed version of that section:

2. Pairwise totals:

(i's top-count, i-j pairwise vote totals and equal-top:)
NTop(i) = 0
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



This, below, is pseudocode for Symmetrical ICT.

And,at this point, I emphasize that Symmetrical ICT does very well by
criteria and properties:

It can fairly be said to meet the Condorcet Criterion because, as I
said, it meets that criterion when "beats" is defined consistently
with the intentions and wishes of an equal-top-ranking voter, and of
an equal-bottom-ranking voter.

It meets FBC

It is defection-resistant.

It meets LNHe

For avoiding the strategy problems that would otherwise distort the
sincerity of voters' rankings, Symmetrical ICT is unequalled.

Symmetrical ICT is the rank-count that delivers on the promise of rank
balloting.

Now, about the Symmetrical ICT count pseudocode:

Pseudocode is just a description of what to do, without regard to any
one particular programming language.

I should add that this program is only for counting a set of rankings
and giving the final winner(s). And so, for this program to be used
for an ongoing poll, in which a winner is found and announced
periodically, then  the pairwise totals that are incremented in the
"Pairwise Totals" section should be saved to a file. And then, the
next time the program is run, the statements that initialize them to
zero should be deleted from the program. In that way, each new ballot
can increment the pairwise totals, and, from those new totals, a new
count can be done, to find a new winner or winning set.

I should also say that this program assumes that there is already an
array, R(k,i), where k is the number of a ballot, and i is the number
of a candidate, and R(k,i) is that candidate's rank on that ballot.

Most people who actually use a count program use automated balloting,
by which the R(k,i) array is automatically calculated from the voted
rankings. But, speaking for myself, I've never written software for
automated balloting. I've only collected rankings, as we're doing in
the current Democracy Chronicles ICT poll, written them down, and
entered the rankings into the program, via "input" statements.

In case anyone else is interested in doing it that way, the only way
that I've ever done it, I enclose, right after the end of the program,
a separate program section, for manually inputting into the program,
rankings from written ballots. To use it, one would append it to the
beginning of the program proper, just before the program proper. As I
said, that manual ranking-inputting program section will be after the
end of the program proper, and will be clearly labeled. It will be
rudimentary. For simplicity, it doesn't include error-correction
provisions, and it calls upon the user to input, on each ballot, for
each candidate, that candidate's rank on that ballot.

I emphasize that I'm not a professional programmer. I've used FORTRAN
IV, and BASIC, and got an A in a course in FORTRAN 77. Of course I
have a computer (or two). My computer even has a programming
language--Microsoft Office includes a programming language called VBA
(Visual Basic for Applications). So far, I've been unsuccessful in my
attempts to make a simple test program run in VBA. Who knows, maybe
someday I'll find out how to make VBA run. But, because I haven't yet,
I'm sending my Symmetrical ICT count program without having actually
run it. Of course most computer programs contain at least one "bug".
In the FORTRAN 77 course, one of my assignment programs ran properly
the first time, but most would agree that that is the exception. So I
can't guarantee that the enclosed program doesn't contain a bug. But
it appears to be correct.

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 i

(at bottom means not ranked over anyone on that ballot)

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
......Top(k,i) = 0
......Ntop(i) = 0
......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

3. 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

(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 Top(i) > Max then:
.........Max = Top(i)
......Endif
...Next i


(Find who has that top-score:)

...For i = 1 to NC
......If Top(i) = Max then:
.........Win(i) = 1
.........Print Name(i), "_Wins."
......Endif
...Next i
Stop
Endif

(If some but not all candidates are unbeaten:)

Same as (If all or no candidates are unbeaten), except that:

If Max = Top(i) becomes:

If Max = Top(i) AND Beaten(i) = 0

And:

If Top(i) = Max becomes:

If Top(i) = Max AND Beaten(i) = 0

[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.

Mike Ossipoff



More information about the Election-Methods mailing list