cdc_schulze: Schulze Method

Description Usage Arguments Value References Examples

View source: R/cdc_schulze.R

Description

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.

Usage

1
cdc_schulze(x, allow_dup = TRUE, min_valid = 1)

Arguments

x

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.

allow_dup

whether ballots with duplicated score values are taken into account. Default is TRUE.

min_valid

default is 1. If the number of valid entries of a ballot is less than this value, it will not be used.

Value

a condorcet object, which is essentially a list.

References

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
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)

Example output

MATCHING NAMES AND SCORES
COUNTING NA AND DUP VALUES
MAKING CONDORCET TABLE
COLLECTING RESULT
DONE
CREATING CDC MATRIX
------USE CDC MATRIX WITH NA IN x
EXTRACTING INFO
SELECTING
COLLECTING RESULT
DONE
CREATING CDC MATRIX
------USE CDC MATRIX WITH NA IN x
EXTRACTING INFO
SELECTING
COLLECTING RESULT
DONE
CREATING CDC MATRIX
EXTRACTING INFO
SELECTING
COLLECTING RESULT
DONE

votesys documentation built on May 2, 2019, 1:32 p.m.