Skip to content
This repository has been archived by the owner on Aug 11, 2023. It is now read-only.

Commit

Permalink
return correct probability with RandomPolicy and MultiThreadEnv (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
findmyway authored Sep 28, 2020
1 parent a50888d commit 15ecb93
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/implementations/policies.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ RandomPolicy(::FullActionSet, env::AbstractEnv, rng) = RandomPolicy(nothing, rng
# Ideally we should return a Categorical distribution.
# But this means we need to introduce an extra dependency of Distributions
# watch https://github.com/JuliaStats/Distributions.jl/issues/1139
get_prob(p::RandomPolicy{<:VectSpace}, env::MultiThreadEnv) = [fill(1/length(s), length(s)) for s in p.action_space]
get_prob(p::RandomPolicy, env::MultiThreadEnv) = [get_prob(p, x) for x in env]
get_prob(p::RandomPolicy, env) = fill(1 / length(p.action_space), length(p.action_space))
get_prob(p::RandomPolicy{Nothing}, env) = get_prob(p, env, ChanceStyle(env))
Expand Down

0 comments on commit 15ecb93

Please sign in to comment.