Skip to content

Commit

Permalink
Update gt.py
Browse files Browse the repository at this point in the history
  • Loading branch information
antoine-jacquet committed Jan 9, 2024
1 parent 028b0dc commit fe250fa
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions mec/gt.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,17 @@ def __init__(self, A_i_j, B_i_j):
def zero_sum_solve(self, verbose=0):
return Matrix_game(self.A_i_j).solve(verbose)

def is_solution(self, p_i, q_j, tol=1e-5):
for i in range(self.nbi):
if np.eye(self.nbi)[i] @ self.A_i_j @ q_j > p_i @ self.A_i_j @ q_j + tol:
print('Pure strategy', i, 'beats p_i.')
return False
for j in range(self.nbj):
if p_i @ self.B_i_j @ np.eye(self.nbj)[j] > p_i @ self.B_i_j @ q_j + tol:
print('Pure strategy', j, 'beats q_j.')
return False
return True

def mangasarian_stone_solve(self, verbose=0):
model=grb.Model()
model.Params.OutputFlag = 0
Expand Down

0 comments on commit fe250fa

Please sign in to comment.