@@ -78,6 +78,7 @@ function bellman(
7878 alg:: BellmanAlgorithm = default_bellman_algorithm (model);
7979 upper_bound = false ,
8080 maximize = true ,
81+ prop = nothing ,
8182)
8283 Vres = similar (V, source_shape (model))
8384
@@ -89,6 +90,7 @@ function bellman(
8990 alg;
9091 upper_bound = upper_bound,
9192 maximize = maximize,
93+ prop = prop,
9294 )
9395end
9496
@@ -179,6 +181,7 @@ function bellman!(
179181 alg:: BellmanAlgorithm = default_bellman_algorithm (model);
180182 upper_bound = false ,
181183 maximize = true ,
184+ prop = nothing ,
182185)
183186 workspace = construct_workspace (model, alg)
184187 strategy_cache = construct_strategy_cache (model)
@@ -192,6 +195,7 @@ function bellman!(
192195 avail_act;
193196 upper_bound = upper_bound,
194197 maximize = maximize,
198+ prop = prop,
195199 )
196200end
197201
@@ -204,6 +208,7 @@ function bellman!(
204208 avail_act:: AbstractAvailableActions = available_actions (model);
205209 upper_bound = false ,
206210 maximize = true ,
211+ prop = nothing ,
207212)
208213 return _bellman_helper! (
209214 workspace,
@@ -226,6 +231,7 @@ function bellman!(
226231 avail_act:: AbstractAvailableActions = available_actions (model);
227232 upper_bound = false ,
228233 maximize = true ,
234+ prop = nothing ,
229235)
230236 mp = markov_process (model)
231237 lf = labelling_function (model)
@@ -242,6 +248,7 @@ function bellman!(
242248 avail_act;
243249 upper_bound = upper_bound,
244250 maximize = maximize,
251+ prop = prop,
245252 )
246253end
247254
@@ -256,10 +263,16 @@ function _bellman_helper!(
256263 avail_act;
257264 upper_bound = false ,
258265 maximize = true ,
266+ prop = nothing ,
259267)
260268 W = workspace. intermediate_values
261269
262270 @inbounds for state in dfa
271+ # If a DFA property is given, skip terminal states
272+ if ! isnothing (prop) && state ∈ terminal (prop)
273+ continue
274+ end
275+
263276 local_strategy_cache = localize_strategy_cache (strategy_cache, state)
264277
265278 # Select the value function for the current DFA state
@@ -296,10 +309,16 @@ function _bellman_helper!(
296309 avail_act;
297310 upper_bound = false ,
298311 maximize = true ,
312+ prop = nothing ,
299313) where {R}
300314 W = workspace. intermediate_values
301315
302316 @inbounds for state in dfa
317+ # If a DFA property is given, skip terminal states
318+ if ! isnothing (prop) && state ∈ terminal (prop)
319+ continue
320+ end
321+
303322 local_strategy_cache = localize_strategy_cache (strategy_cache, state)
304323
305324 # Select the value function for the current DFA state
0 commit comments