tell() public method

public tell ( String aSentence ) : void
aSentence String
return void
Example #1
0
 public bool plResolution(String kbs, String alphaString)
 {
     KnowledgeBase kb = new KnowledgeBase();
     kb.tell(kbs);
     Sentence alpha = (Sentence)new PEParser().parse(alphaString);
     return plResolution(kb, alpha);
 }
Example #2
0
        public bool plResolution(String kbs, String alphaString)
        {
            KnowledgeBase kb = new KnowledgeBase();

            kb.tell(kbs);
            Sentence alpha = (Sentence) new PEParser().parse(alphaString);

            return(plResolution(kb, alpha));
        }
Example #3
0
        public void testAIMAExample()
        {
            KnowledgeBase kb = new KnowledgeBase();
            kb.tell(" (P => Q)");
            kb.tell("((L AND M) => P)");
            kb.tell("((B AND L) => M)");
            kb.tell("( (A AND P) => L)");
            kb.tell("((A AND B) => L)");
            kb.tell("(A)");
            kb.tell("(B)");

            Assert.AreEqual(true, plfce.plfcEntails(kb, "Q"));
        }
Example #4
0
	public void testAIMAExample() {
		KnowledgeBase kb = new KnowledgeBase();
		kb.tell(" (P => Q)");
		kb.tell("((L AND M) => P)");
		kb.tell("((B AND L) => M)");
		kb.tell("( (A AND P) => L)");
		kb.tell("((A AND B) => L)");
		kb.tell("(A)");
		kb.tell("(B)");
		WalkSAT walkSAT = new WalkSAT();
		Model m = walkSAT.findModelFor(kb.asSentence().ToString(), 1000, 0.5);
		if (m == null) {
			System.Console.WriteLine("failure");
		} else {
			m.print();
		}
	}
Example #5
0
        public void testTTEntailsSucceedsWithChadCarffsBugReport()
        {
            KnowledgeBase kb = new KnowledgeBase();
            kb.tell("(B12 <=> (P11 OR (P13 OR (P22 OR P02))))");
            kb.tell("(B21 <=> (P20 OR (P22 OR (P31 OR P11))))");
            kb.tell("(B01 <=> (P00 OR (P02 OR P11)))");
            kb.tell("(B10 <=> (P11 OR (P20 OR P00)))");
            kb.tell("(NOT B21)");
            kb.tell("(NOT B12)");
            kb.tell("(B10)");
            kb.tell("(B01)");

            Assert.IsTrue(kb.askWithTTEntails("(P00)"));
            Assert.IsFalse(kb.askWithTTEntails("(NOT P00)"));
        }
Example #6
0
 public void testDoesNotKnow()
 {
     KnowledgeBase kb = new KnowledgeBase();
     kb.tell("A");
     Assert.IsFalse(kb.askWithTTEntails("B"));
     Assert.IsFalse(kb.askWithTTEntails("(NOT B)"));
 }
Example #7
0
 public void testMultipleClauseResolution()
 {
     // test (and fix) suggested by Huy Dinh. Thanks Huy!
     PLResolution plr = new PLResolution();
     KnowledgeBase kb = new KnowledgeBase();
     String fact = "((B11 <=> (P12 OR P21)) AND (NOT B11))";
     kb.tell(fact);
     plr.plResolution(kb, "(B)");
 }