reinforcement-learning - 为具有延迟奖励和连续时间的强化学习问题创建自定义环境
问题描述
我想为进一步的 RL 任务创建一个自定义环境。环境的一个特点是我不知道如何处理。也就是说,奖励不是在动作之后立即记录,而是在一段时间后记录。(既然有“时间”,那么可能需要一个“时钟”来安排离散事件的顺序?)。
我在某处寻找了一些教程,并将其总结为伪代码,如下所示。然而,大部分开源代码是针对传统 RL 环境的,这意味着奖励是在行动之后立即记录的。我对如何处理该def step(self, action):
功能感到困惑。
class env():
def __init__(self):
self.current_hour = 0
#states
self.observation = 0
#actions
self.actions = ['action1', 'action2'] #action space
self.n_actions = len(self.actions) #number of possible actions
#rewards
self.reward = 0 #reward
self.done = False
def step(self, action):
#1. Update the environment state based on the action chosen
#2. Calculate the reward for the new state
#3. Store the new observation for the state
#4. Check if the episode is over and store as done
return self.observation, self.reward, self.done
def reset(self): #Reset the environment's state. Returns observation.
self.done = False
self.observation = 0
return self.observation
解决方案
推荐阅读
- flutter - 列中图像上方的文本(颤振)
- django - 关系“weather_city”不存在
- rabbitmq - 一条消息处理正常,下一条消息被拒绝并进入死信
- c# - StreamReader 似乎在 ReadLine() 之后前进,即使没有什么可读的
- powermockito - PowerMockito 无法创建具有匿名块的类的实例
- sqlite-net - c# SqliteConnection 为数据库设置密码
- oracle - Oracle Internet Directory 12.2.1.3.0 执行调用时发生错误:域的钱包创建失败
- html - 未找到与 HTML 位于同一文件夹中的 CSS 文件
- python - 不兼容的形状:Tensorflow/Keras Sequential LSTM with Autoencoder
- javascript - 数组和检查里面的值的问题