Commit 1b0301dc authored by Steven Cordwell's avatar Steven Cordwell
Browse files

indenting and self reference fixes in class PolicyIterationModified

parent c572ef9f
......@@ -609,31 +609,31 @@ class PolicyIterationModified(MDP):
self.time = time()
done = False
while not done:
self.iter = self.iter + 1
Vnext, policy = bellmanOperator(self.P, self.PR, self.discount, self.V)
#[Ppolicy, PRpolicy] = mdp_computePpolicyPRpolicy(P, PR, policy);
variation = mdp_span(Vnext - V);
if self.verbose:
print(" %s %s" % (self.iter, variation))
V = Vnext
if variation < thresh:
done = True
else:
is_verbose = False
if self.verbose:
self.verbose = False
is_verbose = True
done = False
while not done:
self.iter = self.iter + 1
V = evalPolicyIterative(P, PR, discount, policy, V, epsilon, max_iter)
Vnext, policy = self.bellmanOperator(self.P, self.PR, self.discount, self.V)
#[Ppolicy, PRpolicy] = mdp_computePpolicyPRpolicy(P, PR, policy);
if is_verbose:
self.verbose = True
variation = mdp_span(Vnext - V);
if self.verbose:
print(" %s %s" % (self.iter, variation))
V = Vnext
if variation < thresh:
done = True
else:
is_verbose = False
if self.verbose:
self.verbose = False
is_verbose = True
V = self.evalPolicyIterative(self.P, self.PR, self.discount, self.policy, self.V, self.epsilon, self.max_iter)
if is_verbose:
self.verbose = True
self.time = time() - self.time
class QLearning(MDP):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment