update
This commit is contained in:
@@ -442,7 +442,7 @@ function conversation(a::T, userinput::Dict) where {T<:agent}
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
bestplan = runMCTS(a, initialState, decisionMaker, progressValueEstimator, reflector,
|
bestplan = runMCTS(a, initialState, decisionMaker, progressValueEstimator, reflector,
|
||||||
isterminal, 2, 3, 2, 1.0)
|
isterminal, 2, 3, 3, 1.0)
|
||||||
error("---> bestplan")
|
error("---> bestplan")
|
||||||
|
|
||||||
# actor loop(bestplan)
|
# actor loop(bestplan)
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ function virtualWineCustomerReccommendbox(a::T1, input::T2)::String where {T1<:a
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
@show outgoingMsg
|
@show outgoingMsg
|
||||||
result = GeneralUtils.sendReceiveMqttMsg(outgoingMsg)
|
result = GeneralUtils.sendReceiveMqttMsg(outgoingMsg; timeout=120)
|
||||||
response = result[:response][:text]
|
response = result[:response][:text]
|
||||||
|
|
||||||
return response
|
return response
|
||||||
@@ -157,7 +157,7 @@ function virtualWineCustomerChatbox(a::T1, input::T2)::String where {T1<:agent,
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
@show outgoingMsg
|
@show outgoingMsg
|
||||||
result = GeneralUtils.sendReceiveMqttMsg(outgoingMsg)
|
result = GeneralUtils.sendReceiveMqttMsg(outgoingMsg; timeout=120)
|
||||||
response = result[:response][:text]
|
response = result[:response][:text]
|
||||||
|
|
||||||
return response
|
return response
|
||||||
@@ -291,7 +291,7 @@ function jsoncorrection(a::T1, input::T2,
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
result = GeneralUtils.sendReceiveMqttMsg(outgoingMsg)
|
result = GeneralUtils.sendReceiveMqttMsg(outgoingMsg; timeout=120)
|
||||||
incorrectjson = result[:response][:text]
|
incorrectjson = result[:response][:text]
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
11
src/mcts.jl
11
src/mcts.jl
@@ -348,8 +348,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
|
||||||
|
thisNodeProgressValue = childNode.statevalue + childNode.reward
|
||||||
if childNode.statevalue > highestProgressValue
|
if childNode.statevalue > highestProgressValue
|
||||||
highestProgressValue = childNode.statevalue + childNode.reward
|
highestProgressValue = thisNodeProgressValue
|
||||||
nodekey = childNode.nodekey
|
nodekey = childNode.nodekey
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -443,10 +444,10 @@ function runMCTS(
|
|||||||
|
|
||||||
expand(a, node, decisionMaker, progressValueEstimator, isterminal, n=n)
|
expand(a, node, decisionMaker, progressValueEstimator, isterminal, n=n)
|
||||||
|
|
||||||
leaf_node = UCTselect(node, w)
|
leafNode = UCTselect(node, w)
|
||||||
simTrajectoryReward = simulate(a, leaf_node, decisionMaker, progressValueEstimator,
|
simTrajectoryReward = simulate(a, leafNode, decisionMaker, progressValueEstimator,
|
||||||
isterminal, maxDepth, n=n)
|
isterminal, maxDepth, n=n)
|
||||||
backpropagate(leaf_node, simTrajectoryReward)
|
backpropagate(leafNode, simTrajectoryReward)
|
||||||
end
|
end
|
||||||
|
|
||||||
best_child_state = argmax([child.total_reward / child.visits for child in values(root.children)])
|
best_child_state = argmax([child.total_reward / child.visits for child in values(root.children)])
|
||||||
|
|||||||
@@ -96,7 +96,24 @@ result = GeneralUtils.sendMqttMsg(outgoingMsg)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
outgoingMsg = Dict(
|
||||||
|
:msgMeta=> msgMeta,
|
||||||
|
:payload=> Dict(
|
||||||
|
:text=> "You did not gave me any choice.",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
result = GeneralUtils.sendMqttMsg(outgoingMsg)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
outgoingMsg = Dict(
|
||||||
|
:msgMeta=> msgMeta,
|
||||||
|
:payload=> Dict(
|
||||||
|
:text=> "Yes.",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
result = GeneralUtils.sendMqttMsg(outgoingMsg)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user