Esempio n. 1
0
            internal Clause Combine(Clause otherClause)
            {
                Clause combinedClause = new Clause()
                {
                    PositiveLiterals = new List <string>(otherClause.PositiveLiterals),
                    NegativeLiterals = new List <string>(otherClause.NegativeLiterals)
                };

                foreach (string s in PositiveLiterals)
                {
                    if (otherClause.NegativeLiterals.Contains(s))
                    {
                        combinedClause.NegativeLiterals.Remove(s);
                    }
                    else if (!combinedClause.PositiveLiterals.Contains(s))
                    {
                        combinedClause.PositiveLiterals.Add(s);
                    }
                }
                foreach (string s in NegativeLiterals)
                {
                    if (otherClause.PositiveLiterals.Contains(s))
                    {
                        combinedClause.PositiveLiterals.Remove(s);
                    }
                    else if (!combinedClause.NegativeLiterals.Contains(s))
                    {
                        combinedClause.NegativeLiterals.Add(s);
                    }
                }
                combinedClause.CombinedHow = combinedClause + "    [using rule " + this + "]";
                KnowledgeBase.Add(combinedClause);
                return(combinedClause);
            }
Esempio n. 2
0
 public void Inspect(IInspectable inspectable)
 {
     knowledgeBase.Add(inspectable);
 }
Esempio n. 3
0
 public void Tell(ILogicalExpression expr)
 {
     kb.Add(expr);
 }