Learn R Programming

InventorymodelPackage (version 1.0.2)

characteristicfunction: Characteristicfunction

Description

Characteristic function of a game.

Usage

characteristicfunction(n, game)

Arguments

n
Number of players
game
Matrix of two columns. The first column contains the coalitions. The second one, the values for each coalition.

Value

This function gives a matrix. The first n columns indicate a binary representation of the coalitions in a binary mode. The second one, the usual way. The last column gives the characteristic function.

Examples

Run this code
characteristicfunction(3,game=cbind(c(1,2,3,12,13,23,123),c(1,1,1,1,2,1,2)))

#  1 2 3 Coalition Cost
#  0 0 0         0    0
#  1 0 0         1    1
#  0 1 0         2    1
#  0 0 1         3    1
#  1 1 0        12    1
#  1 0 1        13    2
#  0 1 1        23    1
#  1 1 1       123    2

Run the code above in your browser using DataLab