print("Started learning") rewards = [] time_learned = [] n_episode = 100 time_per_n_episode = datetime.now() total_cleared = 0 for i_episode in range(NUM_EPISODES): stepcount = 0 state = env.reset() done = False current_rewards = 0 current_time_learned = [] while not done: action = agent.choose_action(state, i_episode, train=True) next_state, reward, done, info = env.step(action) if reward == 1: total_cleared += 1 agent.store_transition(state, action, reward, next_state, done) state = next_state time_start = datetime.now() agent.learn(BATCH_SIZE, i_episode) time_difference = datetime.now() - time_start current_time_learned.append(time_difference.total_seconds()) stepcount += 1 current_rewards += reward if stepcount % 10000 == 0:
print("Started learning") rewards = [] time_learned = [] n_episode = 100 time_per_n_episode = datetime.now() for i_episode in range(NUM_EPISODES): stepcount = 0 state = env.reset() state_d = downsample(state) done = False current_rewards = 0 current_time_learned = [] while not done: action = agent.choose_action(state_d, i_episode, train=True) next_state, reward, done, info = env.step(action) next_state_d = downsample(next_state) agent.store_transition(state_d, action, reward, next_state_d, done) state_d = next_state_d time_start = datetime.now() agent.learn(BATCH_SIZE, i_episode) time_difference = datetime.now() - time_start current_time_learned.append(time_difference.total_seconds()) stepcount += 1 current_rewards += reward