Skip to content
This repository has been archived by the owner on May 6, 2021. It is now read-only.

Commit

Permalink
Extend MultiThreadEnv to accept a vector of environments (#108)
Browse files Browse the repository at this point in the history
* extend MultiThreadEnv
  • Loading branch information
findmyway authored Dec 19, 2020
1 parent 1eb14f3 commit 7d06c21
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/environments/wrappers/MultiThreadEnv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@ function Base.show(io::IO, t::MIME"text/markdown", env::MultiThreadEnv)
show(io, t, Markdown.parse(s))
end

function MultiThreadEnv(f, n)
envs = [f() for _ in 1:n]
"""
MultiThreadEnv(f, n::Int)
`f` is a lambda function which creates an `AbstractEnv` by calling `f()`.
"""
MultiThreadEnv(f, n::Int) = MultiThreadEnv([f() for _ in 1:n])

function MultiThreadEnv(envs::Vector{<:AbstractEnv})
n = length(envs)
S = state_space(envs[1])
s = state(envs[1])
if S isa Space
Expand Down

0 comments on commit 7d06c21

Please sign in to comment.