This commit is contained in:
narawat lamaiin
2024-04-24 12:30:16 +07:00
parent 96689b0913
commit b2c24e97ae
3 changed files with 28 additions and 75 deletions

View File

@@ -52,7 +52,7 @@ using GeneralUtils
Signature\n
-----
"""
struct MCTSNode{T}
struct MCTSNode{T<:AbstractDict}
state::T
visits::Integer
stateValue::AbstractFloat
@@ -129,7 +129,7 @@ end
-----
"""
function expand(node::MCTSNode, state::T, decisionMaker::Function, stateValueEstimator::Function;
n::Integer=3) where {T<:Any}
n::Integer=3) where {T<:AbstractDict}
# sampling action from decisionMaker
for sample in 1:n
@@ -164,7 +164,7 @@ end
Signature\n
-----
"""
function simulate(state::T, max_depth::Int) where {T<:Any}
function simulate(state::T, max_depth::Int) where {T<:AbstractDict}
total_reward = 0.0
for _ in 1:max_depth
#[] Implement your action selection function based on highest stateValue
@@ -264,7 +264,7 @@ end
"""
isLeaf(node::MCTSNode)::Bool = isempty(node.children)
"""
""" Think and choose action
Arguments\n
-----
@@ -287,7 +287,7 @@ isLeaf(node::MCTSNode)::Bool = isempty(node.children)
Signature\n
-----
"""
function decisionMaker()
function decisionMaker(state::T) where {T<:AbstractDict}
end