Advertisement
Guest User

Untitled

a guest
Nov 13th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 KB | None | 0 0
  1. def amopt_brute(eAp, eAn, eBp, eBn):
  2.     AMstrats = list()
  3.     uAMs = list()
  4.     BRs = list()
  5.     uMs = list()
  6.     ##### needs 4 for loop #################, 0.05 increment
  7.     for sA1 in np.arange(0, 1.05, 0.05):
  8.         for sB1 in np.arange(0, 1.05 - sA1, 0.05):
  9.             if not sA1 + sB1 <= 1:
  10.                 continue
  11.             for sA2 in np.arange(0, 1.05, 0.05):
  12.                 for sB2 in np.arange(0, 1.05 - sA2, 0.05):
  13.                     if not sA2 + sB2 <= 1:
  14.                         continue
  15.                     AMstrats.append((sA1, sB1, sA2, sB2))
  16.                     ((pA,pB), uM) = bestresponse_brute(eAp, eAn, eBp, eBn, sA1, sB1, sA2, sB2)
  17.                     uAM = compute_uAM(eAp, eBp, sA1, sB1, sA2, sB2, pA, pB)
  18.                     uAMs.append(uAM)
  19.                     BRs.append((pA,pB))
  20.                     uMs.append(uM)
  21.     maxids = list(np.where(np.array(uAMs).flatten() == max(uAMs))[0])
  22.     return (AMstrats[maxids[0]], uAMs[maxids[0]], BRs[maxids[0]], uMs[maxids[0]])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement