Skip to content

Commit

Permalink
rng arg is optional in gen
Browse files Browse the repository at this point in the history
  • Loading branch information
zsunberg committed Jun 13, 2020
1 parent c4ee192 commit 609fe87
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/generative.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ end
end

"""
@gen(X)(m, s, a, rng)
@gen(X)(m, s, a)
@gen(X)(m, s, a, rng::AbstractRNG)
Call the generative model for a (PO)MDP `m`; Sample values from several nodes in the dynamic decision network. X is one or more symbols indicating which nodes to output.
Expand All @@ -184,6 +185,7 @@ Let `m` be an `MDP` or `POMDP`, `s` be a state of `m`, `a` be an action of `m`,
"""
macro gen(symbols...)
quote
(args...) -> gen(DDNOut($(symbols...)), args...)
# this should be an anonymous function, but there is a bug
f(m, s, a, rng=Random.GLOBAL_RNG) = gen(DDNOut($(symbols...)), m, s, a, rng)
end
end

0 comments on commit 609fe87

Please sign in to comment.