Calculate the Lexicographical Excellence (or Lexcel) score.

`lexcelRanking()`

returns the corresponding ranking.

`dualLexcelRanking()`

uses the same score vectors but instead of rewarding
participation, it punishes mediocrity.

## Usage

```
lexcelScores(powerRelation, elements = powerRelation$elements)
lexcelRanking(powerRelation)
dualLexcelRanking(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 a list of type `LexcelScores`

and length of `powerRelation$elements`

(unless parameter `elements`

is specified).
Each index contains a vector of length `powerRelation$eqs`

, the number of
times the given element appears in each equivalence class.

Ranking function returns corresponding `SocialRanking`

object.

## Details

An equivalence class \(\sum_i\) contains coalitions that are indifferent to one another.
In a given power relation created with `PowerRelation()`

or `as.PowerRelation()`

, the equivalence classes are saved in `$eqs`

.

As an example, consider the power relation \(\succsim: 123 \succ (12 \sim 13 \sim 1 \sim \emptyset) \succ (23 \sim 1 \sim 2)\). The corresponding equivalence classes are:

$$ \sum_1 = \lbrace 123 \rbrace, \sum_2 = \lbrace 12, 13, 1, \emptyset \rbrace, \sum_3 = \lbrace 23, 1, 2 \rbrace. $$

The lexcel score of an element is a vector wherein each index indicates the number of times that element appears in the equivalence class. From our example, we would get

$$\textrm{lexcel}(1) = [ 1, 3, 1 ], \textrm{lexcel}(2) = [ 1, 1, 2 ], \textrm{lexcel}(3) = [ 1, 1, 1 ].$$

## Lexcel Ranking

The most "excellent contribution" of an element determines its ranking against the other elements. Given two Lexcel score vectors \(\textrm{Score}(i)\) and \(\textrm{Score}(j)\), the first index \(x\) where \(\textrm{Score}(i)_x \neq \textrm{Score}(j)_x\) determines which element should be ranked higher.

From the previous example this would be \(1 > 2 > 3\), because:

\(\textrm{Score}(1)_2 = 3 > \textrm{Score}(2)_2 = \textrm{Score}(3)_2 = 1\), \(\textrm{Score}(2)_3 = 2 > \textrm{Score}(3)_3 = 1\).

## Dual Lexcel Ranking

The dual lexcel works in reverse order and, instead of rewarding high scores, punishes mediocrity. In that case we get \(3 > 1 > 2\) because:

\(\textrm{Score}(3)_3 < \textrm{Score}(2)_3\) and \(\textrm{Score}(3)_2 < \textrm{Score}(1)_2\), \(\textrm{Score}(1)_3 < \textrm{Score}(2)_3\).

## References

Bernardi G, Lucchetti R, Moretti S (2019).
“Ranking objects from a preference relation over their subsets.”
*Social Choice and Welfare*, **52**(4), 589--606.

Algaba E, Moretti S, Rémila E, Solal P (2021).
“Lexicographic solutions for coalitional rankings.”
*Social Choice and Welfare*, **57**(4), 1--33.

Serramia M, López-Sánchez M, Moretti S, Rodríguez-Aguilar JA (2021).
“On the dominant set selection problem and its application to value alignment.”
*Autonomous Agents and Multi-Agent Systems*, **35**(2), 1--38.

## See also

Other ranking solution functions:
`L1Scores()`

,
`L2Scores()`

,
`LPSScores()`

,
`LPScores()`

,
`copelandScores()`

,
`cumulativeScores()`

,
`kramerSimpsonScores()`

,
`ordinalBanzhafScores()`

## Examples

```
# note that the coalition {1} appears twice
# 123 > 12 ~ 13 ~ 1 ~ {} > 23 ~ 1 ~ 2
# E = {123} > {12, 13, 1, {}} > {23, 1, 2}
pr <- suppressWarnings(as.PowerRelation(
"123 > (12 ~ 13 ~ 1 ~ {}) > (23 ~ 1 ~ 2)"
))
# lexcel scores for all elements
# `1` = c(1, 3, 1)
# `2` = c(1, 1, 2)
# `3` = c(1, 1, 1)
lexcelScores(pr)
#> $`1`
#> [1] 1 3 1
#>
#> $`2`
#> [1] 1 1 2
#>
#> $`3`
#> [1] 1 1 1
#>
#> attr(,"class")
#> [1] "LexcelScores"
# lexcel scores for a subset of all elements
lexcelScores(pr, c(1, 3))
#> $`1`
#> [1] 1 3 1
#>
#> $`3`
#> [1] 1 1 1
#>
#> attr(,"class")
#> [1] "LexcelScores"
lexcelScores(pr, 2)
#> $`2`
#> [1] 1 1 2
#>
#> attr(,"class")
#> [1] "LexcelScores"
# 1 > 2 > 3
lexcelRanking(pr)
#> 1 > 2 > 3
# 3 > 1 > 2
dualLexcelRanking(pr)
#> 3 > 1 > 2
```