def greedyQPolicy(Qs):
 dim = len(Qs)
 numA = len(Qs[0])
 policy = zeros((dim, numA))
 for si in range(dim):
  actions = all_argmax(Qs[si])
  for a in actions:
   policy[(si, a)] = (1.0 / len(actions))
 return policy

def greedyQPolicy ( Qs ) : dim = len ( Qs ) numA = len ( Qs [ 0 ] ) policy = zeros ( ( dim , numA ) ) for si in range ( dim ) : actions = all_argmax ( Qs [ si ] ) for a in actions : policy [ ( si , a ) ] = ( 1.0 / len ( actions ) ) return policy
find the greedy deterministic policy .