update
This commit is contained in:
@@ -203,12 +203,15 @@ end
|
|||||||
"""
|
"""
|
||||||
function expand(node::MCTSNode, transition::Function, transitionargs::NamedTuple;
|
function expand(node::MCTSNode, transition::Function, transitionargs::NamedTuple;
|
||||||
totalsample::Integer=3)
|
totalsample::Integer=3)
|
||||||
results = Any[]
|
|
||||||
|
# not use Any[] because I want to preserve result order
|
||||||
|
results = Vector{Any}(undef, totalsample)
|
||||||
|
|
||||||
@sync for i in 1:totalsample
|
@sync for i in 1:totalsample
|
||||||
@spawn begin
|
@spawn begin
|
||||||
results[i] = transition(deepcopy(node.state), deepcopy(transitionargs))
|
result = transition(deepcopy(node.state), deepcopy(transitionargs))
|
||||||
|
results[i] = result
|
||||||
end
|
end
|
||||||
println("--> sampling $i")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
for result in results
|
for result in results
|
||||||
|
|||||||
Reference in New Issue
Block a user