Package 'GameTheoryAllocation'

Title: Tools for Calculating Allocations in Game Theory
Description: Many situations can be modeled as game theoretic situations. Some procedures are included in this package to calculate the most important allocations rules in Game Theory: Shapley value, Owen value or nucleolus, among other. First, we must define as an argument the value of the unions of the envolved agents with the characteristic function.
Authors: Alejandro Saavedra-Nieves
Maintainer: Alejandro Saavedra-Nieves <[email protected]>
License: GPL-2
Version: 1.0
Built: 2024-11-20 06:50:23 UTC
Source: CRAN

Help Index


Tools for Calculating Allocations in Game Theory

Description

Many situations can be modeled as game theoretic situations. Some procedures are included in this package to calculate the most important allocations rules in Game Theory: Shapley value, Owen value or nucleolus, among other. First, we must define as an argument the value of the unions of the envolved agents with the characteristic function.

Author(s)

A. Saavedra-Nieves

Maintainer: A. Saavedra-Nieves ([email protected])

References

Frisk, M., Gothe-Lundgren, M.,Jornsten, K., Ronnqvist, M. (2010). Cost allocation in collaborative forest transportation. European Journal of Operational Research, Vol. 205, pp. 448-458.

Gillies, D.B. (1953). Some theorems on n-person games. PhD thesis, Princeton University.

Owen, G. (1977). Values of games with a priori unions. Mathematical Economics and Game Theory: Essays in Honor of Oskar Morgenstern (Eds.: O. Moeschlin R. Hein). Springer, New York.

Shapley, L.S. (1953). A value por n-person games. In H. Kuhn y A. Tucker (eds), Contributions to the theory of games II, Vol. 28, Annals of Mathematics Studies. Princeton University Press.

Schmeidler, D. (1969). The nucleolus of a characteristic function game, SIAM Journal of Applied Mathematics, vol. 17, pp. 1163-1170.

Examples

# Example 1

characteristic_function<-c(0,0.538, 0.761, 1.742, 0.554, 0.137, 0.293, 0.343)
isinthecore(characteristic_function,allocation=c(0.1,0.2,0.043),game="cost")
#[1] "The allocation is not in the core"
#NULL

isinthecore(characteristic_function,allocation=c(0.05,0.206,0.087),game="cost")
#[1] "The allocation is in the core"
#NULL

nucleolus(characteristic_function,game="cost")
#[1] "Nucleolus"
#      1     2 3
#  0.137 0.206 0
# Example 2

characteristic_function<-c(1,1,2,1,2,2,2)
Owen_value(characteristic_function,union=list(c(1,2),c(3)),game="cost")
#[1] "Owen Value"
#     1    2   3
#  0.25 0.25 1.5

coalitions

Description

This function gives all the coalitions in a binary mode and usual way.

Usage

coalitions(n)

Arguments

n

Number of the involved players

Value

A list with the following components:

Binary

A matrix where each row indicates a binary representation of the coalition in a binary mode. The second one, the usual way.

Classic

A vector with the associated representation of the coalitions.

Author(s)

A. Saavedra-Nieves

Examples

coalitions(3)
#$Binary
#     [,1] [,2] [,3]
#[1,]    0    0    0
#[2,]    1    0    0
#[3,]    0    1    0
#[4,]    0    0    1
#[5,]    1    1    0
#[6,]    1    0    1
#[7,]    0    1    1
#[8,]    1    1    1
#
#$Classic
#[1] "0"           "'{ 1 }'"     "'{ 2 }'"     "'{ 3 }'"     "'{ 1,2 }'"  
#[6] "'{ 1,3 }'"   "'{ 2,3 }'"   "'{ 1,2,3 }'

Equal Profit Method allocation

Description

This function gives the Equal Profit Method allocation described in Frisk et al. (2010).

Usage

EPM_allocation(characteristic_function, r = NA, info = NA, game = c("profit", "cost"))

Arguments

characteristic_function

A vector with the characteristic function v(S)v(S) (or c(S)c(S), if we work with a cost game), according to the order of coalitions shown in coalitions function.

r

Incremental step for calculating the EPM-allocation. If no solution is found, we increase iteratively in r units the allowed excess to get an epsilon-core allocation. Procedure stops when a solution is found.

info

For knowing information about the resolution, make info=1

game

Characters to indicate if the game is a cost or profit game. The possibles values are "cost" or "profit".

Value

A vector with the allocation that EPM method proposes.

Author(s)

A. Saavedra-Nieves

References

Frisk, M., Gothe-Lundgren, M.,Jornsten, K., Ronnqvist, M. (2010). Cost allocation in collaborative forest transportation. European Journal of Operational Research, Vol. 205, pp. 448-458.

Examples

characteristic_function<-c(0,0.538, 0.761, 1.742, 0.554, 0.137, 0.293, 0.343)
EPM_allocation(characteristic_function,r=0.01,info=1,game="cost")
#[1] "EPM_allocation"
#[1] "The cost game has a non-empty core"
#     1     2     3
#  0.05 0.206 0.087

Isinthecore (core allocations)

Description

This function checks if the allocation belongs to the core of the TU game.

Usage

isinthecore(characteristic_function, allocation, game = c("profit", "cost"))

Arguments

characteristic_function

A vector with the characteristic function v(S)v(S) (or c(S)c(S), if we work with a cost game), according to the order of coalitions shown in coalitions function.

allocation

A vector with the allocation where each component indicates the part of each agent.

game

Characters to indicate if the game is a cost or profit game. The possibles values are "cost" or "profit".

Author(s)

A. Saavedra-Nieves

References

Gillies, D.B. (1953). Some theorems on n-person games. PhD thesis, Princeton University.

Examples

characteristic_function<-c(0,0.538, 0.761, 1.742, 0.554, 0.137, 0.293, 0.343)
isinthecore(characteristic_function,allocation=c(0.1,0.2,0.043),game="cost")
#[1] "The allocation is not in the core"
#NULL

isinthecore(characteristic_function,allocation=c(0.05,0.206,0.087),game="cost")
#[1] "The allocation is in the core"
#NULL

Nucleolus

Description

This function gives the nucleolus described in Schmeidler (1969).

Usage

nucleolus(characteristic_function, game = c("profit", "cost"))

Arguments

characteristic_function

A vector with the characteristic function v(S)v(S) (or c(S)c(S), if we work with a cost game), according to the order of coalitions shown in coalitions function.

game

Characters to indicate if the game is a cost or profit game. The possibles values are "cost" or "profit".

Value

A vector with the allocation that nucleolus proposes.

Author(s)

A. Saavedra-Nieves

References

Schmeidler, D. (1969). The nucleolus of a characteristic function game, SIAM Journal of Applied Mathematics, vol. 17, pp. 1163-1170.

Examples

characteristic_function<-c(0,0.538, 0.761, 1.742, 0.554, 0.137, 0.293, 0.343)
nucleolus(characteristic_function,game="cost")
#[1] "Nucleolus"
#      1     2 3
#  0.137 0.206 0

Owen_value (Owen value)

Description

This function gives the Owen value described in Owen (1977).

Usage

Owen_value(characteristic_function, union, game = c("profit", "cost"))

Arguments

characteristic_function

A vector with the characteristic function v(S)v(S) (or c(S)c(S), if we work with a cost game), according to the order of coalitions shown in coalitions function.

union

A list with a partition of the players set. Each element of this list is a union a priori, following the proposal of Owen.

game

Characters to indicate if the game is a cost or profit game. The possibles values are "cost" or "profit".

Value

A vector with the allocation that Owen value (Owen, 1977) proposes.

Author(s)

A. Saavedra-Nieves

References

Owen, G. (1977). Values of games with a priori unions. Mathematical Economics and Game Theory: Essays in Honor of Oskar Morgenstern (Eds.: O. Moeschlin R. Hein). Springer, New York.

Examples

characteristic_function<-c(1,1,2,1,2,2,2)
Owen_value(characteristic_function,union=list(c(1,2),c(3)),game="cost")
#[1] "Owen Value"
#     1    2   3
#  0.25 0.25 1.5

Shapley_value(characteristic_function,game="cost")
#[1] "Shapley Value"
#          1         2        3
#  0.3333333 0.3333333 1.333333

Shapley_value (Shapley Value)

Description

This function gives the Shapley value introduced in Shapley (1953).

Usage

Shapley_value(characteristic_function, game = c("profit", "cost"))

Arguments

characteristic_function

A vector with the characteristic function v(S)v(S) (or c(S)c(S), if we work with a cost game), according to the order of coalitions shown in coalitions function.

game

Characters to indicate if the game is a cost or profit game. The possibles values are "cost" or "profit".

Value

A vector with the allocation that Shapley value (Shapley, 1953) proposes.

Author(s)

A. Saavedra-Nieves

References

Shapley, L.S. (1953). A value por n-person games. In H. Kuhn y A. Tucker (eds), Contributions to the theory of games II, Vol. 28, Annals of Mathematics Studies. Princeton University Press.

Examples

characteristic_function<-c(1,1,2,1,2,2,2)
 
Shapley_value(characteristic_function,game="cost")
#[1] "Shapley Value"
#          1         2        3
#  0.3333333 0.3333333 1.333333