Calculate the Ordinal Banzhaf scores, the number of positive and the number of negative marginal contributions.

`ordinalBanzhafRanking()`

returns the corresponding ranking.

## Usage

```
ordinalBanzhafScores(powerRelation, elements = powerRelation$elements)
ordinalBanzhafRanking(powerRelation)
```

## Arguments

- powerRelation
A

`PowerRelation`

object created by`PowerRelation()`

or`as.PowerRelation()`

- elements
Vector of elements of which to calculate their scores. By default, the scores of all elements in

`powerRelation$elements`

are considered.

## Value

Score function returns list of class type `OrdinalBanzhafScores`

and length of `powerRelation$elements`

.
Each index contains a vector of three numbers, the number of positive marginal contributions, the number of negative marginal contributions, and the number of coalitions for which no comparison could be done.
The first two numbers summed together gives us the actual ordinal Banzhaf score.

Ranking function returns corresponding `SocialRanking`

object.

## Details

Inspired by the Banzhaf index (Banzhaf III 1964) , the Ordinal Banzhaf determines the score of element \(i\) by adding the amount of coalitions \(S \subseteq N \setminus \lbrace i \rbrace\) its contribution impacts positively (\(S \cup \lbrace i \rbrace \succ S\)) and subtracting the amount of coalitions where its contribution had a negative impact (\(S \succ S \cup \lbrace i \rbrace\))(Khani et al. 2019) .

The original definition only takes total power relations into account, where either \(S \succsim T\) or \(T \succsim S\)
for every \(S,T \subseteq N\).
If coalitions are missing from the power relation, we may not be able to perform certain comparisons.
To indicate these missing comparisons, the ordinal Banzhaf score of an element \(i\) also includes that number at index `3`

.
I.e., if the ordinal Banzhaf score of an element is `c(4, -2, 1)`

, it means that it contributed positively to `4`

coalitions and negatively to `2`

others.
For one coalition, no comparison could be made.

## References

Khani H, Moretti S, Öztürk M (2019).
“An ordinal banzhaf index for social ranking.”
In *28th International Joint Conference on Artificial Intelligence (IJCAI 2019)*, 378--384.

Banzhaf III JF (1964).
“Weighted voting doesn't work: A mathematical analysis.”
*Rutgers L. Rev.*, **19**, 317.

## See also

Other ranking solution functions:
`L1Scores()`

,
`L2Scores()`

,
`LPSScores()`

,
`LPScores()`

,
`copelandScores()`

,
`cumulativeScores()`

,
`kramerSimpsonScores()`

,
`lexcelScores()`

## Examples

```
pr <- as.PowerRelation("12 > (2 ~ {}) > 1")
# Player 1 contributes positively to {2}
# Player 1 contributes negatively to {empty set}
# Therefore player 1 has a score of 1 - 1 = 0
#
# Player 2 contributes positively to {1}
# Player 2 does NOT have an impact on {empty set}
# Therefore player 2 has a score of 1 - 0 = 0
ordinalBanzhafScores(pr)
#> $`1`
#> [1] 1 -1 0
#>
#> $`2`
#> [1] 1 0 0
#>
#> attr(,"class")
#> [1] "OrdinalBanzhafScores"
# `1` = c(1, -1, 0)
# `2` = c(1, 0, 0)
ordinalBanzhafRanking(pr)
#> 2 > 1
# 1 > 2
```