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
f6e001b7
Commit
f6e001b7
authored
Feb 04, 2013
by
Steven Cordwell
Browse files
edit docstring of check()
parent
4a305db3
Changes
1
Hide whitespace changes
Inline
Side-by-side
mdp.py
View file @
f6e001b7
...
...
@@ -100,6 +100,7 @@ from scipy.sparse import csr_matrix as sparse
# __all__ = ["check", "checkSquareStochastic"]
# These need to be fixed so that we use classes derived from Error.
mdperr
=
{
"mat_nonneg"
:
"PyMDPtoolbox: Probabilities must be non-negative."
,
...
...
@@ -152,24 +153,28 @@ mdperr = {
}
def
check
(
P
,
R
):
"""Check if
the matrices
P and R define a Markov Decision Process.
"""Check if P and R define a Markov Decision Process.
Let S = number of states, A = number of actions.
The transition matrix P must be on the shape (A, S, S) and P[a,:,:]
must be stochastic.
The reward matrix R must be on the shape (A, S, S) or (S, A).
Raises an error if P and R do not define a MDP.
Parameters
---------
P : transition matrix (A, S, S)
P could be an array with 3 dimensions or a object array (A, ),
each cell containing a matrix (S, S) possibly sparse
R : reward matrix (A, S, S) or (S, A)
R could be an array with 3 dimensions (SxSxA) or a object array
(A, ), each cell containing a sparse matrix (S, S) or a 2D
array(S, A) possibly sparse
P : array_like
The transition matrices. It can be a three dimensional array_like with
a shape of (A, S, S). It can also be a one dimensional array_like with
a shape of (A, ), where each element contains a matrix of shape (S, S)
which can possibly be sparse.
R : array_like
The reward matrix. It can be a three dimensional array_like with a
shape of (S, A, A). It can also be a one dimensional array_like with a
shape of (A, ), where each element contains matrix with a shape of
(S, S) which can possibly be sparse. It can also be an array_like with
a shape of (S, A) which can possibly be sparse.
Notes
-----
Raises an error if P and R do not define a MDP.
"""
# Check P
# tranitions must be a numpy array either an AxSxS ndarray (with any
...
...
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