Package aima.core.logic.fol.kb.data

Examples of aima.core.logic.fol.kb.data.Clause.addPositiveLiteral()


    Assert.assertNotNull(c1.binaryResolvents(c1));
    Assert.assertEquals(1, c1.binaryResolvents(c1).size());
    Assert.assertTrue(c1.binaryResolvents(c1).iterator().next().isEmpty());

    // Check if resolve with self to an empty clause
    c1.addPositiveLiteral(new Predicate("Pred1", new ArrayList<Term>()));
    c1.addNegativeLiteral(new Predicate("Pred1", new ArrayList<Term>()));
    Assert.assertNotNull(c1.binaryResolvents(c1));
    Assert.assertEquals(1, c1.binaryResolvents(c1).size());
    // i.e. resolving a tautology with a tautology gives you
    // back a tautology.
View Full Code Here


    Assert.assertEquals("[~Pred1(), Pred1()]", c1.binaryResolvents(c1)
        .iterator().next().toString());

    // Check if try to resolve with self and no resolvents
    c1 = new Clause();
    c1.addPositiveLiteral(new Predicate("Pred1", new ArrayList<Term>()));
    Assert.assertEquals(0, c1.binaryResolvents(c1).size());

    c1 = new Clause();
    Clause c2 = new Clause();
    // Ensure that two empty clauses resolve to an empty clause
View Full Code Here

    c2 = new Clause();
    c1.addPositiveLiteral(new Predicate("Pred1", new ArrayList<Term>()));
    c1.addPositiveLiteral(new Predicate("Pred2", new ArrayList<Term>()));
    c1.addNegativeLiteral(new Predicate("Pred3", new ArrayList<Term>()));
    c1.addNegativeLiteral(new Predicate("Pred4", new ArrayList<Term>()));
    c2.addPositiveLiteral(new Predicate("Pred2", new ArrayList<Term>()));
    c2.addNegativeLiteral(new Predicate("Pred4", new ArrayList<Term>()));
    Assert.assertNotNull(c1.binaryResolvents(c2));
    Assert.assertEquals(0, c1.binaryResolvents(c2).size());
    Assert.assertNotNull(c2.binaryResolvents(c1));
    Assert.assertEquals(0, c2.binaryResolvents(c1).size());
View Full Code Here

    c1 = new Clause();
    c2 = new Clause();
    c1.addPositiveLiteral(new Predicate("Pred1", new ArrayList<Term>()));
    c1.addNegativeLiteral(new Predicate("Pred2", new ArrayList<Term>()));
    c1.addNegativeLiteral(new Predicate("Pred3", new ArrayList<Term>()));
    c2.addPositiveLiteral(new Predicate("Pred2", new ArrayList<Term>()));
    Assert.assertNotNull(c1.binaryResolvents(c2));
    Assert.assertNotNull(c2.binaryResolvents(c1));
    Assert.assertEquals(1, c1.binaryResolvents(c2).iterator().next()
        .getNumberPositiveLiterals());
    Assert.assertEquals(1, c1.binaryResolvents(c2).iterator().next()
View Full Code Here

    FOLParser parser = new FOLParser(domain);

    // B = A
    Clause c1 = new Clause();
    c1.addPositiveLiteral((AtomicSentence) parser.parse("B = A"));

    Clause c2 = new Clause();
    c2.addNegativeLiteral((AtomicSentence) parser.parse("B = A"));
    c2.addPositiveLiteral((AtomicSentence) parser.parse("B = A"));
View Full Code Here

    Clause c1 = new Clause();
    c1.addPositiveLiteral((AtomicSentence) parser.parse("B = A"));

    Clause c2 = new Clause();
    c2.addNegativeLiteral((AtomicSentence) parser.parse("B = A"));
    c2.addPositiveLiteral((AtomicSentence) parser.parse("B = A"));

    Set<Clause> resolvents = c1.binaryResolvents(c2);

    Assert.assertEquals(1, resolvents.size());
    Assert.assertEquals("[[B = A]]", resolvents.toString());
View Full Code Here

    c2.addNegativeLiteral(new Predicate("Pred1", pts1));
    Assert.assertEquals(c1.hashCode(), c2.hashCode());

    c1.addPositiveLiteral(new Predicate("Pred1", pts1));
    Assert.assertNotSame(c1.hashCode(), c2.hashCode());
    c2.addPositiveLiteral(new Predicate("Pred1", pts1));
    Assert.assertEquals(c1.hashCode(), c2.hashCode());
  }

  @Test
  public void testSimpleEquals() {
View Full Code Here

    // Check positives
    c1.addPositiveLiteral(new Predicate("Pred1", pts1));
    Assert.assertFalse(c1.equals(c2));
    Assert.assertFalse(c2.equals(c1));
    c2.addPositiveLiteral(new Predicate("Pred1", pts1));
    Assert.assertTrue(c1.equals(c2));
    Assert.assertTrue(c2.equals(c1));

    c1.addPositiveLiteral(new Predicate("Pred2", pts2));
    Assert.assertFalse(c1.equals(c2));
View Full Code Here

    Assert.assertTrue(c2.equals(c1));

    c1.addPositiveLiteral(new Predicate("Pred2", pts2));
    Assert.assertFalse(c1.equals(c2));
    Assert.assertFalse(c2.equals(c1));
    c2.addPositiveLiteral(new Predicate("Pred2", pts2));
    Assert.assertTrue(c1.equals(c2));
    Assert.assertTrue(c2.equals(c1));
    // Check same but added in different order
    c1.addPositiveLiteral(new Predicate("Pred3", pts1));
    Assert.assertFalse(c1.equals(c2));
View Full Code Here

    Assert.assertFalse(c1.equals(c2));
    Assert.assertFalse(c2.equals(c1));
    c1.addPositiveLiteral(new Predicate("Pred4", pts1));
    Assert.assertFalse(c1.equals(c2));
    Assert.assertFalse(c2.equals(c1));
    c2.addPositiveLiteral(new Predicate("Pred4", pts1));
    Assert.assertFalse(c1.equals(c2));
    Assert.assertFalse(c2.equals(c1));
    c2.addPositiveLiteral(new Predicate("Pred3", pts1));
    Assert.assertTrue(c1.equals(c2));
    Assert.assertTrue(c2.equals(c1));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.