Learn R Programming

TUGLab (version 0.0.1)

codelex2bin: Lexicographic order position to binary order position

Description

Given the lexicographic order position of a coalition, this function returns the corresponding binary order position.

Usage

codelex2bin(n, Nlex)

Value

The corresponding binary order position, as an integer between 1 and \(2^{\code{n}}-1\).

Arguments

n

Number of players.

Nlex

A lexicographic order position, as an integer between 1 and \(2^{\code{n}}-1\).

Details

Lexicographic order arranges coalitions in ascending order according to size, and applies lexicographic order to break ties among coalitions of the same size. The binary order position of a coalition \(S\in 2^N\) is given by \(\sum_{i\in S} 2^{i-1}\).

See Also

bin2lex, codebin2lex, lex2bin

Examples

Run this code
codelex2bin(5, 4)

Run the code above in your browser using DataLab