update
This commit is contained in:
10
src/mcts.jl
10
src/mcts.jl
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user