This commit is contained in:
narawat lamaiin
2024-06-22 16:55:38 +07:00
parent 8758c02e3f
commit b27684073d
2 changed files with 6 additions and 3 deletions

View File

@@ -32,7 +32,7 @@ julia>
# Signature
"""
function selectBestNextState(node::MCTSNode)::MCTSNode
highestProgressValue = 0
highestProgressValue = -1
nodekey = nothing
# if all childnode has statevalue == 0, use progressvalue + reward to select the best node
@@ -251,7 +251,10 @@ function expand(node::MCTSNode,transition::Function, transitionargs::NamedTuple;
while true
nthSample += 1
if nthSample <= totalsample
newNodeKey, newstate, progressvalue = transition(node.state, transitionargs)
result = transition(node.state, transitionargs)
newNodeKey::AbstractString = result[:newNodeKey]
newstate::AbstractDict = result[:newstate]
progressvalue::Integer = result[:progressvalue]
if newNodeKey keys(node.children)
node.children[newNodeKey] =
MCTSNode(newNodeKey, newstate, 0, progressvalue, 0, newstate[:reward],