Package aima.core.logic.propositional.algorithms

Examples of aima.core.logic.propositional.algorithms.KnowledgeBase


  private static PLFCEntails plfce = new PLFCEntails();

  public static void main(String[] args) {

    System.out.println("\nPLFCEntailsDemo\n");
    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)");

    System.out.println("Example from  page 220 of AIMA 2nd Edition");
    System.out.println("KnowledgeBsse consists of sentences");
    System.out.println(" (P => Q)");
    System.out.println("((L AND M) => P)");
View Full Code Here


*/
public class PLResolutionDemo {
  private static PLResolution plr = new PLResolution();

  public static void main(String[] args) {
    KnowledgeBase kb = new KnowledgeBase();
    String fact = "((B11 =>  (NOT P11)) AND B11)";
    kb.tell(fact);
    System.out.println("\nPLResolutionDemo\n");
    System.out.println("adding " + fact + "to knowldegebase");
    displayResolutionResults(kb, "(NOT B11)");
  }
View Full Code Here

*
*/
public class WalkSatDemo {
  public static void main(String[] args) {
    System.out.println("\nWalkSatDemo\n");
    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)");

    System.out.println("Example from  page 220 of AIMA 2nd Edition");
    System.out.println("KnowledgeBsse consists of sentences");
    System.out.println(" (P => Q)");
    System.out.println("((L AND M) => P)");
    System.out.println("((B AND L) => M)");
    System.out.println("( (A AND P) => L)");
    System.out.println("((A AND B) => L)");
    System.out.println("(A)");
    System.out.println("(B)");

    WalkSAT walkSAT = new WalkSAT();
    Model m = walkSAT.findModelFor(kb.asSentence().toString(), 1000, 0.5);
    if (m == null) {
      System.out.println("failure");
    } else {
      m.print();
    }
View Full Code Here

    plfce = new PLFCEntails();
  }

  @Test
  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.assertEquals(true, plfce.plfcEntails(kb, "Q"));
  }
View Full Code Here

TOP

Related Classes of aima.core.logic.propositional.algorithms.KnowledgeBase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.