update
This commit is contained in:
16
src/mcts.jl
16
src/mcts.jl
@@ -513,13 +513,17 @@ function runMCTS(
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
best_child_state = argmax([child.statevalue / child.visits for child in values(root.children)])
|
avgStateValue = 0
|
||||||
|
selectedChildKey = nothing
|
||||||
|
for (k, v) in root.children
|
||||||
|
k_avgStateValue = v.statevalue / v.visits
|
||||||
|
if k_avgStateValue > avgStateValue
|
||||||
|
avgStateValue = k_avgStateValue
|
||||||
|
selectedChildKey = k
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return root.children[selectedChildKey]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return best_child_state
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user