This commit is contained in:
narawat lamaiin
2024-06-01 15:03:15 +07:00
parent de51dfd69d
commit 3269b27237
10 changed files with 1394 additions and 15 deletions

View File

@@ -47,12 +47,9 @@ julia>
# Signature
"""
function runMCTS(
config::T1,
initialState,
decisionMaker::Function,
evaluator::Function,
reflector::Function,
transition::Function,
args...,
;
totalsample::Integer=3,
maxDepth::Integer=3,
@@ -74,11 +71,11 @@ function runMCTS(
# do nothing then go directly to backpropagation
backpropagate(leafNode, node.reward)
else
expand(config, node, decisionMaker, evaluator, reflector, transition;
expand(node, transition, args...;
totalsample=totalsample)
leafNode = selectChildNode(node)
simTrajectoryReward, terminalstate = simulate(config, leafNode, decisionMaker, evaluator,
reflector, transition; maxDepth=maxDepth, totalsample=totalsample)
simTrajectoryReward, terminalstate = simulate(leafNode, transition, args...;
maxDepth=maxDepth, totalsample=totalsample)
if terminalstate !== nothing #XXX not sure why I need this
terminalstate[:totalTrajectoryReward] = simTrajectoryReward
end