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
287ec766
Commit
287ec766
authored
May 20, 2013
by
Steven Cordwell
Browse files
reconfigure the reward table to store the state
parent
33ebe256
Changes
1
Hide whitespace changes
Inline
Side-by-side
mdp.py
View file @
287ec766
...
...
@@ -562,12 +562,13 @@ def exampleRand(S, A, is_sparse=False, is_sqlite=False, mask=None):
for
a
in
range
(
A
):
cmd
=
'''
CREATE TABLE transition%s (row INTEGER, col INTEGER,
val
REAL);
CREATE TABLE reward%s (val REAL);'''
%
(
a
,
a
)
prob
REAL);
CREATE TABLE reward%s (
state INTEGER,
val REAL);'''
%
(
a
,
a
)
c
.
executescript
(
cmd
)
states
=
range
(
S
)
reward
=
rand
(
S
).
tolist
()
cmd
=
"INSERT INTO reward%s VALUES(?)"
%
a
c
.
executemany
(
cmd
,
zip
(
reward
))
cmd
=
"INSERT INTO reward%s VALUES(
?,
?)"
%
a
c
.
executemany
(
cmd
,
zip
(
states
,
reward
))
for
s
in
xrange
(
S
):
n
=
randint
(
1
,
S
//
3
)
# timeit [90894] * 20330
...
...
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