Agent.py 文件源码

python
阅读 40 收藏 0 点赞 0 评论 0

项目:combine-DT-with-NN-in-RL 作者: Burning-Bear 项目源码 文件源码
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'])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号