Skip to content

Commit

Permalink
Modify default_action to make function calls that use given mdp/pomdp
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshugupta1009 committed Nov 15, 2022
1 parent dd3531b commit 79d4944
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/default_action.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@ struct ExceptionRethrow end
default_action(::ExceptionRethrow, mdp, s, ex) = rethrow(ex)

function default_action(f::Function, mdp, s, ex)
a = f(s, ex)
warn_default(ex, a)
return a
try
a = f(s, ex)
@warn("""
Modify the function definition to take three arguments, i.e., f(mdp,s,ex) instead of f(s,ex). The older version will be deprecated soon.
""")
warn_default(ex,a)
return a
catch e
a = f(mdp,s,ex)
warn_default(ex,a)
return a
end
end

function default_action(p::POMDPs.Policy, mdp, s, ex)
Expand Down

0 comments on commit 79d4944

Please sign in to comment.