n <- 3
v <- c(1, 5, 10, 7, 11, 15, 16) # introduced in lexicographic order
coalitionsvector<-character()
dividendsvector<-numeric()
for (i in 1:(2^n-1)){
coalitionsvector <- c(coalitionsvector,
paste(getcoalition(i)[getcoalition(i) != 0],collapse = " "))
dividendsvector <- c(dividendsvector,
harsanyidividend(v, codelex2bin(n,i), binary = FALSE))
}
data.frame(Coalition = coalitionsvector, Dividend = dividendsvector)
data.frame(Coalition = bin2lex(coalitionsvector), Dividend = bin2lex(dividendsvector))
Run the code above in your browser using DataLab