Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 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);
     }
 }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
 public virtual bool isTruth(Hypothesis hyp)
 {
     return(true);
 }