-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathpayoff_matrix.py
40 lines (27 loc) · 882 Bytes
/
payoff_matrix.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import nashpy as nash
import numpy as np
A = np.array([[165 / 100, -1],
[-1, 160 / 100]])
'''A = np.array([[185/100,-1, -1],
[-1, 125/100, -1],
[-1,-1, 280/100]])'''
'''A = np.array([[100/110,-1,-1,-1,-1],
[-1,300/100,-1,-1,-1],
[-1,-1,1300/100,-1,-1],
[-1,-1,-1,200/100,-1],
[-1,-1,-1,-1,1300/100]])'''
rps = nash.Game(A)
eqs = rps.support_enumeration()
result = list(eqs)[0][0]
print(result)
bet_amount = 100
result = bet_amount * result
result = [round(x) for x in result]
bet_amount = sum(result)
print(result)
sum_val = 0
for m in range(len(result)):
print((result[m] * A[m][m] / 100 + result[m]) <= bet_amount)
sum_val += sum(result[m] * A[m])
return_val = sum_val/len(result)
print(return_val, return_val/bet_amount)