Skip to content

Commit c5a64ab

Browse files
committed
WIP
1 parent 7f36b6e commit c5a64ab

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/bellman.jl

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,13 @@ function _bellman_helper!(
259259
workspace::ProductWorkspace,
260260
strategy_cache::AbstractStrategyCache,
261261
Vres,
262-
V,
262+
V::AbstractArray{R},
263263
dfa::DFA,
264264
mp::IntervalMarkovProcess,
265265
lf::ProbabilisticLabelling,
266266
upper_bound = false,
267267
maximize = true,
268-
)
268+
) where {R}
269269
W = workspace.intermediate_values
270270

271271
@inbounds for state in dfa
@@ -274,12 +274,20 @@ function _bellman_helper!(
274274
# Select the value function for the current DFA state
275275
# according to the appropriate DFA transition function
276276
map!(W, CartesianIndices(state_values(mp))) do idx
277+
v = zero(R)
278+
279+
for (label, prob) in lf[idx]
280+
new_dfa_state = dfa[state, label]
281+
v += prob * V[idx, new_dfa_state]
282+
end
283+
284+
return v
277285

278-
A = lf[idx] #(Lx1) for IMDP state s', get all the p(f | s') for each label
279-
B = V[idx, :] #(Mx1) fir IMDP state s', get all V(s', z') for each DFA state
280-
C = onehot(transition(dfa))[state, :, :] #(LxM)
286+
# A = lf[idx] #(Lx1) for IMDP state s', get all the p(f | s') for each label
287+
# B = V[idx, :] #(Mx1) fir IMDP state s', get all V(s', z') for each DFA state
288+
# C = onehot(transition(dfa))[state, :, :] #(LxM)
281289

282-
return B' * C' * A
290+
# return B' * C' * A
283291
end
284292

285293
# For each state in the product process, compute the Bellman operator

0 commit comments

Comments
 (0)