AIMA.Core.Logic.Propositional.Algorithms.PLFCEntails.plfcEntails C# (CSharp) Method

plfcEntails() public method

public plfcEntails ( KnowledgeBase kb, Symbol q ) : bool
kb KnowledgeBase
q AIMA.Core.Logic.Propositional.Parsing.Ast.Symbol
return bool
        public bool plfcEntails(KnowledgeBase kb, Symbol q)
        {
            List<HornClause> hornClauses = asHornClauses(kb.getSentences());
            while (agenda.Count != 0)
            {
                Symbol p = agenda.Pop();
                while (!inferred(p))
                {
                    _inferred.Add(p, true);

                    for (int i = 0; i < hornClauses.Count; i++)
                    {
                        HornClause hornClause = hornClauses[i];
                        if (hornClause.premisesContainsSymbol(p))
                        {
                            decrementCount(hornClause);
                            if (countisZero(hornClause))
                            {
                                if (hornClause.head().Equals(q))
                                {
                                    return true;
                                }
                                else
                                {
                                    agenda.Push(hornClause.head());
                                }
                            }
                        }
                    }
                }
            }
            return false;
        }

Same methods

PLFCEntails::plfcEntails ( KnowledgeBase kb, String s ) : bool