Schulze method is essentially a widest path problem. With the Condorcet matrix, we must find the so called the strongest path a > b > c > d, and the winner is a. The strength of a path is the strength of its weakest link.
cdc_schulze(x, allow_dup = TRUE, min_valid = 1)
it accepts the following types of input:
1st, it can be an object of class vote
.
2nd, it can be a user-given Condorcet matrix,
3rd, it can be a result of another Condorcet method,
which is of class condorcet
.
whether ballots with duplicated score values are taken into account. Default is TRUE.
default is 1. If the number of valid entries of a ballot is less than this value, it will not be used.
a condorcet
object, which is essentially
a list.
(1) call
the function call.
(2) method
the counting method.
(3) candidate
candidate names.
(4) candidate_num
number of candidate.
(5) ballot_num
number of ballots in x. When
x is not a vote
object, it may be NULL.
(6) valid_ballot_num
number of ballots that are
actually used to compute the result. When
x is not a vote
object, it may be NULL.
(7) winner
the winners, may be NULL.
(8) input_object
the class of x.
(9) cdc
the Condorcet matrix which is actually used.
(10) dif
the score difference matrix. When
x is not a vote
object, it may be NULL.
(11) binary
win and loss recorded with 1 (win),
0 (equal) and -1 (loss).
(12) summary_m
times of win (1), equal (0)
and loss (-1).
(13) other_info
a list of 2 elements. The 1st is the strength
comparison matrix. The 2nd is the strength comparison matrix in binary
mode, 1 for win, 0 for else.
Schulze, M. 2010. A new monotonic, clone-independent, reversal symmetric, and Condorcet-consistent single-winner election method. Social Choice and Welfare, 36(2), 267-303.
# NOT RUN {
raw <- list2ballot(
x = list(
c('a', 'c', 'b', 'e', 'd'),
c('a', 'd', 'e', 'c', 'b'),
c('b', 'e', 'd', 'a', 'c'),
c('c', 'a', 'b', 'e', 'd'),
c('c', 'a', 'e', 'b', 'd'),
c('c', 'b', 'a', 'd', 'e'),
c('d', 'c', 'e', 'b', 'a'),
c('e', 'b', 'a', 'd', 'c')
),
n = c(5, 5, 8, 3, 7, 2, 7, 8)
)
vote <- create_vote(raw, xtype = 3, candidate = c('a', 'b', 'c', 'd', 'e'))
win1 <- cdc_simple(vote) # no winner
win2 <- cdc_schulze(vote) # winner is e
win2 <- cdc_schulze(win1)
# }
Run the code above in your browser using DataLab