def random_discrete_dp(num_states, num_actions, beta=None, k=None, scale=1, sparse=False, sa_pair=False, random_state=None):
 if sparse:
  sa_pair = True
 L = (num_states * num_actions)
 random_state = check_random_state(random_state)
 R = (scale * random_state.randn(L))
 Q = _random_stochastic_matrix(L, num_states, k=k, sparse=sparse, format='csr', random_state=random_state)
 if (beta is None):
  beta = random_state.random_sample()
 if sa_pair:
  (s_indices, a_indices) = sa_indices(num_states, num_actions)
 else:
  (s_indices, a_indices) = (None, None)
  R.shape = (num_states, num_actions)
  Q.shape = (num_states, num_actions, num_states)
 ddp = DiscreteDP(R, Q, beta, s_indices, a_indices)
 return ddp

def random_discrete_dp ( num_states , num_actions , beta = None , k = None , scale = 1 , sparse = False , sa_pair = False , random_state = None ) : if sparse : sa_pair = True L = ( num_states * num_actions ) random_state = check_random_state ( random_state ) R = ( scale * random_state . randn ( L ) ) Q = _random_stochastic_matrix ( L , num_states , k = k , sparse = sparse , format = 'csr' , random_state = random_state ) if ( beta is None ) : beta = random_state . random_sample ( ) if sa_pair : ( s_indices , a_indices ) = sa_indices ( num_states , num_actions ) else : ( s_indices , a_indices ) = ( None , None ) R . shape = ( num_states , num_actions ) Q . shape = ( num_states , num_actions , num_states ) ddp = DiscreteDP ( R , Q , beta , s_indices , a_indices ) return ddp
generate a discretedp randomly .