createBitMatrix: create bit matrix

Description Usage Arguments Value Author(s) Examples

View source: R/bitMatrix.R

Description

createBitMatrix creates a bit matrix with (numberOfPlayers+1) columns and (2^numberOfPlayers-1) rows which contains all possible coalitions (apart from the null coalition) for the set of all players. Each player is represented by a column which describes if this player is either participating (value 1) or not participating (value 0). The last column (named cVal) contains the values of each coalition. Accordingly, each row of the bit matrix expresses a coalition as a subset of all players.

Usage

1

Arguments

n

represents the number of players

A

Numeric vector of appropriate size

Value

The return is a bit matrix containing all possible coalitions apart from the empty coalition

Author(s)

Johannes Anwander anwander.johannes@gmail.com

Jochen Staudacher jochen.staudacher@hs-kempten.de

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
library(CoopGame)
createBitMatrix(3,c(0,0,0,60,60,60,72))


library(CoopGame)
A=weightedVotingGameVector(n=3,w=c(1,2,3),q=5)
bm=createBitMatrix(3,A)
bm
# Output:
#            cVal
# [1,] 1 0 0    0
# [2,] 0 1 0    0
# [3,] 0 0 1    0
# [4,] 1 1 0    0
# [5,] 1 0 1    0
# [6,] 0 1 1    1
# [7,] 1 1 1    1

CoopGame documentation built on Aug. 24, 2021, 1:07 a.m.