Description Usage Arguments Value Examples

Function finds the equilibrium locations of a location game, similar to a hotelling game. Clients choose the location closest to them.

1 | ```
lgsolve(edgeMatrix, coordMatrix, nPlayers = 2, demandLoc)
``` |

`edgeMatrix` |
A square matrix consisting of zeros and ones. Has to be zero on the diagonals |

`coordMatrix` |
A data frame containing the x and y coordinates of each network vertex |

`nPlayers` |
Number of players in the location game. Default is set to 2, which is the only number of players supported right now. |

`demandLoc` |
A vector containing the demand or profit at each vertex of the network |

A list with two components. A matrix with zeros and ones, where a one symbolizes a equilibrium location. The row index denotes the location of player 1, and the column index the location chosen by player 2. The second entry is a summary of all equilibrium locations and the payoffs for player 1 and 2.

1 2 3 4 5 6 7 8 9 10 | ```
edgeMatrix <- matrix(0, nrow = 6, ncol = 6)
edgeMatrix[,1] <- c(0,1,0,0,0,0)
edgeMatrix[,2] <- c(1,0,1,0,1,0)
edgeMatrix[,3] <- c(0,1,0,0,0,0)
edgeMatrix[,4] <- c(0,0,0,0,1,0)
edgeMatrix[,5] <- c(0,1,0,1,0,1)
edgeMatrix[,6] <- c(0,0,0,0,1,0)
coordMatrix <- matrix(c(0,3,0,2,0,1,1,3,1,2,1,1), nrow = 6, ncol = 2, byrow = TRUE)
demandLoc <- c(100, 100, 100, 100, 100, 100)
lgsolve(edgeMatrix, coordMatrix, 2, demandLoc)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.