This commit is contained in:
narawat lamaiin
2024-05-11 16:30:21 +07:00
parent 2e9c21f243
commit 724519f74b
2 changed files with 13 additions and 5 deletions

View File

@@ -407,6 +407,9 @@ function selectChildNode(node::MCTSNode)::MCTSNode
# loop thought node children dictionary to find the highest progress value
for (k, childNode) in node.children
potential = childNode.progressvalue + childNode.reward
if childNode.reward > 0 #XXX for testing. remove when done.
println("")
end
if potential > highestProgressValue
highestProgressValue = potential
nodekey = childNode.nodekey
@@ -485,7 +488,8 @@ function runMCTS(
n::Integer,
maxDepth::Integer,
maxIterations::Integer,
w::Float64) where {T1<:agent}
w::Float64
) where {T1<:agent}
root = MCTSNode("root", initialState, 0, 0, 0, 0, false, nothing, Dict{String, MCTSNode}())
@@ -510,7 +514,11 @@ function runMCTS(
end
best_child_state = argmax([child.statevalue / child.visits for child in values(root.children)])
error("---> runMCTS")
return best_child_state
end