update
This commit is contained in:
11
src/mcts.jl
11
src/mcts.jl
@@ -203,14 +203,17 @@ end
|
||||
"""
|
||||
function expand(node::MCTSNode, transition::Function, transitionargs::NamedTuple;
|
||||
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
|
||||
@spawn begin
|
||||
results[i] = transition(deepcopy(node.state), deepcopy(transitionargs))
|
||||
result = transition(deepcopy(node.state), deepcopy(transitionargs))
|
||||
results[i] = result
|
||||
end
|
||||
println("--> sampling $i")
|
||||
end
|
||||
|
||||
|
||||
for result in results
|
||||
newNodeKey::AbstractString = result[:newNodeKey]
|
||||
newstate::AbstractDict = result[:newstate]
|
||||
|
||||
Reference in New Issue
Block a user