Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pymdptoolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Zahra Rajabi
pymdptoolbox
Commits
cafe5342
Commit
cafe5342
authored
Jan 18, 2013
by
Steven Cordwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updates to tests
parent
8a360851
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
16 deletions
+25
-16
test_mdptoolbox.py
test_mdptoolbox.py
+25
-16
No files found.
test_mdptoolbox.py
View file @
cafe5342
...
...
@@ -5,12 +5,12 @@ Created on Sun May 27 23:16:57 2012
@author: -
"""
from
math
import
factorial
from
mdp
import
exampleForest
,
exampleRand
,
MDP
,
PolicyIteration
,
ValueIteration
from
numpy
import
array
,
eye
,
matrix
,
zeros
from
numpy.random
import
rand
from
scipy.sparse
import
eye
as
speye
from
scipy.sparse
import
csr_matrix
as
sparse
from
scipy.stats.distributions
import
poisson
inst
=
MDP
()
...
...
@@ -144,24 +144,33 @@ def test_JacksCarRental():
P
=
zeros
((
A
,
S
,
S
))
R
=
zeros
((
A
,
S
,
S
))
for
a
in
range
(
A
):
for
s
in
range
(
S
):
for
s1
in
range
(
S
):
ncL
1s
=
int
(
s
/
21
)
ncL2s
=
s
-
ncL
1s
*
21
ncL
1s1
=
int
(
s1
/
21
)
ncL2s1
=
s
-
ncL
1s
*
21
ncs
=
ncL1s
+
ncL
2s
ncs1
=
ncL1s1
+
ncL
2s1
for
s
in
range
(
21
):
for
s1
in
range
(
21
):
c
1s
=
int
(
s
/
21
)
c2s
=
s
-
c
1s
*
21
c
1s1
=
int
(
s1
/
21
)
c2s1
=
s
-
c
1s
*
21
cs
=
c1s
+
c
2s
cs1
=
c1s1
+
c
2s1
netmove
=
5
-
a
pL1
=
pL2
=
p
=
((
3
**
n
)
/
factorial
(
3
))
*
exp
(
-
3
)
P
[
a
,
s
,
s1
]
=
R
[
a
,
s
,
s1
]
=
10
*
(
ncs
-
ncs1
)
-
2
*
abs
(
a
)
if
(
s1
<
s
):
pass
else
:
pass
P
[
a
,
s
,
s1
]
=
1
R
[
a
,
s
,
s1
]
=
10
*
(
cs
-
cs1
)
-
2
*
abs
(
a
)
inst
=
ValueIteration
(
P
,
R
,
0.9
)
inst
=
PolicyIteration
(
P
,
R
,
0.9
)
inst
.
iterate
()
#assert (inst.policy == )
def
test_JacksCarRental2
():
pass
def
test_GamblersProblem
():
inst
=
ValueIteration
()
inst
.
iterate
()
assert
(
inst
.
policy
==
)
#
assert (inst.policy == )
# checkSquareStochastic: not square, stochastic and non-negative
...
...
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