Conversation
|
Rebased with #264. |
|
Numba 0.26.0 versus 0.28.1 A = np.eye(n)
g = NormalFormGame(A)
%timeit support_enumeration(g)
|
|
Identity matrix was not a good test case. bimatrix = np.random.rand(n, n, 2)
g = NormalFormGame(bimatrix)
%timeit support_enumeration(g)
|
|
Just noticed that Anaconda 4.2.0 had already been released (changelog) which includes Numba 0.28.1. What is our policy regarding the versions of dependent libraries? |
Need Numba >= 0.28 to run
Should be removed once Anaconda is updated to include Naumba >= 0.28
|
Rebased on |
|
@oyamad. Good question. I think our main policy is to try and keep up with the latest |
|
I can revert the commit "Add fallback for Numba < 0.28" to target the version of Numba included in the latest Anaconda. Or we could leave it for a future PR. |
|
@oyamad No need to revert. |
|
Good idea. I am going to add a warning message. |
|
Great - Thanks |
|
Let me not add a warning this time, as the situation is complicated now. |
|
@oyamad Ok -- I see the re: |
|
Sorry, my last comment was misleading. I corrected it (bottom line: please merge this PR whenever you are ready). Thanks. |
|
Ah I see. Thanks @oyamad. Will merge this into master. |
Implement "support enumeration", a simple and inefficient algorithm that computes all mixed-action Nash equilibria of a non-degenerate 2-player game.
Jit-compiled if Numba >= 0.28 is installed. Fallback to a non-jit version otherwise.
The algorithm is to check for all the size-k support pairs for k = 1, ..., min(m, n) whether there is a Nash equilibrium with the given support by solving a linear equation of the indifference conditions, where m and n are the numbers of actions of players 0 and 1, respectively. Note that if m = n, there are (2n choose n - 1) such pairs (for example, 184,755 pairs if n = 10).
In solving the linear equation in
_indiff_mixed_action, I could have done likebut Numba does not support
try-except, so singularity is explicitly checked by singular values inis_singular, where SVD is only supported by Numba 0.28.An algorithm is needed to enumerate all supports from the given action set, preferably from small to large ones.
next_k_arrayconverts the given array of k elements into the integer with the corresponding k set bits in binary representation, and gets the next integer with k bits computed by "Gosper's hack" innext_k_combination(copy-pasted from Wikipedia), and then converts it back to the corresponding k-array. I am not sure if this is the most efficient.