Does not find equilibrium although equilibria exist
Delta-Sigma opened this issue · 2 comments
Hi,
I am not sure why or in what kinds of cases this issue arises, but I seem to be getting it with the following payoff matrix.
1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 1.0 0.0 0.6666666666666666 0.0 0.6666666666666666 0.0 0.5
0.0 0.0 1.0 0.6666666666666666 0.0 0.0 0.6666666666666666 0.5
0.0 0.6666666666666666 0.6666666666666666 1.0 0.0 0.5 0.5 0.8
0.0 0.0 0.0 0.0 1.0 0.6666666666666666 0.6666666666666666 0.5
0.0 0.6666666666666666 0.0 0.5 0.6666666666666666 1.0 0.5 0.8
0.0 0.0 0.6666666666666666 0.5 0.6666666666666666 0.5 1.0 0.8
0.0 0.5 0.5 0.8 0.5 0.8 0.8 1.0
Sorry the matrix isn't well formatted, but it is the F1 scores of binary representation of row and column indexes. The following code snippet will hopefully reproduce the error.
input:
import nashpy
import numpy as np
from sklearn.metrics import f1_score
bits = 3
matrix_size = 2**bits
a = np.zeros((matrix_size,matrix_size))
p1_actions = np.array([[*map(int, bin(i)[2:].zfill(bits))] for i in range(matrix_size)])
p2_actions = np.array([[*map(int, bin(j)[2:].zfill(bits))] for j in range(matrix_size)])
for i in range(p1_actions):
for j in range(p2_actions):
a[i][j] = f1_score(p1_actions[i],p2_actions[j],zero_division=1)
g = nashpy.Game(a)
equ = list(g.support_enumeration())
print(equ)
output:
/usr/local/lib/python3.7/site-packages/nashpy/algorithms/support_enumeration.py:196: RuntimeWarning:
An even number of (0) equilibria was returned. This
indicates that the game is degenerate. Consider using another algorithm
to investigate.
warnings.warn(warning, RuntimeWarning)
[]
I have tried giving the same matrix to gambit, and using the online solver https://cgi.csc.liv.ac.uk/~rahul/bimatrix_solver/ and it seems the equilibria should exist. I have tried using the non_degenerate
parameter and increasing tol
. It doesn't seem to help.
Environment:
Mac OSX. Python 3.7.5. Nashpy 0.0.19.
Thank you for your time.
Hi thanks, it does indeed look like this game is degenerate (for example looking at the final column) which is not supported. There is some work ongoing that might allow for such games to be solved in the future see: #71
Thank you and sorry I thought I did but I didn't exactly know what degenerate meant.