pr <- as.PowerRelation("123 > 12 ~ 13 ~ 23 > 3 > 1 ~ 2 > {}")
# Dominance
stopifnot(pr %:% 1 %>=dom% 2)
# Strict dominance
stopifnot((pr %:% 1 %>dom% 2) == FALSE)
# Cumulative dominance
stopifnot(pr %:% 1 %>=cumuldom% 2)
# Strict cumulative dominance
stopifnot((pr %:% 1 %>cumuldom% 2) == FALSE)
# CP-Majority relation
stopifnot(pr %:% 1 %>=cp% 2)
# Strict CP-Majority relation
stopifnot((pr %:% 1 %>cp% 2) == FALSE)
# Ordinal banzhaf relation
stopifnot(pr %:% 1 %>=banz% 2)
# Strict ordinal banzhaf relation
# (meaning 1 had a strictly higher positive contribution than 2)
stopifnot((pr %:% 1 %>banz% 2) == FALSE)
# Copeland-like method
stopifnot(pr %:% 1 %>=cop% 2)
stopifnot(pr %:% 2 %>=cop% 1)
# Strict Copeland-like method
# (meaning pairwise winning minus pairwise losing comparison of
# 1 is strictly higher than of 2)
stopifnot((pr %:% 1 %>cop% 2) == FALSE)
stopifnot((pr %:% 2 %>cop% 1) == FALSE)
stopifnot(pr %:% 3 %>cop% 1)
# Kramer-Simpson-like method
stopifnot(pr %:% 1 %>=ks% 2)
stopifnot(pr %:% 2 %>=ks% 1)
# Strict Kramer-Simpson-like method
# (meaning ks-score of 1 is actually higher than 2)
stopifnot((pr %:% 2 %>ks% 1) == FALSE)
stopifnot((pr %:% 1 %>ks% 2) == FALSE)
stopifnot(pr %:% 3 %>ks% 1)
# Lexicographical and dual lexicographical excellence
stopifnot(pr %:% 3 %>=lex% 1)
stopifnot(pr %:% 3 %>=duallex% 1)
# Strict lexicographical and dual lexicographical excellence
# (meaning their lexicographical scores don't match)
stopifnot(pr %:% 3 %>lex% 1)
stopifnot(pr %:% 3 %>duallex% 1)
# L^(1) and L^(2)
stopifnot(pr %:% 1 %>=L1% 2)
stopifnot(pr %:% 1 %>=L2% 2)
# Strict L^(1) and L^(2)
stopifnot((pr %:% 1 %>L1% 2) == FALSE)
stopifnot(pr %:% 3 %>L1% 1)
stopifnot((pr %:% 1 %>L2% 2) == FALSE)
stopifnot(pr %:% 3 %>L2% 1)
# L^p and L^p*
stopifnot(pr %:% 1 %>=LP% 2)
stopifnot(pr %:% 1 %>=LPS% 2)
# Strict L^(1) and L^(2)
stopifnot((pr %:% 1 %>LP% 2) == FALSE)
stopifnot(pr %:% 3 %>LP% 1)
stopifnot((pr %:% 1 %>LPS% 2) == FALSE)
stopifnot(pr %:% 3 %>LPS% 1)
Run the code above in your browser using DataLab