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 |
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.
A. Saavedra-Nieves
Maintainer: A. Saavedra-Nieves ([email protected])
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.
# 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
# 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
This function gives all the coalitions in a binary mode and usual way.
coalitions(n)
coalitions(n)
n |
Number of the involved players |
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. |
A. Saavedra-Nieves
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 }'
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 }'
This function gives the Equal Profit Method allocation described in Frisk et al. (2010).
EPM_allocation(characteristic_function, r = NA, info = NA, game = c("profit", "cost"))
EPM_allocation(characteristic_function, r = NA, info = NA, game = c("profit", "cost"))
characteristic_function |
A vector with the characteristic function |
r |
Incremental step for calculating the EPM-allocation. If no solution is found, we increase iteratively in |
info |
For knowing information about the resolution, make |
game |
Characters to indicate if the game is a cost or profit game. The possibles values are |
A vector with the allocation that EPM method proposes.
A. Saavedra-Nieves
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.
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
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
This function checks if the allocation belongs to the core of the TU game.
isinthecore(characteristic_function, allocation, game = c("profit", "cost"))
isinthecore(characteristic_function, allocation, game = c("profit", "cost"))
characteristic_function |
A vector with the characteristic 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 |
A. Saavedra-Nieves
Gillies, D.B. (1953). Some theorems on n-person games. PhD thesis, Princeton University.
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
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
This function gives the nucleolus described in Schmeidler (1969).
nucleolus(characteristic_function, game = c("profit", "cost"))
nucleolus(characteristic_function, game = c("profit", "cost"))
characteristic_function |
A vector with the characteristic function |
game |
Characters to indicate if the game is a cost or profit game. The possibles values are |
A vector with the allocation that nucleolus proposes.
A. Saavedra-Nieves
Schmeidler, D. (1969). The nucleolus of a characteristic function game, SIAM Journal of Applied Mathematics, vol. 17, pp. 1163-1170.
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
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
This function gives the Owen value described in Owen (1977).
Owen_value(characteristic_function, union, game = c("profit", "cost"))
Owen_value(characteristic_function, union, game = c("profit", "cost"))
characteristic_function |
A vector with the characteristic 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 |
A vector with the allocation that Owen value (Owen, 1977) proposes.
A. Saavedra-Nieves
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.
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
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
This function gives the Shapley value introduced in Shapley (1953).
Shapley_value(characteristic_function, game = c("profit", "cost"))
Shapley_value(characteristic_function, game = c("profit", "cost"))
characteristic_function |
A vector with the characteristic function |
game |
Characters to indicate if the game is a cost or profit game. The possibles values are |
A vector with the allocation that Shapley value (Shapley, 1953) proposes.
A. Saavedra-Nieves
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.
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
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