Commit aa5f5a32 authored by Steven Cordwell's avatar Steven Cordwell
Browse files

clean up PolicyIteration._evalPolicyIterative argument checking

parent f5ebf036
...@@ -623,15 +623,15 @@ class PolicyIteration(MDP): ...@@ -623,15 +623,15 @@ class PolicyIteration(MDP):
# stopped iterations: epsilon-optimum value function found or maximum # stopped iterations: epsilon-optimum value function found or maximum
# number of iterations reached. # number of iterations reached.
# #
if (type(V0) in (int, float)) and (V0 == 0): try:
policy_V = zeros(self.S) assert V0.shape in ((self.S, ), (self.S, 1), (1, self.S)), \
else: "'V0' must be a vector of length S."
if (type(V0) in (ndarray)) and (V0.shape == (self.S, 1)): policy_V = array(V0).reshape(self.S)
policy_V = V0 except AttributeError:
if len(V0) == self.S:
policy_V = array(V0).reshape(self.S)
else: else:
raise ValueError("PyMDPtoolbox: V0 vector/array type not " policy_V = zeros(self.S)
"supported. Use ndarray of matrix column "
"vector length S.")
policy_P, policy_R = self._computePpolicyPRpolicy() policy_P, policy_R = self._computePpolicyPRpolicy()
......
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