PowerRelation
objects
We first introduce some basic definitions on binary relations. Let
X be a set. A set R ⊆ X × X is said
a binary relation on X. For two elements x, y ∈ X, xRy refers to
their relation, more formally it means that (x, y) ∈ R. A
binary relation (x, y) ∈ R is said
to be
- reflexive, if for each x ∈ X, xRx,
- transitive, if for each x, y, z ∈ X, xRy
and yRz ⇒ xRz,
- total, if for each x, y ∈ X, x ≠ y ⇒ xRy
or yRx,
- symmetric, if for each x, y ∈ X, xRy ⇔ yRx,
- asymmetric, if for each x, y ∈ X, (x, y) ∈ R ⇒ (y, x) ∉ R,
and
- antisymmetric, if for each x, y ∈ X, xRy ∩ yRx ⇒ x = y.
A preorder is defined as a reflexive and transitive
relation. If it is total, it is called a total preorder.
Additionally if it is antisymmetric, it is called a linear
order.
Let N = {1, 2, …, n} be a
finite set of elements, sometimes also called players.
For some p ∈ {1, …, 2n},
let 𝒫 = {S1, S2, …, Sp}
be a set of coalitions such that Si ⊆ N
for all i ∈ {1, …, p}. Thus 𝒫 ⊆ 2N, where 2N denotes the power set
of N, the set of all subsets
or coalitions of N.
𝒯(N) denotes the set of all
total preorders on N, 𝒯(𝒫) the set of all total preorders on 𝒫. A single total preorder ≿ ∈ 𝒯(𝒫) is said a power
relation.
In a given power relation ≿ ∈ 𝒯(𝒫)
on 𝒫 ⊆ 2N, its
symmetric part is denoted by ∼ (i.e.,
S ∼ T if S ≿ T and T ≿ S), whereas its
asymmetric part is denoted by ≻ (i.e.,
S ≻ T if S ≿ T and not T ≿ S). In other terms, for
S ∼ T we say that
S is indifferent to
T, whereas for S ≻ T we say that S is strictly better than
T.
Lastly, for a given power relation in the form of S1 ≿ S2 ≿ … ≿ Sm,
coalitions that are indifferent to one another can be grouped into
equivalence classes ∑i such that we get the
quotient order ∑1 ≻ ∑2 ≻ … ≻ ∑m.
Let N = {1, 2} be two
players with its corresponding power set 2N = {{1, 2}, {1}, {2}, ∅}.
The following power relation is given:
$$
\begin{array}{rrrr}
\succsim \ =\ \{(\{1,2\},\{1,2\}), & (\{1,2\},\{2\}), &
(\{1,2\},\emptyset), & (\{1,2\},\{1\}),\hphantom{\}}\\
& (\{2\}, \{2\}), & (\{2\}, \emptyset), &
\hphantom{1,}(\{2\}, \{1\}),\hphantom{\}}\\
& (\emptyset, \emptyset), & (\emptyset, \{2\}), &
(\emptyset, \{1\}),\hphantom{\}}\\
& & & (\{1\}, \{1\})\hphantom{,}\}
\end{array}
$$
This power relation can be rewritten in a consecutive order as: {1, 2} ≻ {2} ∼ ∅ ≻ {1}. Its quotient order is
formed by three equivalence classes ∑1 = {{1, 2}}, ∑2 = {{2}, ∅},
and ∑3 = {{1}}; so the
quotient order of ≿ is such that {{1, 2}} ≻ {{2}, ∅} ≻ {{1}}.
Note that the way the set ≿ is
presented in the example is somewhat deliberate to better visualize
occurring symmetries and asymmetries. This also lets us neatly represent
a power relation in the form of an incidence
matrix.
Creating PowerRelation
objects
A power relation in the socialranking
package is defined
to be reflexive, transitive and total. In designing the package it was
deemed logical to have the coalitions specified in a consecutive order,
as seen in Example 1. Each coalition in that order
is split either by a ">"
(left side strictly better) or
a "~"
(two coalitions indifferent to one another). The
following code chunk shows the power relation from Example 1 and how a correlating PowerRelation
object can be constructed.
library(socialranking)
pr <- PowerRelation(list(
list(c(1,2)),
list(2, c()),
list(1)
))
pr
## 12 > (2 ~ {}) > 1
## [1] "PowerRelation" "SingleCharElements"
Notice how coalitions such as {1, 2}
are written as 12
to improve readability. Similarly,
passing a string to the function as.PowerRelation()
saves
some typing on the user’s end by interpreting each character of a
coalition as a separate element. Note that spaces in that function are
ignored.
as.PowerRelation("12 > 2~{} > 1")
## 12 > (2 ~ {}) > 1
The compact notation is only done in PowerRelation
objects where every element is one digit or one character long. If this
is not the case, curly braces and commas are added where needed.
prLong <- PowerRelation(list(
list(c("Alice", "Bob")),
list("Bob", c()),
list("Alice")
))
prLong
## {Alice, Bob} > ({Bob} ~ {}) > {Alice}
## [1] "PowerRelation"
Some may have spotted a "SingleCharElements"
class
missing in class(prLong)
that has been there in
class(pr)
. "SingleCharElements"
influences how
coalitions are printed. If it is removed from class(pr)
,
the output will include the same curly braces and commas displayed in
prLong
.
class(pr) <- class(pr)[-which(class(pr) == "SingleCharElements")]
pr
## {1, 2} > ({2} ~ {}) > {1}
Internally a PowerRelation
is a list with four
attributes.
Attribute |
Description |
Value in pr |
elements |
Sorted vector of elements |
c(1,2) |
eqs |
List containing lists, each containing coalitions in the same equivalence class |
list(list(c(1,2)),
list(c(2), c()),
list(c(1))) |
coalitionLookup |
Function to determine a coalition's equivalence class index |
function(coalition) |
elementLookup |
Function to determine, which coalitions an element takes part in |
function(element) |
While coalitions are formally defined as sets, meaning the order
doesn’t matter and each element is unique, the package tries to stay
flexible. As such, coalitions will only be sorted during initialization,
but duplicate elements will not be removed.
prAtts <- PowerRelation(list(
list(c(2,2,1,1,2)),
list(c(2,1), c())
))
## Warning in createLookupTables(equivalenceClasses): Found 1 coalition that contain elements more than once.
## - 1, 2 in the coalition {1, 1, 2, 2, 2}
## 11222 > (12 ~ {})
## [1] 1 2
prAtts$coalitionLookup(c(1,2))
## [1] 2
prAtts$coalitionLookup(c(2,1))
## [1] 2
prAtts$coalitionLookup(c(2,1,2,1,2))
## [1] 1
## [[1]]
## [1] 1 1
##
## [[2]]
## [1] 1 1
##
## [[3]]
## [1] 1 1
##
## [[4]]
## [1] 2 1
Manipulating PowerRelation
objects
It is strongly discouraged to directly manipulate
PowerRelation
objects, as its attributes are so tightly
coupled. This would require updates in multiple places. Instead, it is
advisable to simply create new PowerRelation
objects.
To permutate the order of equivalence classes, it is possible to take
the equivalence classes in $eqs
and use a vector of indexes
to move them around.
pr <- as.PowerRelation("12 > (1 ~ {}) > 2")
PowerRelation(pr$eqs[c(2, 3, 1)])
## (1 ~ {}) > 2 > 12
PowerRelation(rev(pr$eqs))
## 2 > (1 ~ {}) > 12
For permutating individual coalitions, using
as.PowerRelation.list()
may be more convenient since it
doesn’t require nested list indexing.
coalitions <- unlist(pr$eqs, recursive = FALSE)
compares <- c(">", "~", ">")
as.PowerRelation(coalitions[c(2,1,3,4)], comparators = compares)
## 1 > (12 ~ {}) > 2
# notice that the length of comparators does not need to match
# length(coalitions)-1
as.PowerRelation(rev(coalitions), comparators = c("~", ">"))
## (2 ~ {}) > (1 ~ 12)
# not setting the comparators parameter turns it into a linear order
as.PowerRelation(coalitions)
## 12 > 1 > {} > 2
appendMissingCoalitions()
Let ≿ ∈ 𝒯(𝒫). We may have not
included all possible coalitions, such that 𝒫 ⊂ 2N, 𝒫 ≠ 2N.
appendMissingCoalitions()
appends all the missing
coalitions 2N − 𝒫
as a single equivalence class to the end of the power relation.
pr <- PowerRelation(list(
list(c("AT", "DE"), "FR"),
list("DE"),
list(c("AT", "FR"), "AT")
))
pr
## ({AT, DE} ~ {FR}) > {DE} > ({AT, FR} ~ {AT})
# since we have 3 elements, the super set 2^N should include 8 coalitions
appendMissingCoalitions(pr)
## ({AT, DE} ~ {FR}) > {DE} > ({AT, FR} ~ {AT}) > ({AT, DE, FR} ~ {DE, FR} ~ {})
makePowerRelationMonotonic()
A power relation ≿ ∈ 𝒯(𝒫) is
monotonic if
S ≿ T ⇒ T ⊂ S
for all S, T ⊆ N. In other
terms, given a monotonic power relation, for any coalition, all its
subsets cannot be ranked higher.
makePowerRelationMonotonic()
turns a potentially
non-monotonic power relation into a monotonic one by moving and
(optionally) adding all missing coalitions in 2N − 𝒫 to the
corresponding equivalence classes.
pr <- as.PowerRelation("a > b > c ~ ac > abc")
makePowerRelationMonotonic(pr)
## (abc ~ ab ~ ac ~ a) > (bc ~ b) > c
makePowerRelationMonotonic(pr, addMissingCoalitions = FALSE)
## (abc ~ ac ~ a) > b > c
# notice how an empty coalition in some equivalence class
# causes all remaining coalitions to be moved there
makePowerRelationMonotonic(as.PowerRelation("ab > c > {} > abc > a > b"))
## (abc ~ ab) > (ac ~ bc ~ c) > (a ~ b ~ {})
Creating power sets
As the number of elements n
increases, the number of possible coalitions increases to |2N| = 2n.
createPowerset()
is a convenient function that not only
creates a power set 2N which can be used to
call PowerRelation
or as.PowerRelation()
, but
also formats the function call in such a way that makes it easy to
rearrange the ordering of the coalitions. RStudio offers shortcuts such
as Alt+Up or Alt+Down (Option+Up or Option+Down on MacOS) to move one or
multiple lines of code up or down (see fig. below).
createPowerset(
c("a", "b", "c"),
result = "print"
)
## as.PowerRelation("
## abc
## > ab
## > ac
## > bc
## > a
## > b
## > c
## > {}
## ")
Using Alt+Up or Alt+Down to move one or more
lines of code
By default, createPowerset()
returns the power set in
the form of a list. This list can be passed directly to
as.PowerRelation()
to create a linear order.
ps <- createPowerset(1:2, includeEmptySet = FALSE)
ps
## [[1]]
## [1] 1 2
##
## [[2]]
## [1] 1
##
## [[3]]
## [1] 2
## 12 > 1 > 2
# equivalent
PowerRelation(list(ps))
## (12 ~ 1 ~ 2)
as.PowerRelation(createPowerset(letters[1:4]))
## abcd > abc > abd > acd > bcd > ab > ac > ad > bc > bd > cd > a > b > c > d > {}
Generating PowerRelation
objects
For the ease of experimentation, it is possible to have power
relations created automatically given a list of coalitions. Either,
- create random power relations using
generateRandomPowerRelation()
, or
- generate a sequence of all possible power relations with
powerRelationGenerator()
.
For the former, one may also specify if the generated power relation
should be a linear order (as in, there are no ~
but only
strict >
relations) and whether or not the power
relation should be monotonic (as in, {1} ≻ {1, 2} is not monotonic because {1} ⊂ {1, 2}).
set.seed(1)
coalitions <- createPowerset(1:3)
generateRandomPowerRelation(coalitions)
## 13 > (2 ~ 12) > {} > (1 ~ 123) > 23 > 3
generateRandomPowerRelation(coalitions)
## ({} ~ 1 ~ 2 ~ 12 ~ 123) > 3 > 13 > 23
generateRandomPowerRelation(coalitions, linearOrder = TRUE)
## 12 > 2 > 123 > 23 > 13 > 3 > {} > 1
generateRandomPowerRelation(coalitions, monotonic = TRUE)
## (123 ~ 23 ~ 12 ~ 13 ~ 1) > (2 ~ 3 ~ {})
generateRandomPowerRelation(coalitions, linearOrder = TRUE, monotonic = TRUE)
## 123 > 23 > 12 > 2 > 13 > 1 > 3 > {}
For looping through all possible power relations,
powerRelationGenerator()
returns a generator function that,
when called repeatedly, returns one unique PowerRelation
object after the other. If all permutations have been exhausted,
NULL
is returned.
coalitions <- list(c(1,2), 1, 2)
gen <- powerRelationGenerator(coalitions)
while(!is.null(pr <- gen())) {
print(pr)
}
## (12 ~ 1 ~ 2)
## (12 ~ 1) > 2
## (12 ~ 2) > 1
## (1 ~ 2) > 12
## 12 > (1 ~ 2)
## 1 > (12 ~ 2)
## 2 > (12 ~ 1)
## 12 > 1 > 2
## 12 > 2 > 1
## 1 > 12 > 2
## 2 > 12 > 1
## 1 > 2 > 12
## 2 > 1 > 12
Permutations over power relations can be split into two parts:
- generating partitions, or, generating differently sized equivalence
classes, and
- moving coalitions between these partitions.
In the code example above, we started with a single partition of size
three, wherein all coalitions are considered equally preferable. By the
end, we have reached the maximum number of partitions, where each
coalition is put inside an equivalence class of size 1.
The partition generation can be reversed, such that we first receive
linear power relations.
gen <- powerRelationGenerator(coalitions, startWithLinearOrder = TRUE)
while(!is.null(pr <- gen())) {
print(pr)
}
## 12 > 1 > 2
## 12 > 2 > 1
## 1 > 12 > 2
## 2 > 12 > 1
## 1 > 2 > 12
## 2 > 1 > 12
## 12 > (1 ~ 2)
## 1 > (12 ~ 2)
## 2 > (12 ~ 1)
## (12 ~ 1) > 2
## (12 ~ 2) > 1
## (1 ~ 2) > 12
## (12 ~ 1 ~ 2)
Notice that the “moving coalitions” part was not reversed, only the
order the partitions come in.
Similarly, we are also able to skip the current partition.
gen <- powerRelationGenerator(coalitions)
# partition 3
gen <- generateNextPartition(gen)
# partition 2+1
gen <- generateNextPartition(gen)
# partition 1+2
gen()
## 12 > (1 ~ 2)
Note: the number of possible power relations grows tremendously fast
as the number of coalitions rises. To get to that number, first consider
how many ways n coalitions can
be split into k partitions,
also known as the Stirling number of second kind,
$$
S(n,k) = \frac{1}{k!}\ \sum_{j=0}^k (-1)^j \binom{k}{j}(k-j)^n.
$$
The number of all possible partitions given n coalitions is known as the Bell
number (see also numbers::bell()
),
$$
B_n = \sum_{j=0}^k S(n,k).
$$
Given a set of coalitions 𝒫 ∈ 2N, the number of
total preorders in 𝒯(𝒫) is
$$
|\mathcal{T}(\mathcal{P})| = \sum_{k=0}^{|\mathcal{P}|} k!\ *\
S(|\mathcal{P}|, k)
$$
1 |
1 |
1 |
2 |
2 |
3 |
3 |
5 |
13 |
4 |
15 |
75 |
5 |
52 |
541 |
6 |
203 |
4.683 |
7 |
877 |
47.293 |
8 |
4.140 |
545.835 |
9 |
21.147 |
7.087.261 |
10 |
115.975 |
102.247.563 |
11 |
678.570 |
1.622.632.573 |
12 |
4.213.597 |
28.091.567.595 |
13 |
27.644.437 |
526.858.348.381 |
14 |
190.899.322 |
10.641.342.970.441 |
(24 − 1)
15 |
1.382.958.545 |
230.283.190.977.959 |
16 |
10.480.142.147 |
5.315.654.681.940.580 |
SocialRanking
Objects
The main goal of the socialranking
package is to rank
elements based on a given power ranking. More formally we try to map
R : 𝒯(𝒫) → 𝒯(N),
associating to each power relation ≿ ∈ 𝒯(𝒫) a total preorder R(≿) (or R≿) over the elements of
N.
In this context iR≿j
tells us that, given a power relation ≿
and applying a social ranking solution R(≿), i is ranked higher than or equal to
j. From here on out,
>
and ~
also denote the asymmetric and the
symmetric part of a social ranking, respectively, i >
j indicating that i is strictly better than j, whereas in i ~
j, i is indifferent to j.
In literature, iI≿j
and iP≿j
are often used to denote the symmetric and asymmetric part,
respectively. iI≿j
therefore means that iR≿j
and jR≿i,
whereas iP≿j
implies that iR≿j
but not jR≿j.
In section 3.1 we show how a general
SocialRanking
object can be constructed using the
doRanking
function. In the following sections, we will
introduce the notion of dominance[4],
cumulative dominance[13] and CP-Majority
comparison[6] that lets us compare two
elements before diving into the social ranking solutions of the Ordinal
Banzhaf Index[5], Copeland-like and
Kramer-Simpson-like methods[10], and
lastly the Lexicographical Excellence Solution[9] (Lexcel) and the Dual Lexicographical
Excellence solution[14] (Dual Lexcel).
Let {a, b} ≻ ({a, c} ∼ {b, c}) ≻ ({a} ∼ {c}) > ({a, b, c} ∼ ∅) ≻ {b}
be a power ranking. Using the following social ranking solutions, we
get:
a > b > c
for lexcelRanking
,
L1Ranking
and L2Ranking
a > c > b
for dualLexcelRanking
,
ordinalBanzhafRanking
and LPSRanking
a > b ~ c
for copelandRanking
and
kramerSimpsonRanking
a ~ c > b
for ordinalBanzhafRanking
and
LPRanking
Creating SocialRanking
objects
A SocialRanking
object represents a total preorder in
𝒯(N) over the elements of
N. Internally they are saved
as a list of vectors, each containing players that are indifferent to
one another. This is somewhat similar to the
equivalenceClasses
attribute in PowerRelation
objects.
The function doRanking
offers a generic way of creating
SocialRanking
objects. Given a sortable vector or list of
scores it determines the power relation between all players, where the
names of the elements are determined from the names()
attribute of scores
. Hence, a PowerRelation
object is not necessary to create a SocialRanking
object.
# we define some arbitrary score vector where "a" scores highest.
# "b" and "c" both score 1, thus they are indifferent.
scores <- c(a = 100, b = 1, c = 1)
doRanking(scores)
## a > b ~ c
# we can also tell doRanking to punish higher scores
doRanking(scores, decreasing = FALSE)
## b ~ c > a
When working with types that cannot be sorted (i.e.,
lists
), a function can be passed to the
compare
parameter that allows comparisons between arbitrary
elements. This function must take two parameters (i.e., a
and b
) and return a numeric value based on the
comparison:
compare(a,b) > 0
: a
scores higher than
b
,
compare(a,b) < 0
: a
scores lower than
b
,
compare(a,b) == 0
: a
and b
are equivalent.
scores <- list(a = c(3, 3, 3), b = c(2, 3, 2), c = c(7, 0, 2))
doRanking(scores, compare = function(a, b) sum(a) - sum(b))
## a ~ c > b
# a and c are considered to be indifferent, because their sums are the same
doRanking(scores, compare = function(a,b) sum(a) - sum(b), decreasing = FALSE)
## b > a ~ c
Comparison Functions
Comparison functions only compare two elements in a given power
relation. They do not offer a social ranking solution. However in cases
such as CP-Majority comparison, those comparison functions may be used
to construct a social ranking solution in some particular cases.
Dominance
(Dominance [4]) Given a power relation
≿ ∈ 𝒯(𝒫) and two elements i, j ∈ N, i dominates j in ≿ if S ∪ {i} ≿ S ∪ {j}
for each S ∈ 2N \ {i, j}.
i also strictly
dominates j if there exists
S ∈ 2N \ {i, j}
such that S ∪ {i} ≻ S ∪ {j}.
The implication is that for every coalition i and j can join, i has at least the same positive
impact as j.
The function dominates(pr, e1, e2)
only returns a
logical value TRUE
if e1
dominates
e2
, else FALSE
. Note that e1
not
dominating e2
does not indicate that
e2
dominates e1
, nor does it imply that
e1
is indifferent to e2
.
pr <- as.PowerRelation("3 > 1 > 2 > 12 > 13 > 23")
# 1 clearly dominates 2
dominates(pr, 1, 2)
## [1] TRUE
## [1] FALSE
# 3 does not dominate 1, nor does 1 dominate 3, because
# {}u3 > {}u1, but 2u1 > 2u3
dominates(pr, 1, 3)
## [1] FALSE
## [1] FALSE
# an element i dominates itself, but it does not strictly dominate itself
# because there is no Sui > Sui
dominates(pr, 1, 1)
## [1] TRUE
dominates(pr, 1, 1, strictly = TRUE)
## [1] FALSE
For any S ∈ 2N \ {i, j},
we can only compare S ∪ {i} ≿ S ∪ {j}
if both S ∪ {i} and
S ∪ {j} take part in
the power relation.
Additionally, for S = ∅, we
also want to compare {i} ≿ {j}. In some
situations however a comparison between singletons is not desired. For
this reason the parameter includeEmptySet
can be set to
FALSE
such that ∅ ∪ {i} ≿ ∅ ∪ {j} is not
considered in the CP-Majority comparison.
pr <- as.PowerRelation("ac > bc ~ b > a ~ abc > ab")
# FALSE because ac > bc, whereas b > a
dominates(pr, "a", "b")
## [1] FALSE
# TRUE because ac > bc, ignoring b > a comparison
dominates(pr, "a", "b", includeEmptySet = FALSE)
## [1] TRUE
Cumulative Dominance
When comparing two players i, j ∈ N, instead
of looking at particular coalitions S ∈ 2N \ {i, j}
they can join, we look at how many stronger coalitions they can form at
each point. This property was originally introduced in [13] as a regular dominance axiom.
For a given power relation ≿ ∈ 𝒯(𝒫) and its corresponding quotient
order ∑1 ≻ … ≻ ∑m,
the power of a player i is
given by a vector ScoreCumul(i) ∈ ℕm
where we cumulatively sum the amount of times i appears in ∑k for each index k.
(Cumulative Dominance Score) Given a power relation ≿ ∈ 𝒯(𝒫) and its quotient order ∑1 ≻ … ≻ ∑m,
the cumulative score vector ScoreCumul(i) ∈ ℕm
of an element i ∈ N
is given by:
(Cumulative Dominance) Given two elements i, j ∈ N, i cumulatively dominates
j in ≿, if ScoreCumul(i)k ≥ ScoreCumul(j)k
for each k ∈ {1, …, m}. i also strictly
cumulatively dominates j if
there exists a k such that
ScoreCumul(i)k > ScoreCumul(j)k.
For a given PowerRelation
object pr
and two
elements e1
and e2
,
cumulativeScores(pr)
returns the vectors described in
definition 2 for each element,
cumulativelyDominates(pr, e1, e2)
returns TRUE
or FALSE
based on definition 3.
pr <- as.PowerRelation("ab > (ac ~ bc) > (a ~ c) > {} > b")
cumulativeScores(pr)
## $a
## [1] 1 2 3 3 3
##
## $b
## [1] 1 2 2 2 3
##
## $c
## [1] 0 2 3 3 3
##
## attr(,"class")
## [1] "CumulativeScores"
# for each index k, $a[k] >= $b[k]
cumulativelyDominates(pr, "a", "b")
## [1] TRUE
# $a[3] > $b[3], therefore a also strictly dominates b
cumulativelyDominates(pr, "a", "b", strictly = TRUE)
## [1] TRUE
# $b[1] > $c[1], but $c[3] > $b[3]
# therefore neither b nor c dominate each other
cumulativelyDominates(pr, "b", "c")
## [1] FALSE
cumulativelyDominates(pr, "c", "b")
## [1] FALSE
Similar to the dominance property from our previous section, two
elements not dominating one or the other does not indicate that they are
indifferent.
CP-Majority comparison
The Ceteris Paribus Majority (CP-Majority) relation is a somewhat
relaxed version of the dominance property. Instead of checking if S ∪ {i} ≿ S ∪ {j}
for all S ∈ 2N \ {i, j},
the CP-Majority relation iRCP≿j
holds if the number of times S ∪ {i} ≿ S ∪ {j}
is greater than or equal to the number of times S ∪ {j} ≿ S ∪ {i}.
(CP-Majority [6]) Let ≿ ∈ 𝒯(𝒫). The Ceteris Paribus
majority relation is the binary relation RCP≿ ⊆ N × N
such that for all i, j ∈ N:
where dij(≿)
represents the cardinality of the set Dij(≿),
the set of all coalitions S ∈ 2N \ {i, j}
for which S ∪ {i} ≿ S ∪ {j}.
cpMajorityComparisonScore(pr, e1, e2)
calculates the two
scores dij(≿)
and −dji(≿).
Notice the minus sign - that way we can use the sum of both values to
determine the relation between e1
and e2
.
pr <- as.PowerRelation("ab > (ac ~ bc) > (a ~ c) > {} > b")
cpMajorityComparisonScore(pr, "a", "b")
## [1] 2 -1
cpMajorityComparisonScore(pr, "b", "a")
## [1] 1 -2
if(sum(cpMajorityComparisonScore(pr, "a", "b")) >= 0) {
print("a >= b")
} else {
print("b > a")
}
## [1] "a >= b"
As a slight variation the logical parameter strictly
calculates dij*(≿)
and −dji*(≿),
the number of coalitions S ∈ 2N \ {i, j}
where S ∪ {i} ≻ S ∪ {j}.
# Now (ac ~ bc) is not counted
cpMajorityComparisonScore(pr, "a", "b", strictly = TRUE)
## [1] 1 0
# Notice that the sum is still the same
sum(cpMajorityComparisonScore(pr, "a", "b", strictly = FALSE)) ==
sum(cpMajorityComparisonScore(pr, "a", "b", strictly = TRUE))
## [1] TRUE
Coincidentally, cpMajorityComparisonScore
with
strictly = TRUE
can be used to determine if e1
(strictly) dominates e2
.
cpMajorityComparisonScore
should be used for simple and
quick calculations. The more comprehensive function
cpMajorityComparison(pr, e1, e2)
does the same
calculations, but in the process retains more information about all the
comparisons that might be interesting to a user, i.e., the set Dij(≿)
and Dji(≿)
as well as the relation iRCP≿j.
See the documentation for a full list of available data.
# extract more information in cpMajorityComparison
cpMajorityComparison(pr, "a", "b")
## a > b
## D_ab = {c, {}}
## D_ba = {c}
## Score of a = 2
## Score of b = 1
# with strictly set to TRUE, coalition c does
# neither appear in D_ab nor in D_ba
cpMajorityComparison(pr, "a", "b", strictly = TRUE)
## a > b
## D_ab = {{}}
## D_ba = {}
## Score of a = 1
## Score of b = 0
The CP-Majority relation can generate cycles, which is the reason
that it is not offered as a social ranking solution. Instead, we will
introduce the Copeland-like method and Kramer-Simpson-like method that make use of
the CP-Majority functions to determine a power relation between
elements. For further readings on CP-Majority, see [7] and [10].
Social Ranking Solutions
Ordinal Banzhaf
The Ordinal Banzhaf Score is a vector defined by the principle of
marginal contributions. Intuitively speaking, if a player joining a
coalition causes it to move up in the ranking, it can be interpreted as
a positive contribution. On the contrary a negative contribution means
that participating causes the coalition to go down in the ranking.
(Ordinal marginal contribution [5]) Let
≿ ∈ 𝒯(𝒫). For a given element i ∈ N, its ordinal
marginal contribution miS(≿)
with right to a coalition S ∈ 𝒫 is defined as:
(Ordinal Banzhaf relation) Let ≿ ∈ 𝒯(𝒫). The Ordinal Banzhaf
relation is the binary relation RBanz≿ ⊆ N × N
such that for all i, j ∈ N:
where ScoreBanz(i) = ∑SmiS(≿)
for all S ∈ N \ {i}.
Note that if S ∉ 𝒫 or S ∪ {i} ∉ 𝒫, miS(≿) = 0.
The function ordinalBanzhafScores()
returns three
numbers for each element,
- the number of coalitions S
where a player’s contribution has a positive impact,
- the number of coalitions S
where a player’s contribution has a negative impact, and
- the number of coalitions S
for which no information can be gathered, because S ∉ 𝒫 or S ∪ {i} ∉ 𝒫.
The sum of the first two numbers determines the score of a player.
Players with higher scores rank higher.
pr <- as.PowerRelation(list(c(1,2), c(1), c(2)))
pr
## 12 > 1 > 2
# both players 1 and 2 have an Ordinal Banzhaf Score of 1
# therefore they are indifferent to one another
# note that the empty set is missing, as such we cannot compare {}u{i} with {}
ordinalBanzhafScores(pr)
## $`1`
## [1] 1 0 1
##
## $`2`
## [1] 1 0 1
##
## attr(,"class")
## [1] "OrdinalBanzhafScores"
ordinalBanzhafRanking(pr)
## 1 ~ 2
pr <- as.PowerRelation("ab > a > {} > b")
# player b has a negative impact on the empty set
# -> player b's score is 1 - 1 = 0
# -> player a's score is 2 - 0 = 2
sapply(ordinalBanzhafScores(pr), function(score) sum(score[c(1,2)]))
## a b
## 2 0
ordinalBanzhafRanking(pr)
## a > b
Copeland-like method
The Copeland-like method of ranking elements based on the CP-Majority
rule is strongly inspired by the Copeland score from social choice
theory[15]. The score of an element i ∈ N is determined by the
amount of the pairwise CP-Majority winning comparisons iRCP≿j,
minus the number of all losing comparisons jRCP≿i
against all other elements j ∈ N \ {i}.
(Copeland-like relation [10]) Let ≿ ∈ 𝒯(𝒫). The Copeland-like
relation is the binary relation RCop≿ ⊆ N × N
such that for all i, j ∈ N:
where ScoreCop(i) = |{j ∈ N \ {i} : dij(≿) ≥ dji(≿)}| − |{j ∈ N \ {i} : dij(≿) ≤ dji(≿)}|
copelandScores(pr)
returns two numerical values for each
element, a positive number for the winning comparisons (shown in ScoreCop(i) on the left)
and a negative number for the losing comparisons (in ScoreCop(i) on the
right).
pr <- as.PowerRelation("(abc ~ ab ~ c ~ a) > (b ~ bc) > ac")
scores <- copelandScores(pr)
# Based on CP-Majority, a>=b and a>=c (+2), but b>=a (-1)
scores$a
## [1] 2 -1
sapply(copelandScores(pr), sum)
## a b c
## 1 0 -1
## a > b > c
Kramer-Simpson-like method
Strongly inspired by the Kramer-Simpson method of social choice
theory[16, 17], elements are ranked
inversely to their greatest pairwise defeat over all possible
CP-Majority comparisons.
(Kramer-Simpson-like relation [10])
Let ≿ ∈ 𝒯(𝒫). The
Kramer-Simpson-like relation is the binary relation RKS≿ ⊆ N × N
such that for all i, j ∈ N:
where ScoreKS(i) = −maxjdji*(≿)
for all j ∈ N \ {i}.
Recall that dji*(≿)
returns the number of strict relations of S ∪ {j} ≻ S ∪ {i}.
kramerSimpsonScores(pr)
returns a vector with a single
numerical value for each element which, sorted highest to lowest, gives
us the ranking solution.
pr <- as.PowerRelation("(abc ~ ab ~ c ~ a) > (b ~ bc) > ac")
kramerSimpsonScores(pr)
## a b c
## -1 -1 -1
## attr(,"class")
## [1] "KramerSimpsonScores"
## a ~ b ~ c
Lexcel and Dual Lexcel
Lexicographical Excellence Solution
The idea behind the lexicographical excellence solution (Lexcel) is
to reward elements appearing more frequently in higher ranked
equivalence classes.
For a given power relation ≿ and its
quotient order ∑1 ≻ … ≻ ∑m,
we denote by ik the number of
coalitions in ∑k
containing i:
for k ∈ {1, …, m}.
Now, let ScoreLex(i) be the m-dimensional vector ScoreLex(i) = (i1, …, im)
associated to ≿. Consider the
lexicographic order ≥Lex
among vectors i and
j: i≥Lexj
if either i = j or
there exists t : ir = jr, r ∈ {1, …, t − 1},
and it > jt.
(Lexicographic-Excellence relation [8]) Let ≿ ∈ 𝒯(𝒫) with its corresponding quotient
order ∑1 ≻ … ≻ ∑m.
The Lexicographic-Excellence relation is the binary relation
RLex≿ ⊆ N × N
such that for all i, j ∈ N:
pr <- as.PowerRelation("12 > (123 ~ 23 ~ 3) > (1 ~ 2) > 13")
# show the number of times an element appears in each equivalence class
# e.g. 3 appears 3 times in [[2]] and 1 time in [[4]]
lapply(pr$equivalenceClasses, unlist)
## list()
lexScores <- lexcelScores(pr)
for(i in names(lexScores))
paste0("Lexcel score of element ", i, ": ", lexScores[i])
# at index 1, element 2 ranks higher than 3
lexScores['2'] > lexScores['3']
## [1] TRUE
# at index 2, element 2 ranks higher than 1
lexScores['2'] > lexScores['1']
## [1] TRUE
## 2 > 1 > 3
For some generalizations of the Lexcel solution see also [9].
Lexcel score vectors are very similar to the cumulative score vectors
(see section on Cumulative Dominance) in that
the number of times an element appears in a given equivalence class is
of interest. In fact, applying the base function cumsum
on
an element’s lexcel score gives us its cumulative score.
lexcelCumulated <- lapply(lexScores, cumsum)
cumulScores <- cumulativeScores(pr)
paste0(names(lexcelCumulated), ": ", lexcelCumulated, collapse = ', ')
## [1] "1: 1:4, 2: c(1, 3, 4, 4), 3: c(0, 3, 3, 4)"
paste0(names(cumulScores), ": ", cumulScores, collapse = ', ')
## [1] "1: 1:4, 2: c(1, 3, 4, 4), 3: c(0, 3, 3, 4)"
Dual Lexicographical Excellence Solution
Similar to the Lexcel ranking, the Dual Lexcel also uses the Lexcel
score vectors from definition 9 to establish a
ranking. However, instead of rewarding higher frequencies in high
ranking coalitions, it punishes players that appear more frequently in
lower ranking equivalence classes. In a more interpreted sense, it
punishes mediocrity.
Take the values ik for k ∈ {1, …, m} and the
Lexcel score vector ScoreLex(i) from the
section above. Consider the dual lexicographical order ≥DualLex among vectors i and j: i≥DualLexj
if either i = j or
there exists t : it < jt
and ir = jr, r ∈ {t + 1, …, m}.
(Dual Lexicographical-Excellence relation [14]) Let ≿ ∈ 𝒯(𝒫). The Dual
Lexicographic-Excellence relation is the binary relation RDualLex≿ ⊆ N × N
such that for all i, j ∈ N:
The only difference between the two functions
lexcelScores()
and dualLexcelScores()
is the
S3 class attached to the list, the former being
LexcelScores
and the latter being
DualLexcelScores
.
pr <- as.PowerRelation("12 > (123 ~ 23 ~ 3) > (1 ~ 2) > 13")
lexScores <- lexcelScores(pr)
# in regular Lexcel, 1 scores higher than 3
lexScores['1'] > lexScores['3']
## [1] TRUE
# turn Lexcel score into Dual Lexcel score
dualLexScores <- structure(
lexScores,
class = 'DualLexcelScores'
)
# now 1 scores lower than 3
dualLexScores['1'] > dualLexScores['3']
## [1] FALSE
# element 2 comes out at the top in both Lexcel and Dual Lexcel
lexcelRanking(pr)
## 2 > 1 > 3
## 2 > 3 > 1
L(1), L(2), Lp, Lp*
The remaining social ranking solutions are a variation of the lexcel
solutions from the previous section. While they all rank individuals
using a lexicographical approach, they all not only consider the
equivalence classes, but also the size of the coalitions an element
appears in. In answering the question of what player has more influence
in a group than others, we may want to attribute a higher value to
smaller coalitions.
For a given coalitional ranking ≿
and its associated quotient order Σ1 ≻ … ≻ Σm,
ScoreLex(i)
produced a vector of length m
with each index signifying the number of times i appears in each equivalence class.
This is now further extended to a function
Mi≿ = ScoreL(i) ∈ ℕ|N| × m
that produces a matrix. Each column q corresponds to an equivalence
class, each row p to a
coalition size. The values are then defined as
(Mi≿)p, q = |{S ∈ Σq:|S| = p
and i ∈ S}|.
For a ranking such as ({1, 2} ∼ {1} ∼ {2, 3}) ≻ N ≻ ⌀ ≻ ({1, 3} ∼ {2} ∼ {3})
this would give use the following three matrices.
$$M^\succsim_1 = \begin{bmatrix}
1 & 0 & 0 & 0\\
1 & 0 & 0 & 1\\
0 & 1 & 0 & 0
\end{bmatrix} M^\succsim_2 = \begin{bmatrix}
0 & 0 & 0 & 1\\
2 & 0 & 0 & 0\\
0 & 1 & 0 & 0
\end{bmatrix} M^\succsim_3 = \begin{bmatrix}
0 & 0 & 0 & 1\\
1 & 0 & 0 & 1\\
0 & 1 & 0 & 0
\end{bmatrix}$$
These matrices can be created with the L1Scores()
function.
pr <- as.PowerRelation('(12 ~ 1 ~ 23) > 123 > {} > (13 ~ 2 ~ 3)')
L1Scores(pr)
## $`1`
## [,1] [,2] [,3] [,4]
## [1,] 1 0 0 0
## [2,] 1 0 0 1
## [3,] 0 1 0 0
##
## $`2`
## [,1] [,2] [,3] [,4]
## [1,] 0 0 0 1
## [2,] 2 0 0 0
## [3,] 0 1 0 0
##
## $`3`
## [,1] [,2] [,3] [,4]
## [1,] 0 0 0 1
## [2,] 1 0 0 1
## [3,] 0 1 0 0
##
## attr(,"class")
## [1] "L1Scores"
Comparing these matrices builds the foundation the the L(1), L(2), Lp and Lp*
solutions.
L(1)
(L(1) solution
[9]) For i, j ∈ N, the
L(1) solution ranks
i above j if there exists a p0 ∈ {1, …, n}
and q0 ∈ {1, …, m}
such that the following conditions hold:
- $(M^\succsim_i)_{p,q\hphantom{^0}} =
(M^\succsim_j)_{p,q\hphantom{^0}}$ for all 1 ≤ p ≤ n and 1 ≤ q < q0,
- (Mi≿)p, q0 = (Mj≿)p, q0
for all 1 ≤ p < p0,
- (Mi≿)p0, q0 > (Mj≿)p0, q0
Put into simple terms, when comparing two elements i and j with their corresponding matrices,
we first compare the first column, top to bottom. The first row in which
the value for one is higher than the other determines their relation. If
both their columns are the same, we move forward to the next column.
In the example above, the lexcel determines that 1 ~ 2
.
However, in their matrices, 1 has a higher value in the first row of the
first column. This implies that L(1) prefers
1 > 2
simply because the singleton coalition {1} appears in the first equivalence class,
whereas {2} does not.
## 1 > 2 > 3
L(2)
Compared to the lexcel, L(1) could be seen as a
little too strict in enforcing a relation based on a singular coalition
while discarding all others in the same equivalence class. Take for
instance ({1} ∼ {2, 3} ∼ {2, 4} ∼ {2, 3, 4}) ≻ …. Even
though 2 seems to have a lot more
possibilities to cooperate, L(1) prefers 1 simply because the coalition it appears in
is smaller than all others.
The L(2) tries
to find a happy medium between these two solutions. For a given
equivalence class, it first compares the total number of times each
element appears (aka., the lexcel score). If both scores are the same,
only then does it compare the corresponding column according to the
L(1).
(L(2) solution
[9]) For i, j ∈ N, the
L(2) solution ranks
i above j if there exists a p0 ∈ {1, …, n}
and q0 ∈ {1, …, m}
such that the following conditions hold:
- $(M^\succsim_i)_{p,q\hphantom{^0}} =
(M^\succsim_j)_{p,q\hphantom{^0}}$ for all 1 ≤ p ≤ n and 1 ≤ q < q0,
- Either (2.1) ScoreLex(i)q0 > ScoreLex(j)q0,
or (2.2) (Mi≿)p, q0 = (Mj≿)p, q0
for all 1 ≤ p < p0
and (Mi≿)p0, q0 > (Mj≿)p0, q0
Note again that $\text{Score}_\text{Lex}(i)_{q^0} = \sum_{p=1}^{|N|}
(M^\succsim_i)_{p,q^0}$. To make finding the sum of each column
easier, these values are added as an extra row above. This also
conveniently allows us to use the traditional L(1) comparison on these
matrices.
The solution of L(2) will always coincide
either with the lexcel or with the L(1) solution. In the
example of the beginning of the section, in comparing 1 against 2,
the relation for L(2) coincides with L(1): the sum of the
first column in M1≿ and M2≿ equal both
to 2, inducing a row-by-row comparison,
same as with L(1).
In the latter example in this subsection, the sum of the first column
vectors of 1 and 2 are vastly different, causing L(2) to coincide with the
lexcel solution.
## 1 > 2 > 3
pr2 <- as.PowerRelation('1 ~ 23 ~ 24 ~ 234')
pr2 <- appendMissingCoalitions(pr2)
L1Ranking(pr2)
## 1 > 2 > 3 ~ 4
## 2 > 3 ~ 4 > 1
Lp
Lp and
Lp*
differ drastically in that they compare the matrices on a row-by-row
basis rather than column-by-column. This puts a much higher value on
smaller coalitions, regardless of which equivalence class they are
placed in.
Both of these solutions first consider the singleton coalition. For
two given elements i and j, if {i} ≻ {j}, then the
relation according to the Lp and Lp*
is already determined. If {i} {j}, every subsequent
comparison is done on the number of coalitions that rank strictly
higher. This may be practical in situation where we want individuals to
work in small groups and disregard any coalitions where they’d be better
off alone.
(Lp
solution [11]) For i, j ∈ N, the
social ranking solution Lp ranks i above j if one of the following conditions
hold:
- {i} ≻ {j};
- {i}, {j} ∈ Σk
and there exists a row p0 ∈ {2, …, |N|}
such that: ∑q < k(Mi≿)p, q = ∑q < k(Mj≿)p, q ∀p < p0,
and ∑q < k(Mi≿)p0, q > ∑q < k(Mj≿)p0, q.
The Lp
looks at the total number of times an element has the chance to form a
better coalition than its singleton. Since a lot of the information from
the matrix of an element is therefore redundant, LPScores()
discards much of it to save space. The first value then corresponds to
the equivalence class index that the singleton appears in, each
subsequent value the number of times it is able to form coalitions of
size 2, 3, and so on.
## $`1`
## [1] 1 0 0
##
## $`2`
## [1] 4 2 1
##
## $`3`
## [1] 4 1 1
##
## attr(,"class")
## [1] "LPScores"
## 1 > 2 > 3
Lp*
Only taking the sum of all coalitions of a certain size might not be
informative enough. Similarly to how L(1) builds a more
granual comparison between two elements by incorporating the coalition
size, Lp*
can be seen as a more granual version of the Lp by
incorporating the specific equivalence class the element appears in.
(Lp*
solution [11]) For i, j ∈ N, the
social ranking solution Lp*
ranks i above j if one of the following conditions
hold:
- {i} ≻ {j};
- {i}, {j} ∈ Σk
and there exists a row p0 ∈ {2, …, |N|}
and column q0 ∈ {1, …, k − 1}
such that: (Mi≿)p, q = (Mj≿)p, q ∀p < p0, q < k,
(Mi≿)p0, q = (Mj≿)p0, q ∀q < q0,
and (Mi≿)p0, q0 > (Mj≿)p0, q0.
The score matrices of LPSScores()
look similar to
L1Scores()
then, the only difference being the number of
columns; as any equivalence class with {i} ∈ Σk
and Σk ≻ Σl
does not influence the final ranking, these columns are discarded in the
final matrix.
## $`1`
## [,1] [,2] [,3] [,4]
## [1,] 1 0 0 0
## [2,] 1 0 0 1
## [3,] 0 1 0 0
##
## $`2`
## [,1] [,2] [,3] [,4]
## [1,] 0 0 0 1
## [2,] 2 0 0 0
## [3,] 0 1 0 0
##
## $`3`
## [,1] [,2] [,3] [,4]
## [1,] 0 0 0 1
## [2,] 1 0 0 1
## [3,] 0 1 0 0
##
## attr(,"class")
## [1] "L1Scores"
## $`1`
##
## [1,]
## [2,]
##
## $`2`
## [,1] [,2] [,3]
## [1,] 2 0 0
## [2,] 0 1 0
##
## $`3`
## [,1] [,2] [,3]
## [1,] 1 0 0
## [2,] 0 1 0
##
## attr(,"class")
## [1] "LP*Scores"
## 1 > 2 > 3
Relations
Incidence Matrix
In our vignette we focused more on the intuitive aspects of power
relations and social ranking solutions. To reiterate, a power relation
is a total preorder, or a reflexive and transitive relation ≿ ∈ 𝒫 × 𝒫, where ∼ denotes the symmetric part and ≻ its asymmetric part.
A power relation can be represented as an incidence matrix (bij) = B ∈ {0, 1}|𝒫| × |𝒫|.
Given two coalitions i, j ∈ 𝒫, if iRj then bij = 1,
else 0.
With the help of the relations
package, the functions
relations::as.relation(pr)
and
powerRelationMatrix(pr)
turn a PowerRelation
object into a relation
object. relations
then
offers ways to display the relation
object as an incidence
matrix with relation_incidence(rel)
and to test basic
properties such relation_is_linear_order(rel)
,
relation_is_acyclic(rel)
and
relation_is_antisymmetric(rel)
(see relations
package for more [12]).
pr <- as.PowerRelation("ab > a > {} > b")
rel <- relations::as.relation(pr)
relations::relation_incidence(rel)
## Incidences:
## ab a {} b
## ab 1 1 1 1
## a 0 1 1 1
## {} 0 0 1 1
## b 0 0 0 1
c(
relations::relation_is_acyclic(rel),
relations::relation_is_antisymmetric(rel),
relations::relation_is_linear_order(rel),
relations::relation_is_complete(rel),
relations::relation_is_reflexive(rel),
relations::relation_is_transitive(rel)
)
## [1] TRUE TRUE TRUE TRUE TRUE TRUE
Note that the columns and rows are sorted by their names in
relation_domain(rel)
, hence why each name is preceded by
the ordering number.
# a power relation where coalitions {1} and {2} are indifferent
pr <- as.PowerRelation("12 > (1 ~ 2)")
rel <- relations::as.relation(pr)
# we have both binary relations {1}R{2} as well as {2}R{1}
relations::relation_incidence(rel)
## Incidences:
## 12 1 2
## 12 1 1 1
## 1 0 1 1
## 2 0 1 1
# FALSE
c(
relations::relation_is_acyclic(rel),
relations::relation_is_antisymmetric(rel),
relations::relation_is_linear_order(rel),
relations::relation_is_complete(rel),
relations::relation_is_reflexive(rel),
relations::relation_is_transitive(rel)
)
## [1] FALSE FALSE FALSE TRUE TRUE TRUE
Cycles and Transitive Closure
A cycle in a power relation exists, if there is one coalition S ∈ 2N that
appears twice. For example, in {1, 2} ≻ ({1} ∼ ∅) ≻ {1, 2}, the coalition
{1, 2} appears at the beginning and at
the end of the power relation.
Properly handling power relations and calculating social ranking
solutions with cycles is somewhat ill-defined, hence a warning message
is shown as soon as one is created.
as.PowerRelation("12 > 2 > (1 ~ 2) > 12")
## Warning in createLookupTables(equivalenceClasses): Found 2 duplicate coalitions, listed below. This violates transitivity and can cause issues with certain ranking solutions. You may want to take a look at socialranking::transitiveClosure().
## - {2}
## - {1, 2}
## 12 > 2 > (1 ~ 2) > 12
Recall that a power relation is transitive, meaning for three
coalitions x, y, z ∈ 2N,
if xRy and
yRz, then
xRz. If we
introduce cycles, we pretty much introduce symmetry. Assume we have the
power relation x ≻ y ≻ x. Then,
even though xRy and yRx are defined as
the asymmetric part of the power relation ≿, together they form the symmetric power
relation x ∼ y.
transitiveClosure(pr)
is a function that turns a power
relation with cycles into one without one. In the process of removing
duplicate coalitions, it turns all asymmectric relations within a cycle
into symmetric relations.
pr <- suppressWarnings(as.PowerRelation(list(1, 2, 1)))
pr
## 1 > 2 > 1
## (1 ~ 2)
# two cycles, (1>3>1) and (2>23>2)
pr <- suppressWarnings(
as.PowerRelation("1 > 3 > 1 > 2 > 23 > 2")
)
transitiveClosure(pr)
## (1 ~ 3) > (2 ~ 23)
# overlapping cycles
pr <- suppressWarnings(
as.PowerRelation("c > ac > b > ac > (a ~ b) > abc")
)
transitiveClosure(pr)
## c > (ac ~ b ~ a) > abc
Bibliography
1. Shapley LS, Shubik M. A method for evaluating the distribution of
power in a committee system. American political science review.
1954;48:787–92.
2. Banzhaf III JF. Weighted voting doesn’t work: A mathematical
analysis. Rutgers L Rev. 1964;19:317.
3. Holler MJ, Nurmi H. Power, voting, and voting power: 30 years after.
Springer; 2013.
4. Moretti S, Öztürk M. Some axiomatic and algorithmic perspectives on
the social ranking problem. In: International conference on algorithmic
DecisionTheory. Springer; 2017. p. 166–81.
5. Khani H, Moretti S, Öztürk M. An ordinal banzhaf index for social
ranking. In: 28th international joint conference on artificial
intelligence (IJCAI 2019). 2019. p. 378–84.
6. Haret A, Khani H, Moretti S, Öztürk M. Ceteris paribus majority for
social ranking. In: 27th international joint conference on artificial
intelligence (IJCAI-ECAI-18). 2018. p. 303–9.
7. Fayard N, Öztürk-Escoffier M. Ordinal social ranking: Simulation for
CP-majority rule. In: DA2PL’2018 (from multiple criteria decision aid to
preference learning). 2018.
8. Bernardi G, Lucchetti R, Moretti S. Ranking objects from a preference
relation over their subsets. Social Choice and Welfare. 2019;52:589–606.
9. Algaba E, Moretti S, Rémila E, Solal P. Lexicographic solutions for
coalitional rankings. Social Choice and Welfare. 2021;1–33.
10. Allouche T, Escoffier B, Moretti S, Öztürk M. Social ranking
manipulability for the CP-majority, banzhaf and lexicographic excellence
solutions. In: Bessiere C, editor. Proceedings of the twenty-ninth
international joint conference on artificial intelligence,
IJCAI-20. International Joint Conferences on Artificial
Intelligence Organization; 2020. p. 17–23. doi:
10.24963/ijcai.2020/3.
11. Béal S, Rémila E, Solal P. Lexicographic solutions for coalitional
rankings based on individual and collective performances. Journal of
Mathematical Economics. 2022;102:102738.
12. Meyer D, Hornik K. Relations: Data structures and algorithms for
relations. 2022.
https://CRAN.R-project.org/package=relations.
13. Moretti S. An axiomatic approach to social ranking under coalitional
power relations. Homo Oeconomicus. 2015;32:183–208.
14. Serramia M, López-Sánchez M, Moretti S, Rodríguez-Aguilar JA. On the
dominant set selection problem and its application to value alignment.
Autonomous Agents and Multi-Agent Systems. 2021;35:1–38.
15. Copeland AH. A reasonable social welfare function. mimeo, 1951.
University of Michigan; 1951.
16. Simpson PB. On defining areas of voter choice: Professor tullock on
stable voting. The Quarterly Journal of Economics. 1969;83:478–90.
17. Kramer GH. A dynamical model of political equilibrium. Journal of
Economic Theory. 1975;16:310–34.
SocialRanking
ObjectsThe main goal of the
socialranking
package is to rank elements based on a given power ranking. More formally we try to map R : 𝒯(𝒫) → 𝒯(N), associating to each power relation ≿ ∈ 𝒯(𝒫) a total preorder R(≿) (or R≿) over the elements of N.In this context iR≿j tells us that, given a power relation ≿ and applying a social ranking solution R(≿), i is ranked higher than or equal to j. From here on out,
>
and~
also denote the asymmetric and the symmetric part of a social ranking, respectively, i>
j indicating that i is strictly better than j, whereas in i~
j, i is indifferent to j.In literature, iI≿j and iP≿j are often used to denote the symmetric and asymmetric part, respectively. iI≿j therefore means that iR≿j and jR≿i, whereas iP≿j implies that iR≿j but not jR≿j.
In section 3.1 we show how a general
SocialRanking
object can be constructed using thedoRanking
function. In the following sections, we will introduce the notion of dominance[4], cumulative dominance[13] and CP-Majority comparison[6] that lets us compare two elements before diving into the social ranking solutions of the Ordinal Banzhaf Index[5], Copeland-like and Kramer-Simpson-like methods[10], and lastly the Lexicographical Excellence Solution[9] (Lexcel) and the Dual Lexicographical Excellence solution[14] (Dual Lexcel).Let {a, b} ≻ ({a, c} ∼ {b, c}) ≻ ({a} ∼ {c}) > ({a, b, c} ∼ ∅) ≻ {b} be a power ranking. Using the following social ranking solutions, we get:
a > b > c
forlexcelRanking
,L1Ranking
andL2Ranking
a > c > b
fordualLexcelRanking
,ordinalBanzhafRanking
andLPSRanking
a > b ~ c
forcopelandRanking
andkramerSimpsonRanking
a ~ c > b
forordinalBanzhafRanking
andLPRanking
Creating
SocialRanking
objectsA
SocialRanking
object represents a total preorder in 𝒯(N) over the elements of N. Internally they are saved as a list of vectors, each containing players that are indifferent to one another. This is somewhat similar to theequivalenceClasses
attribute inPowerRelation
objects.The function
doRanking
offers a generic way of creatingSocialRanking
objects. Given a sortable vector or list of scores it determines the power relation between all players, where the names of the elements are determined from thenames()
attribute ofscores
. Hence, aPowerRelation
object is not necessary to create aSocialRanking
object.When working with types that cannot be sorted (i.e.,
lists
), a function can be passed to thecompare
parameter that allows comparisons between arbitrary elements. This function must take two parameters (i.e.,a
andb
) and return a numeric value based on the comparison:compare(a,b) > 0
:a
scores higher thanb
,compare(a,b) < 0
:a
scores lower thanb
,compare(a,b) == 0
:a
andb
are equivalent.Comparison Functions
Comparison functions only compare two elements in a given power relation. They do not offer a social ranking solution. However in cases such as CP-Majority comparison, those comparison functions may be used to construct a social ranking solution in some particular cases.
Dominance
(Dominance [4]) Given a power relation ≿ ∈ 𝒯(𝒫) and two elements i, j ∈ N, i dominates j in ≿ if S ∪ {i} ≿ S ∪ {j} for each S ∈ 2N \ {i, j}. i also strictly dominates j if there exists S ∈ 2N \ {i, j} such that S ∪ {i} ≻ S ∪ {j}.
The implication is that for every coalition i and j can join, i has at least the same positive impact as j.
The function
dominates(pr, e1, e2)
only returns a logical valueTRUE
ife1
dominatese2
, elseFALSE
. Note thate1
not dominatinge2
does not indicate thate2
dominatese1
, nor does it imply thate1
is indifferent toe2
.For any S ∈ 2N \ {i, j}, we can only compare S ∪ {i} ≿ S ∪ {j} if both S ∪ {i} and S ∪ {j} take part in the power relation.
Additionally, for S = ∅, we also want to compare {i} ≿ {j}. In some situations however a comparison between singletons is not desired. For this reason the parameter
includeEmptySet
can be set toFALSE
such that ∅ ∪ {i} ≿ ∅ ∪ {j} is not considered in the CP-Majority comparison.Cumulative Dominance
When comparing two players i, j ∈ N, instead of looking at particular coalitions S ∈ 2N \ {i, j} they can join, we look at how many stronger coalitions they can form at each point. This property was originally introduced in [13] as a regular dominance axiom.
For a given power relation ≿ ∈ 𝒯(𝒫) and its corresponding quotient order ∑1 ≻ … ≻ ∑m, the power of a player i is given by a vector ScoreCumul(i) ∈ ℕm where we cumulatively sum the amount of times i appears in ∑k for each index k.
(Cumulative Dominance Score) Given a power relation ≿ ∈ 𝒯(𝒫) and its quotient order ∑1 ≻ … ≻ ∑m, the cumulative score vector ScoreCumul(i) ∈ ℕm of an element i ∈ N is given by:
(Cumulative Dominance) Given two elements i, j ∈ N, i cumulatively dominates j in ≿, if ScoreCumul(i)k ≥ ScoreCumul(j)k for each k ∈ {1, …, m}. i also strictly cumulatively dominates j if there exists a k such that ScoreCumul(i)k > ScoreCumul(j)k.
For a given
PowerRelation
objectpr
and two elementse1
ande2
,cumulativeScores(pr)
returns the vectors described in definition 2 for each element,cumulativelyDominates(pr, e1, e2)
returnsTRUE
orFALSE
based on definition 3.Similar to the dominance property from our previous section, two elements not dominating one or the other does not indicate that they are indifferent.
CP-Majority comparison
The Ceteris Paribus Majority (CP-Majority) relation is a somewhat relaxed version of the dominance property. Instead of checking if S ∪ {i} ≿ S ∪ {j} for all S ∈ 2N \ {i, j}, the CP-Majority relation iRCP≿j holds if the number of times S ∪ {i} ≿ S ∪ {j} is greater than or equal to the number of times S ∪ {j} ≿ S ∪ {i}.
(CP-Majority [6]) Let ≿ ∈ 𝒯(𝒫). The Ceteris Paribus majority relation is the binary relation RCP≿ ⊆ N × N such that for all i, j ∈ N:
where dij(≿) represents the cardinality of the set Dij(≿), the set of all coalitions S ∈ 2N \ {i, j} for which S ∪ {i} ≿ S ∪ {j}.
cpMajorityComparisonScore(pr, e1, e2)
calculates the two scores dij(≿) and −dji(≿). Notice the minus sign - that way we can use the sum of both values to determine the relation betweene1
ande2
.As a slight variation the logical parameter
strictly
calculates dij*(≿) and −dji*(≿), the number of coalitions S ∈ 2N \ {i, j} where S ∪ {i} ≻ S ∪ {j}.Coincidentally,
cpMajorityComparisonScore
withstrictly = TRUE
can be used to determine ife1
(strictly) dominatese2
.cpMajorityComparisonScore
should be used for simple and quick calculations. The more comprehensive functioncpMajorityComparison(pr, e1, e2)
does the same calculations, but in the process retains more information about all the comparisons that might be interesting to a user, i.e., the set Dij(≿) and Dji(≿) as well as the relation iRCP≿j. See the documentation for a full list of available data.The CP-Majority relation can generate cycles, which is the reason that it is not offered as a social ranking solution. Instead, we will introduce the Copeland-like method and Kramer-Simpson-like method that make use of the CP-Majority functions to determine a power relation between elements. For further readings on CP-Majority, see [7] and [10].
Social Ranking Solutions
Ordinal Banzhaf
The Ordinal Banzhaf Score is a vector defined by the principle of marginal contributions. Intuitively speaking, if a player joining a coalition causes it to move up in the ranking, it can be interpreted as a positive contribution. On the contrary a negative contribution means that participating causes the coalition to go down in the ranking.
(Ordinal marginal contribution [5]) Let ≿ ∈ 𝒯(𝒫). For a given element i ∈ N, its ordinal marginal contribution miS(≿) with right to a coalition S ∈ 𝒫 is defined as:
(Ordinal Banzhaf relation) Let ≿ ∈ 𝒯(𝒫). The Ordinal Banzhaf relation is the binary relation RBanz≿ ⊆ N × N such that for all i, j ∈ N:
where ScoreBanz(i) = ∑SmiS(≿) for all S ∈ N \ {i}.
Note that if S ∉ 𝒫 or S ∪ {i} ∉ 𝒫, miS(≿) = 0.
The function
ordinalBanzhafScores()
returns three numbers for each element,The sum of the first two numbers determines the score of a player. Players with higher scores rank higher.
Copeland-like method
The Copeland-like method of ranking elements based on the CP-Majority rule is strongly inspired by the Copeland score from social choice theory[15]. The score of an element i ∈ N is determined by the amount of the pairwise CP-Majority winning comparisons iRCP≿j, minus the number of all losing comparisons jRCP≿i against all other elements j ∈ N \ {i}.
(Copeland-like relation [10]) Let ≿ ∈ 𝒯(𝒫). The Copeland-like relation is the binary relation RCop≿ ⊆ N × N such that for all i, j ∈ N:
where ScoreCop(i) = |{j ∈ N \ {i} : dij(≿) ≥ dji(≿)}| − |{j ∈ N \ {i} : dij(≿) ≤ dji(≿)}|
copelandScores(pr)
returns two numerical values for each element, a positive number for the winning comparisons (shown in ScoreCop(i) on the left) and a negative number for the losing comparisons (in ScoreCop(i) on the right).Kramer-Simpson-like method
Strongly inspired by the Kramer-Simpson method of social choice theory[16, 17], elements are ranked inversely to their greatest pairwise defeat over all possible CP-Majority comparisons.
(Kramer-Simpson-like relation [10]) Let ≿ ∈ 𝒯(𝒫). The Kramer-Simpson-like relation is the binary relation RKS≿ ⊆ N × N such that for all i, j ∈ N:
where ScoreKS(i) = −maxjdji*(≿) for all j ∈ N \ {i}.
Recall that dji*(≿) returns the number of strict relations of S ∪ {j} ≻ S ∪ {i}.
kramerSimpsonScores(pr)
returns a vector with a single numerical value for each element which, sorted highest to lowest, gives us the ranking solution.Lexcel and Dual Lexcel
Lexicographical Excellence Solution
The idea behind the lexicographical excellence solution (Lexcel) is to reward elements appearing more frequently in higher ranked equivalence classes.
For a given power relation ≿ and its quotient order ∑1 ≻ … ≻ ∑m, we denote by ik the number of coalitions in ∑k containing i:
for k ∈ {1, …, m}. Now, let ScoreLex(i) be the m-dimensional vector ScoreLex(i) = (i1, …, im) associated to ≿. Consider the lexicographic order ≥Lex among vectors i and j: i≥Lexj if either i = j or there exists t : ir = jr, r ∈ {1, …, t − 1}, and it > jt.
(Lexicographic-Excellence relation [8]) Let ≿ ∈ 𝒯(𝒫) with its corresponding quotient order ∑1 ≻ … ≻ ∑m. The Lexicographic-Excellence relation is the binary relation RLex≿ ⊆ N × N such that for all i, j ∈ N:
For some generalizations of the Lexcel solution see also [9].
Lexcel score vectors are very similar to the cumulative score vectors (see section on Cumulative Dominance) in that the number of times an element appears in a given equivalence class is of interest. In fact, applying the base function
cumsum
on an element’s lexcel score gives us its cumulative score.Dual Lexicographical Excellence Solution
Similar to the Lexcel ranking, the Dual Lexcel also uses the Lexcel score vectors from definition 9 to establish a ranking. However, instead of rewarding higher frequencies in high ranking coalitions, it punishes players that appear more frequently in lower ranking equivalence classes. In a more interpreted sense, it punishes mediocrity.
Take the values ik for k ∈ {1, …, m} and the Lexcel score vector ScoreLex(i) from the section above. Consider the dual lexicographical order ≥DualLex among vectors i and j: i≥DualLexj if either i = j or there exists t : it < jt and ir = jr, r ∈ {t + 1, …, m}.
(Dual Lexicographical-Excellence relation [14]) Let ≿ ∈ 𝒯(𝒫). The Dual Lexicographic-Excellence relation is the binary relation RDualLex≿ ⊆ N × N such that for all i, j ∈ N:
The only difference between the two functions
lexcelScores()
anddualLexcelScores()
is the S3 class attached to the list, the former beingLexcelScores
and the latter beingDualLexcelScores
.L(1), L(2), Lp, Lp*
The remaining social ranking solutions are a variation of the lexcel solutions from the previous section. While they all rank individuals using a lexicographical approach, they all not only consider the equivalence classes, but also the size of the coalitions an element appears in. In answering the question of what player has more influence in a group than others, we may want to attribute a higher value to smaller coalitions.
For a given coalitional ranking ≿ and its associated quotient order Σ1 ≻ … ≻ Σm, ScoreLex(i) produced a vector of length m with each index signifying the number of times i appears in each equivalence class. This is now further extended to a function
Mi≿ = ScoreL(i) ∈ ℕ|N| × m
that produces a matrix. Each column q corresponds to an equivalence class, each row p to a coalition size. The values are then defined as
(Mi≿)p, q = |{S ∈ Σq:|S| = p and i ∈ S}|.
For a ranking such as ({1, 2} ∼ {1} ∼ {2, 3}) ≻ N ≻ ⌀ ≻ ({1, 3} ∼ {2} ∼ {3}) this would give use the following three matrices.
$$M^\succsim_1 = \begin{bmatrix} 1 & 0 & 0 & 0\\ 1 & 0 & 0 & 1\\ 0 & 1 & 0 & 0 \end{bmatrix} M^\succsim_2 = \begin{bmatrix} 0 & 0 & 0 & 1\\ 2 & 0 & 0 & 0\\ 0 & 1 & 0 & 0 \end{bmatrix} M^\succsim_3 = \begin{bmatrix} 0 & 0 & 0 & 1\\ 1 & 0 & 0 & 1\\ 0 & 1 & 0 & 0 \end{bmatrix}$$
These matrices can be created with the
L1Scores()
function.Comparing these matrices builds the foundation the the L(1), L(2), Lp and Lp* solutions.
L(1)
(L(1) solution [9]) For i, j ∈ N, the L(1) solution ranks i above j if there exists a p0 ∈ {1, …, n} and q0 ∈ {1, …, m} such that the following conditions hold:
Put into simple terms, when comparing two elements i and j with their corresponding matrices, we first compare the first column, top to bottom. The first row in which the value for one is higher than the other determines their relation. If both their columns are the same, we move forward to the next column.
In the example above, the lexcel determines that
1 ~ 2
. However, in their matrices, 1 has a higher value in the first row of the first column. This implies that L(1) prefers1 > 2
simply because the singleton coalition {1} appears in the first equivalence class, whereas {2} does not.L(2)
Compared to the lexcel, L(1) could be seen as a little too strict in enforcing a relation based on a singular coalition while discarding all others in the same equivalence class. Take for instance ({1} ∼ {2, 3} ∼ {2, 4} ∼ {2, 3, 4}) ≻ …. Even though 2 seems to have a lot more possibilities to cooperate, L(1) prefers 1 simply because the coalition it appears in is smaller than all others.
The L(2) tries to find a happy medium between these two solutions. For a given equivalence class, it first compares the total number of times each element appears (aka., the lexcel score). If both scores are the same, only then does it compare the corresponding column according to the L(1).
(L(2) solution [9]) For i, j ∈ N, the L(2) solution ranks i above j if there exists a p0 ∈ {1, …, n} and q0 ∈ {1, …, m} such that the following conditions hold:
Note again that $\text{Score}_\text{Lex}(i)_{q^0} = \sum_{p=1}^{|N|} (M^\succsim_i)_{p,q^0}$. To make finding the sum of each column easier, these values are added as an extra row above. This also conveniently allows us to use the traditional L(1) comparison on these matrices.
The solution of L(2) will always coincide either with the lexcel or with the L(1) solution. In the example of the beginning of the section, in comparing 1 against 2, the relation for L(2) coincides with L(1): the sum of the first column in M1≿ and M2≿ equal both to 2, inducing a row-by-row comparison, same as with L(1). In the latter example in this subsection, the sum of the first column vectors of 1 and 2 are vastly different, causing L(2) to coincide with the lexcel solution.
Lp
Lp and Lp* differ drastically in that they compare the matrices on a row-by-row basis rather than column-by-column. This puts a much higher value on smaller coalitions, regardless of which equivalence class they are placed in.
Both of these solutions first consider the singleton coalition. For two given elements i and j, if {i} ≻ {j}, then the relation according to the Lp and Lp* is already determined. If {i} {j}, every subsequent comparison is done on the number of coalitions that rank strictly higher. This may be practical in situation where we want individuals to work in small groups and disregard any coalitions where they’d be better off alone.
(Lp solution [11]) For i, j ∈ N, the social ranking solution Lp ranks i above j if one of the following conditions hold:
The Lp looks at the total number of times an element has the chance to form a better coalition than its singleton. Since a lot of the information from the matrix of an element is therefore redundant,
LPScores()
discards much of it to save space. The first value then corresponds to the equivalence class index that the singleton appears in, each subsequent value the number of times it is able to form coalitions of size 2, 3, and so on.Lp*
Only taking the sum of all coalitions of a certain size might not be informative enough. Similarly to how L(1) builds a more granual comparison between two elements by incorporating the coalition size, Lp* can be seen as a more granual version of the Lp by incorporating the specific equivalence class the element appears in.
(Lp* solution [11]) For i, j ∈ N, the social ranking solution Lp* ranks i above j if one of the following conditions hold:
The score matrices of
LPSScores()
look similar toL1Scores()
then, the only difference being the number of columns; as any equivalence class with {i} ∈ Σk and Σk ≻ Σl does not influence the final ranking, these columns are discarded in the final matrix.