Package aima.core.logic.propositional.parsing.ast

Examples of aima.core.logic.propositional.parsing.ast.Symbol


  @Test
  public void testIssue66() {
    // http://code.google.com/p/aima-java/issues/detail?id=66
    Model model = new Model();
    model = model.extend(new Symbol("A"), false)
        .extend(new Symbol("B"), false).extend(new Symbol("C"), true);
    Sentence sentence = (Sentence) parser.parse("((A OR B) OR C)");
    Assert.assertTrue(dpll.dpllSatisfiable(sentence, model));
  }
View Full Code Here


    Sentence one = (Sentence) parser.parse("A");
    Sentence two = (Sentence) parser.parse("(NOT A)");
    // Sentence expected =(Sentence) parser.parse("(A OR C)");
    Set<Sentence> resolvents = resolution.plResolve(one, two);
    Assert.assertEquals(1, resolvents.size());
    Assert.assertTrue(resolvents.contains(new Symbol("EMPTY_CLAUSE")));
  }
View Full Code Here

    kb.tell("(B21 <=> ((P11 OR P22) OR P31))");
    kb.tell("(NOT B11)");
    kb.tell("(B21)");

    Model model = new Model();
    model = model.extend(new Symbol("B11"), false);
    model = model.extend(new Symbol("B21"), true);
    model = model.extend(new Symbol("P11"), false);
    model = model.extend(new Symbol("P12"), false);
    model = model.extend(new Symbol("P21"), false);
    model = model.extend(new Symbol("P22"), false);
    model = model.extend(new Symbol("P31"), true);

    Sentence kbs = kb.asSentence();
    Assert.assertEquals(true, model.isTrue(kbs));
  }
View Full Code Here

    m = new Model();
  }

  @Test
  public void testEmptyModel() {
    Assert.assertEquals(null, m.getStatus(new Symbol("P")));
    Assert.assertEquals(true, m.isUnknown(new Symbol("P")));
  }
View Full Code Here

  }

  @Test
  public void testExtendModel() {
    String p = "P";
    m = m.extend(new Symbol(p), true);
    Assert.assertEquals(Boolean.TRUE, m.getStatus(new Symbol("P")));
  }
View Full Code Here

  @Test
  public void testSentenceStatusWhenPTrueAndQTrue() {
    String p = "P";
    String q = "Q";
    m = m.extend(new Symbol(p), true);
    m = m.extend(new Symbol(q), true);
    Assert.assertEquals(true, m.isTrue(andSentence));
    Assert.assertEquals(true, m.isTrue(orSentence));
    Assert.assertEquals(true, m.isTrue(impliedSentence));
    Assert.assertEquals(true, m.isTrue(biConditionalSentence));
  }
View Full Code Here

  @Test
  public void testSentenceStatusWhenPFalseAndQFalse() {
    String p = "P";
    String q = "Q";
    m = m.extend(new Symbol(p), false);
    m = m.extend(new Symbol(q), false);
    Assert.assertEquals(true, m.isFalse(andSentence));
    Assert.assertEquals(true, m.isFalse(orSentence));
    Assert.assertEquals(true, m.isTrue(impliedSentence));
    Assert.assertEquals(true, m.isTrue(biConditionalSentence));
  }
View Full Code Here

  @Test
  public void testSentenceStatusWhenPTrueAndQFalse() {
    String p = "P";
    String q = "Q";
    m = m.extend(new Symbol(p), true);
    m = m.extend(new Symbol(q), false);
    Assert.assertEquals(true, m.isFalse(andSentence));
    Assert.assertEquals(true, m.isTrue(orSentence));
    Assert.assertEquals(true, m.isFalse(impliedSentence));
    Assert.assertEquals(true, m.isFalse(biConditionalSentence));
  }
View Full Code Here

  @Test
  public void testSentenceStatusWhenPFalseAndQTrue() {
    String p = "P";
    String q = "Q";
    m = m.extend(new Symbol(p), false);
    m = m.extend(new Symbol(q), true);
    Assert.assertEquals(true, m.isFalse(andSentence));
    Assert.assertEquals(true, m.isTrue(orSentence));
    Assert.assertEquals(true, m.isTrue(impliedSentence));
    Assert.assertEquals(true, m.isFalse(biConditionalSentence));
  }
View Full Code Here

  @Test
  public void testComplexSentence() {
    String p = "P";
    String q = "Q";
    m = m.extend(new Symbol(p), true);
    m = m.extend(new Symbol(q), false);
    Sentence sent = (Sentence) parser.parse("((P OR Q) AND  (P => Q))");
    Assert.assertFalse(m.isTrue(sent));
    Assert.assertTrue(m.isFalse(sent));
    Sentence sent2 = (Sentence) parser.parse("((P OR Q) AND  (Q))");
    Assert.assertFalse(m.isTrue(sent2));
View Full Code Here

TOP

Related Classes of aima.core.logic.propositional.parsing.ast.Symbol

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.