@@ -62,22 +62,19 @@ def support_enumeration_gen(g):
62
62
raise TypeError ('input must be a 2-player NormalFormGame' )
63
63
if N != 2 :
64
64
raise NotImplementedError ('Implemented only for 2-player games' )
65
- return _support_enumeration_gen (g .players [0 ].payoff_array ,
66
- g .players [1 ].payoff_array )
65
+ return _support_enumeration_gen (g .payoff_arrays )
67
66
68
67
69
68
@jit (nopython = True ) # cache=True raises _pickle.PicklingError
70
- def _support_enumeration_gen (payoff_matrix0 , payoff_matrix1 ):
69
+ def _support_enumeration_gen (payoff_matrices ):
71
70
"""
72
71
Main body of `support_enumeration_gen`.
73
72
74
73
Parameters
75
74
----------
76
- payoff_matrix0 : ndarray(float, ndim=2)
77
- Payoff matrix for player 0, of shape (m, n)
78
-
79
- payoff_matrix1 : ndarray(float, ndim=2)
80
- Payoff matrix for player 1, of shape (n, m)
75
+ payoff_matrices : tuple(ndarray(float, ndim=2))
76
+ Tuple of payoff matrices, of shapes (m, n) and (n, m),
77
+ respectively.
81
78
82
79
Yields
83
80
------
@@ -86,7 +83,7 @@ def _support_enumeration_gen(payoff_matrix0, payoff_matrix1):
86
83
respectively.
87
84
88
85
"""
89
- nums_actions = payoff_matrix0 . shape [0 ], payoff_matrix1 .shape [ 0 ]
86
+ nums_actions = payoff_matrices [0 ].shape
90
87
n_min = min (nums_actions )
91
88
92
89
for k in range (1 , n_min + 1 ):
@@ -97,10 +94,12 @@ def _support_enumeration_gen(payoff_matrix0, payoff_matrix1):
97
94
while supps [0 ][- 1 ] < nums_actions [0 ]:
98
95
supps [1 ][:] = np .arange (k )
99
96
while supps [1 ][- 1 ] < nums_actions [1 ]:
100
- if _indiff_mixed_action (payoff_matrix0 , supps [0 ], supps [1 ],
101
- A , actions [1 ]):
102
- if _indiff_mixed_action (payoff_matrix1 , supps [1 ], supps [0 ],
103
- A , actions [0 ]):
97
+ if _indiff_mixed_action (
98
+ payoff_matrices [0 ], supps [0 ], supps [1 ], A , actions [1 ]
99
+ ):
100
+ if _indiff_mixed_action (
101
+ payoff_matrices [1 ], supps [1 ], supps [0 ], A , actions [0 ]
102
+ ):
104
103
out = (np .zeros (nums_actions [0 ]),
105
104
np .zeros (nums_actions [1 ]))
106
105
for p , (supp , action ) in enumerate (zip (supps ,
@@ -139,7 +138,7 @@ def _indiff_mixed_action(payoff_matrix, own_supp, opp_supp, A, out):
139
138
140
139
out : ndarray(float, ndim=1)
141
140
Array of length k+1 to store the k nonzero values of the desired
142
- mixed action in `out[:-1]` (and the payoff value in `out[-1]`.)
141
+ mixed action in `out[:-1]` (and the payoff value in `out[-1]`).
143
142
144
143
Returns
145
144
-------
0 commit comments