def set_replay_buffer(self,record):
"""After get reward from environment, Agent should add new record into replay buffer.
Args:
record: dict type, has following key at least:
'reward':
'terminal':
'next_observation':
"""
new_state = self.observation2state(record['observation'])
if type(self.current_state) == dict:
raise Exception("current state type error")
self.replay_buffer.add(self.current_state, record['action'], record['reward'], new_state,
float(record['terminal']), self.current_feature, record['target_ob'])
# self.replayMemory.append([self.current_state,record['action'],record['reward'],new_state,record['terminal'],record['feature']])
# if len(self.replayMemory) > REPLAY_MEMORY:
# self.replayMemory.popleft()
self.current_state = new_state
self.current_feature = list_to_dic(record['observation'])
评论列表
文章目录