-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provided policy_improvement() solution initializes values to zero for each iteration #204
Comments
Yes you are right. |
def policy_eval(policy, env,V = np.zeros(env.nS), discount_factor=1.0, theta=0.00001):
def policy_improvement(env, policy_eval_fn=policy_eval, discount_factor=1.0):
|
Provided solution does not follow the pseudocode on p. 102 exactly. It initializes policy evaluation with zeros each time, even though the book says: "Note that each policy evaluation, itself an iterative computation, is started with the value function for the previous policy." This change does not provide improvement in the "gridworld" example, but may speed up convergence in more complex examples.
It makes sense to change
policy_eval
signature to accept initial value forV
, something like this:and change
policy_improvement
to pass previous value topolicy_eval
.See also related issues about another bug in the function (#203) and its naming (#202).
The text was updated successfully, but these errors were encountered: