public override bool isTruth(Hypothesis hyp) { List <Boolean> boolList = new List <bool>(); foreach (AbstractCondition condition in conditions) { boolList.Add(condition.isTruth(hyp)); } return(boolList.Where(p => p == true).ToList().Count == boolList.Count); }
public bool checkHypothesis(string obj, string value) { try { var hypothesis = new Hypothesis(obj, value); var startCondition = KnowledgeBase.Conditions.Where(p => p.result == hypothesis.Value).ToList()[0]; return(startCondition.isTruth(hypothesis)); } catch { return(false); } }
public override bool isTruth(Hypothesis hyp) { var isInFacts = KnowledgeBase.Facts. Where(p => p.Property == hyp.Obj + " " + condition). ToList().Count > 0; if (isInFacts) { return(true); } var nextCondition = KnowledgeBase.Conditions.Where(p => p.result == condition).ToList(); if (nextCondition.Count == 0) { return(false); } return(nextCondition[0].isTruth(hyp)); }
public virtual bool isTruth(Hypothesis hyp) { return(true); }