Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/amirreza81/equilibrium-game-theory
Correlated Equilibrium and Mixed Nash Equilibrium with python
https://github.com/amirreza81/equilibrium-game-theory
algorithmic-game-theory correlated-equilibrium game-theory game-theory-algorithms linear-programming lp mixed-nash-equilibrium nash-equilibrium python
Last synced: about 1 month ago
JSON representation
Correlated Equilibrium and Mixed Nash Equilibrium with python
- Host: GitHub
- URL: https://github.com/amirreza81/equilibrium-game-theory
- Owner: Amirreza81
- Created: 2024-04-18T07:41:10.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-09-17T15:10:06.000Z (3 months ago)
- Last Synced: 2024-09-17T19:01:33.439Z (3 months ago)
- Topics: algorithmic-game-theory, correlated-equilibrium, game-theory, game-theory-algorithms, linear-programming, lp, mixed-nash-equilibrium, nash-equilibrium, python
- Language: Python
- Homepage:
- Size: 329 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Equilibrium Game Theory
### Game Theory - Sharif University of Technology (CE-456)
Correlated Equilibrium and Mixed Nash Equilibrium with python
## Mixed Nash Equilibrium
You can see the statements of this question [here](https://github.com/Amirreza81/Equilibrium-Game-Theory/blob/main/Mixed-Nash-Equilibrium/Nash_Equilibrium.pdf).
I tried to find the mixed nash equilibrium with simplex algorithm.
I applied two different kind of LP for this question.
> [First Version](https://github.com/Amirreza81/Equilibrium-Game-Theory/blob/main/Mixed-Nash-Equilibrium/Nash_Equilibrium_v1.py)
> [Second Version](https://github.com/Amirreza81/Equilibrium-Game-Theory/blob/main/Mixed-Nash-Equilibrium/Mixed-Nash-Equilibrium.py)Second one is an easier implementation using M + N variables. You can see more details [here](https://github.com/Amirreza81/Equilibrium-Game-Theory/blob/main/Mixed-Nash-Equilibrium/LP.png).
### An example:
**Input:**
```
3 2
8 -5
-3 4
-5 -4
8 9
1 -2
8 5
```**Output:**
```
0.750000 0.250000 0.000000
0.450000 0.550000
```Suppose two players wants to play a game. In this example, player 1 has 3 actions and player2 has 2 actions. After N lines we get
the utilities of player1 and after N lines we get utilities of player2. The table of utilities is equal to:```
(8, 8) | (-5, 9)
-----------------
(-3, 1) | (4, -2)
-----------------
(-5, 8) | (-4, 5)
```The *mixed nash eqilibrium* here shows the strategy of each player:
```
player1 -> (0.75, 0.25, 0)
player2 -> (0.45, 0.55)
```## Correlated Equilibrium
You can see the statements of this question [here](https://github.com/Amirreza81/Equilibrium-Game-Theory/blob/main/Correlated%20Equilibrium/Correlated_Equilibrium.pdf).
I tried to find the correlated equilibrium with simplex algorithm.
For finding correlated equilibrium, you should check this constraint and with solving the LP, you will find the answer.
```math
\sum_{{\bar{s}}\; \in \; S_{-p}} u_{i, {\bar{s}}}^p \; x_{i,\; {\bar{s}}} \geq \sum_{{\bar{s}}\; \in \; S_{-p}} u_{j,\; {\bar{s}}}^p \; x_{i,\; {\bar{s}}},\;\; \forall \; p \; and \; \forall \; i,j\; \in S_{p}
```### An example:
**Input:**
```
1 1
3 3
6 6 -2 0 0 7
2 2 2 2 0 0
0 0 0 0 3 3
```**Output:**
```
8.000000
0.500000 0.000000 0.000000
0.250000 0.250000 0.000000
0.000000 0.000000 0.000000
```Suppose two players want to play a game. In this example, player 1 has 3 actions and player2 has 3 actions. We should find the probability of playing each strategy profile and maximum optimal social benefit. For this example, the table of utilities is:
```
(6, 6) | (-2, 0) | (0, 7)
--------------------------
(2, 2) | (2, 2) | (0, 0)
--------------------------
(0, 0) | (0, 0) | (3, 3)
```After solving LP, for finding maximum optimal social benefit we have:
```
0.5 * (6 + 6) + 0.25 * (2 + 2) + 0.25 * (2 + 2) = 8
```For more questions or any problem, feel free to contact [me]([email protected]).