update
This commit is contained in:
12
src/mcts.jl
12
src/mcts.jl
@@ -407,6 +407,9 @@ function selectChildNode(node::MCTSNode)::MCTSNode
|
|||||||
# loop thought node children dictionary to find the highest progress value
|
# loop thought node children dictionary to find the highest progress value
|
||||||
for (k, childNode) in node.children
|
for (k, childNode) in node.children
|
||||||
potential = childNode.progressvalue + childNode.reward
|
potential = childNode.progressvalue + childNode.reward
|
||||||
|
if childNode.reward > 0 #XXX for testing. remove when done.
|
||||||
|
println("")
|
||||||
|
end
|
||||||
if potential > highestProgressValue
|
if potential > highestProgressValue
|
||||||
highestProgressValue = potential
|
highestProgressValue = potential
|
||||||
nodekey = childNode.nodekey
|
nodekey = childNode.nodekey
|
||||||
@@ -485,7 +488,8 @@ function runMCTS(
|
|||||||
n::Integer,
|
n::Integer,
|
||||||
maxDepth::Integer,
|
maxDepth::Integer,
|
||||||
maxIterations::Integer,
|
maxIterations::Integer,
|
||||||
w::Float64) where {T1<:agent}
|
w::Float64
|
||||||
|
) where {T1<:agent}
|
||||||
|
|
||||||
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}())
|
||||||
|
|
||||||
@@ -510,7 +514,11 @@ function runMCTS(
|
|||||||
end
|
end
|
||||||
|
|
||||||
best_child_state = argmax([child.statevalue / child.visits for child in values(root.children)])
|
best_child_state = argmax([child.statevalue / child.visits for child in values(root.children)])
|
||||||
error("---> runMCTS")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return best_child_state
|
return best_child_state
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -162,10 +162,10 @@ result = GeneralUtils.sendMqttMsg(outgoingMsg)
|
|||||||
outgoingMsg = Dict(
|
outgoingMsg = Dict(
|
||||||
:msgMeta=> msgMeta,
|
:msgMeta=> msgMeta,
|
||||||
:payload=> Dict(
|
:payload=> Dict(
|
||||||
:text=> "You didn't tell me wine name.",
|
:text=> "Yes.",
|
||||||
:select=> nothing,
|
:select=> nothing,
|
||||||
:reward=> -1,
|
:reward=> 0,
|
||||||
:isterminal=> true,
|
:isterminal=> false,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
result = GeneralUtils.sendMqttMsg(outgoingMsg)
|
result = GeneralUtils.sendMqttMsg(outgoingMsg)
|
||||||
|
|||||||
Reference in New Issue
Block a user