Ejemplo n.º 1
0
def get_initial_state(seed):
    with temp_seed(np.abs(seed) % (2**32)):
        state = np.random.rand(nimc.Theta.shape[0])\
          * (nimc.Theta[:,1] - nimc.Theta[:,0])\
          + nimc.Theta[:,0]
    state = state.tolist()
    return state
Ejemplo n.º 2
0
def random_initialization(seed, initial_states=None):
    if initial_states is not None:
        state = initial_states
    else:
        with temp_seed(np.abs(seed) % (2**32)):
            state = np.random.rand(model.Theta.shape[0])\
              * (model.Theta[:,1] - model.Theta[:,0])\
              + model.Theta[:,0]
        state = state.tolist()
    t = 0.
    print('seed = '+str(seed)+', '+'state = '+str(state))
    is_unsafe = model.is_unsafe(state)
    is_unsafe = 1. if is_unsafe else 0.
    return state + [t, is_unsafe]