public void UnqueryBehaviorGraph(object obj) { if (UserGraph == null) { return; } var knowledge = obj as IKnowledge; Debug.Assert(knowledge != null); var node = UserGraph.UpdateSolvingCache(knowledge, false); if (node != null) { object obj1 = UserGraph.SearchPrevInnerLoopNode(node); var obj1Node = obj1 as BehaviorGraphNode; var obj1Lst = obj1 as List <BehaviorGraphNode>; if (obj1Node != null) { CurrentStateNode = obj1Node; } if (obj1Lst != null && obj1Lst.Count != 0) { CurrentStateNode = obj1Lst[0]; } } }
private bool GoalVerify(IKnowledge obj, EqGoal eqGoal, out string msg, out object output) { msg = AGTutorMessage.VerifyWrong; output = null; List <Tuple <object, object> > trace = null; var agPropExpr = new AGPropertyExpr(obj.Expr, eqGoal); agPropExpr.IsSelected = true; agPropExpr.GenerateSolvingTrace(); trace = agPropExpr.AutoTrace; BehaviorGraphNode node; if (trace == null || trace.Count == 0) { node = UserGraph.UpdateSolvingCache(agPropExpr); //node = UserGraph.SearchInnerLoopNode(eqGoal); if (node == null) { return(false); } } if (trace != null) { bool matchResult = UserGraph.Match(trace); if (!matchResult) { return(false); } //insert nodes UserGraph.Insert(trace); CurrentStateNode = UserGraph.SearchInnerLoopNode(obj); //update _currentStateNode; } else { CurrentStateNode = UserGraph.SearchInnerLoopNode(eqGoal); } /* var nextTuple1 = UserGraph.SearchNextInnerLoopNode(CurrentStateNode); * if (nextTuple1 == null) // query-end * { * msg = AGTutorMessage.SolvedProblem; * return true; * } */ msg = AGTutorMessage.VerifyCorrect; return(true); }
private QueryFeedbackState VerifyBehaviorGraph(object obj, out string msg, out object output) { msg = null; output = null; Debug.Assert(obj != null); var iKnowledge = obj as IKnowledge; Debug.Assert(iKnowledge != null); //verify user's own step var matchedNode = UserGraph.UpdateSolvingCache(iKnowledge); msg = matchedNode == null ? AGTutorMessage.VerifyWrong : AGTutorMessage.VerifyCorrect; //TODO, wrong node derivation if (matchedNode == null) { //equation -> higher Level Semantics, such as goal or shape. var gObj = Reasoner.Instance.ExprValidate(iKnowledge.Expr); var gKnowledge = gObj as IKnowledge; if (gKnowledge != null) { Verify(iKnowledge, gKnowledge, out msg, out output); if (msg.Equals(AGTutorMessage.VerifyCorrect)) { string str = UpdateVerifiedMessage(); if (str != null) { msg = str; } return(QueryFeedbackState.TutorQueryProcessedVerify); } } var gKnowledgeLst = gObj as List <object>; if (gKnowledgeLst != null) { foreach (var gKTemp in gKnowledgeLst) { gKnowledge = gKTemp as IKnowledge; if (gKnowledge == null) { continue; } Verify(iKnowledge, gKnowledge, out msg, out output); if (!msg.Equals(AGTutorMessage.VerifyWrong)) { return(QueryFeedbackState.TutorQueryProcessedVerify); } } } return(QueryFeedbackState.TutorQueryProcessedVerify); } Debug.Assert(matchedNode != null); CurrentStateNode = matchedNode; string str1 = UpdateVerifiedMessage(); if (str1 != null) { msg = str1; } return(QueryFeedbackState.TutorQueryProcessedVerify); /* var nextTuple = UserGraph.SearchNextInnerLoopNode(matchedNode); * if (nextTuple == null) * { * if (UserGraph.IsPartialCorrect()) * { * msg = AGTutorMessage.SolvingPartialProblem; * } * else * { * msg = AGTutorMessage.SolvedProblem; * } * }*/ }