Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zahra Rajabi
pymdptoolbox
Commits
e8854225
Commit
e8854225
authored
Sep 11, 2013
by
Steven Cordwell
Browse files
use a try-execpt clause to allow sparse matrices to be used with PolicyIteration
parent
c5adb9ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/mdptoolbox/mdp.py
View file @
e8854225
...
...
@@ -606,7 +606,10 @@ class PolicyIteration(MDP):
ind
=
(
self
.
policy
==
aa
).
nonzero
()[
0
]
# if no rows use action a, then no need to assign this
if
ind
.
size
>
0
:
Ppolicy
[
ind
,
:]
=
self
.
P
[
aa
][
ind
,
:]
try
:
Ppolicy
[
ind
,
:]
=
self
.
P
[
aa
][
ind
,
:]
except
ValueError
:
Ppolicy
[
ind
,
:]
=
self
.
P
[
aa
][
ind
,
:].
todense
()
#PR = self._computePR() # an apparently uneeded line, and
# perhaps harmful in this implementation c.f.
# mdp_computePpolicyPRpolicy.m
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment