The package “locationgamer” identifies Nash Equilibrium locations in connected and disconnected networks. When using the package, the user only has to provide a matrix specifying which vertexes are connected, the x-y-coordinates of each vertex in the network, and a vector specifying demand/ revenue at each vertex.
The following sections discuss how a location game is defined in the context of this package, how one can identify a Nash Equilibrium location, and what the limitations of the current version are.
I define a location game as the following scenario in the context of this package:
Before one can answer the question whether a location is a Nash Equilibrium location, one has to find the shortest path through a network. The shortest path is necessary to answer whether a customer goes to one service station or the other.
To find the shortest path, this package implements Dijkstra’s algorithm. To showcase the applicability of the package, we first create a network consisting of six nodes, which are distributed over the x-y-plane. The edges highlighted in red constitute the shortest path between vertex one and vertex six.
nNodes <- 6 xMin <- 0 xMax <- 100 yMin <- 0 yMax <- 100 coordMatrix <- matrix(c(0,10,3,20,10,90,80,30,50,100,40,75), nrow = nNodes, ncol =2, byrow = TRUE) edgeMatrix <- matrix(0, ncol = nNodes, nrow = nNodes) edgeMatrix[,1] <- c(0,1,0,1,0,0) edgeMatrix[,2] <- c(1,0,1,0,1,0) edgeMatrix[,3] <- c(0,1,0,0,0,0) edgeMatrix[,4] <- c(1,0,0,0,1,0) edgeMatrix[,5] <- c(0,1,0,1,0,1) edgeMatrix[,6] <- c(0,0,0,0,1,0) locationgamer::plotNetwork(edgeMatrix, coordMatrix) startNode <- 1 endNode <- 6 dijkstraResult <- locationgamer::dijkstra(edgeMatrix, coordMatrix, startNode, endNode, nNodes) locationgamer::plotDijkstra(edgeMatrix, coordMatrix, dijkstraResult[])
Once the network is specified by its edges and vertex locations, one has to specify the demand/ revenue that can be generated in each location. Using the network above, we need to specify a vector of length six. For example, one can assume that demand at vertex 1 is 100, 300 at vertex 2, 50 at vertex 3, 400 at vertex 4, 200 at vertex 5, and 350 at vertex 6.
The function “lgsolve” then first determines the distance between all vertexes of the network, and iterates over all possible locations the two competitors can choose. It then divides the demand between the two competitors in the following way:
Each competitor then determines the location with the best demand/ payoff contingent on the other party’s choice, without actually observing the choice. If the choice of a particular location overlaps, it is a Nash Equilibrium location, which means that no party stands to gain from deviating from this location.
locationgamer::lgsolve(edgeMatrix, coordMatrix, 2, demandLoc) #> $`Equilibrium Locations` #> [,1] [,2] [,3] [,4] [,5] [,6] #> [1,] 0 0 0 0 0 0 #> [2,] 0 0 0 0 0 0 #> [3,] 0 0 0 0 0 0 #> [4,] 0 0 0 0 0 0 #> [5,] 0 0 0 0 1 0 #> [6,] 0 0 0 0 0 0 #> #> $`Equilibrium Summary` #> Location_P1 Location_P2 Payoff_P1 Payoff_P2 #> [1,] 5 5 700 700
The function “lgsolve” then outputs all possible Nash Equilibrium locations, including the payoffs for the two competitors.
The current limitations of this version of “locationgamer” are the following:
These limitations will be addressed in future releases of the package.