This commit is contained in:
2025-03-20 05:45:58 +07:00
parent ee5f8a8a52
commit ceced04171

View File

@@ -64,7 +64,7 @@ function runMCTS(
saveSimulatedNode::Bool=false, saveSimulatedNode::Bool=false,
multithread=false, multithread=false,
)::NamedTuple{(:root, :bestNextState, :bestTerminalState, :highValueStateList), )::NamedTuple{(:root, :bestNextState, :bestTerminalState, :highValueStateList),
Tuple{MCTSNode,T,T,Vector{Any}}} where {T<:Any} Tuple{MCTSNode,T,T,Vector{Dict{Symbol,Any}}}} where {T<:Any}
root = MCTSNode("root", initialstate, 0, 0, 0, 0, false, nothing, Dict{String,MCTSNode}(), root = MCTSNode("root", initialstate, 0, 0, 0, 0, false, nothing, Dict{String,MCTSNode}(),
Dict{Symbol,Any}()) Dict{Symbol,Any}())
@@ -125,7 +125,7 @@ function runMCTS(
bestTerminalState = selectBestTrajectoryNode(root) bestTerminalState = selectBestTrajectoryNode(root)
# take all high value state from highValueState channel and put it in a list # take all high value state from highValueState channel and put it in a list
highValueStateList = Any[] highValueStateList = Vector{Dict{Symbol, Any}}()
while !isempty(highValueState) while !isempty(highValueState)
push!(highValueStateList, take!(highValueState)) push!(highValueStateList, take!(highValueState))
end end
@@ -136,7 +136,6 @@ function runMCTS(
highValueStateList=highValueStateList) highValueStateList=highValueStateList)
end end
""" Search the best action to take for a given state and task """ Search the best action to take for a given state and task
# Arguments # Arguments