STANFORD RL CS234 第一次作业总结

1 Optimal Policy for Simple MDP

(a) 等比数列取极限。

(b)官方解答已经很清楚了

solution: If γ > 0, value of γ does not change the ordering of states, so the optimal policy is the same; however, the value of the value function depends on γ. If γ = 0 then, policy ∀s : π(s) = a0 is still an optimal policy; however, this is not the only optimal policy.

(c)加常量不会影响optimal policy,但是会改变value function

solution: No effect on the optimal policy. Adding a constant c to all the rewards only changes the value of each state by a constant vc for any policy π:

(d)如果a>0,optimal policy 不变;

a=0,所有policy都是optimal

a<0,optimal policy就是远离G.

 

2 Running Time of Value Iteration 

(a)等比数列

(b)常量

(c)感觉官方答案有点问题

1.为什么下标是n+1,其次下式命名是 Qn+2的展开

3 Approximating the Optimal Value Function

个人感觉理解这题的用意很重要,题目里也说得很清楚了。

This shows that if we compute an approximately optimal state-action value function and then extract the greedy policy for that approximate state-action value function, the resulting policy still does well in the real MDP.

证明贪心策略也能表现得很好。

Q∗(s, π(s)) 这个公式代表,当前使用π策略,后面递推继续使用最优策略。

(a) 证明也很清晰,就是整理出两个 ||Q ̃ − Q∗||∞ ≤ ε

(b)

V ∗(s) − Vπ(s) = V ∗(s) − Q∗(s, π(s)) + Q∗(s, π(s)) − Vπ(s)

                       ≤ 2ε + Q∗(s, π(s)) − Qπ(s, π(s))

                       = 2ε + γEs′ [V ∗(s′) − Vπ(s′)]

主要这边:不等式两边取期望,得到 Es′ [V ∗(s′) − Vπ(s′)]<=2ε/(1-γ)

带入原式即可。

(c) Q∗(s1, stay) = 2εγ /(1−γ) 这个式子很好的印证上面加下划线的一句话。

整个计算都很简单。

(d) 我对这题的理解就是证明可以找到一个使等式成立的policy。

4 Frozen Lake MDP

写代码还是比较有意思的一题,认真写过可以加深对MDP的理解

(a)policy_evaluation:给定policy,循环的计算value_function,直至连续两次的value_function差值小于阈值。

policy_improvement:利用greedy的方式找到局部最优的policy。

policy_iteration:先用policy_evaluation计算value_function,再用policy_improvement计算新的policy,直至policy不再变化。

(b)value_iteration:使用greedy从Vn计算到V0,直至误差小于阈值。

(c)对于deterministic的FrozenLake计算出来的policy,环境执行时,过程都是固定的,可以移动到G(goal).

而对于stochastic的FrozenLake policy与deterministic不同,而且每次执行过程也不同,可能会移动到G,也有可能移动到H(hole).

 

相关代码,随后我会放到git上。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章