Skip to content

Commit 3f7a573

Browse files
committed
Forgot to -1 on indices b/c C++ starts at 0.
1 parent 2075bcb commit 3f7a573

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/writer.jl

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ function build_initial_beliefs(root::Node, p::POMDP, px::POMDPXFile, pbar)
124124
if px.pretty
125125
label = "s_$(px.s_name(s))"
126126
else
127-
label = "s$(stateindex(p, s))"
127+
sidx = stateindex(p, s)
128+
label = "s$(sidx - 1)"
128129
end
129130

130131
link!(parameter, param(label; prob=pdf(init_states, s)))
@@ -151,7 +152,8 @@ function build_transitions!(root::Node, p::POMDP, px::POMDPXFile, pbar)
151152
if px.pretty
152153
label = "* s_$(px.s_name(s)) s_$(px.s_name(s))"
153154
else
154-
label = "* s$(stateindex(p, s)) s$(stateindex(p, s))"
155+
sidx = stateindex(p, s)
156+
label = "* s$(sidx - 1) s$(sidx - 1)"
155157
end
156158

157159
link!(parameter, param(label; prob=1.0))
@@ -166,7 +168,8 @@ function build_transitions!(root::Node, p::POMDP, px::POMDPXFile, pbar)
166168
if px.pretty
167169
label = "a_$(px.a_name(a)) s_$(px.s_name(s)) s_$(px.s_name(sp))"
168170
else
169-
label = "a$(actionindex(p, a)) s$(stateindex(p, s)) s$(stateindex(p, sp))"
171+
(aidx, sidx, spidx) = (actionindex(p, a), stateindex(p, sp), stateindex(p, sp))
172+
label = "a$(aidx - 1) s$(sidx - 1) o$(spidx - 1)"
170173
end
171174

172175
T = transition(p, s, a)
@@ -209,7 +212,8 @@ function build_observations!(root::Node, p::POMDP, px::POMDPXFile, pbar)
209212
if px.pretty
210213
label = "a_$(px.a_name(a)) s_$(px.s_name(sp)) o_$(px.o_name(o))"
211214
else
212-
label = "a$(actionindex(p, a)) s$(stateindex(p, sp)) o$(obsindex(p, o))"
215+
(aidx, spidx, oidx) = (actionindex(p, a), stateindex(p, sp), obsindex(p, o))
216+
label = "a$(aidx - 1) s$(spidx - 1) o$(oidx - 1)"
213217
end
214218

215219
O = observation(p, a, sp)
@@ -239,7 +243,8 @@ function build_rewards!(root::Node, p::POMDP, px::POMDPXFile, pbar)
239243
if px.pretty
240244
label = "a_$(px.a_name(a)) s_$(px.s_name(s))"
241245
else
242-
label = "a$(actionindex(p, a)) s$(stateindex(p, s))"
246+
(aidx, sidx) = (actionindex(p, a), stateindex(p, s))
247+
label = "a$(aidx - 1) s$(sidx - 1)"
243248
end
244249

245250
if !isterminal(p, s)

0 commit comments

Comments
 (0)