# Lexicographical Excellence

`lexcelScores.Rd`

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 = NULL)
lexcelRanking(powerRelation)
dualLexcelRanking(powerRelation)
```

## Arguments

- powerRelation
A

`PowerRelation`

object created by`newPowerRelation()`

- elements
vector of elements of which to calculate their scores. If

`elements == NULL`

, create vectors for all elements in`pr$elements`

## 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$equivalenceClasses`

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

Ranking function returns corresponding `SocialRankingSolution`

object.

## Details

An equivalence class \(\sum_i\) holds all coalitions
that are indifferent from one another. In a given power relation created with
`newPowerRelation()`

, the equivalence classes are saved in `$equivalenceClasses`

.

E.g. for a power relation defined as \(123 \succ (12 \sim 13 \sim 1 \sim \emptyset) \succ (23 \sim 1 \sim 2)\) we would get the following equivalence classes:

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

A Lexcel score for an element is a vector where each index counts the number of times it appears in the equivalence class. Here 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 score vector functions:
`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(newPowerRelation(
c(1,2,3),
">", c(1,2), "~", c(1,3), "~", 1, "~", c(),
">", c(2,3), "~", 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
```