void OnlinePlanExpansionExecution::OnGoalNodeSucceeded(_In_ IOlcbpPlan::NodeID nodeId) { GoalEx* pGoal = (GoalEx*)m_pOlcbpPlan->GetNode(nodeId); _ASSERTE(pGoal->State() == ESTATE_Succeeded); if (GetNodeData(nodeId).BelongingCase != nullptr) { LogInfo("Goal=%s succeeded, revising its case and retaining it", pGoal->ToString().c_str()); CaseEx* currentCase = GetLastCaseForGoalNode(nodeId); m_pCbReasoner->Reviser()->Revise(currentCase, true); //UpdateHistory(currentCase); m_succeededSnippets.insert(nodeId); } else { LogInfo("Goal=%s succeeded without expansion, no case to revise", pGoal->ToString().c_str()); } UpdateBelongingSubplanChildrenWithParentReadiness(nodeId); OnNodeDone(nodeId); if (m_planRootNodeId == nodeId) { g_MessagePump->Send(new Message(0, MSG_PlanComplete)); } }
void OnlinePlanExpansionExecution::OnGoalNodeFailed(_In_ IOlcbpPlan::NodeID nodeId) { GoalEx* pGoal = (GoalEx*)m_pOlcbpPlan->GetNode(nodeId); _ASSERTE(pGoal->State() == ESTATE_Failed); if (GetNodeData(nodeId).BelongingCase != nullptr) { LogInfo("Goal=%s failed, revising and retaining it", pGoal->ToString().c_str()); CaseEx* currentCase = GetLastCaseForGoalNode(nodeId); m_pCbReasoner->Reviser()->Revise(currentCase, false); //UpdateHistory(currentCase); } OnNodeDone(nodeId); }