This commit is contained in:
narawat lamaiin
2024-06-01 00:37:20 +07:00
parent 452262d3d6
commit 74a4190440
3 changed files with 71 additions and 7 deletions

View File

@@ -47,7 +47,7 @@ julia>
# Signature
"""
function runMCTS(
workDict::Dict{Symbol, Any},
workDict::T1,
initialState,
decisionMaker::Function,
evaluator::Function,
@@ -58,7 +58,7 @@ function runMCTS(
maxDepth::Integer=3,
maxiterations::Integer=10,
explorationweight::Number=1.0,
)
) where {T1<:AbstractDict}
root = MCTSNode("root", initialState, 0, 0, 0, 0, false, nothing, Dict{String, MCTSNode}())
@@ -74,7 +74,8 @@ function runMCTS(
# do nothing then go directly to backpropagation
backpropagate(leafNode, node.reward)
else
expand(workDict, node, decisionMaker, evaluator, reflector; totalsample=totalsample)
expand(workDict, node, decisionMaker, evaluator, reflector, transition;
totalsample=totalsample)
leafNode = selectChildNode(node)
simTrajectoryReward, terminalstate = simulate(workDict, leafNode, decisionMaker, evaluator,
reflector; maxDepth=maxDepth, totalsample=totalsample)