Package aima.core.logic.fol.domain

Examples of aima.core.logic.fol.domain.FOLDomain


    this(domain, inferenceProcedure, new Unifier());
  }

  public FOLKnowledgeBase(FOLDomain domain,
      InferenceProcedure inferenceProcedure, Unifier unifier) {
    this.parser = new FOLParser(new FOLDomain(domain));
    this.inferenceProcedure = inferenceProcedure;
    this.unifier = unifier;
    //
    this.substVisitor = new SubstVisitor();
    this.variableCollector = new VariableCollector();
View Full Code Here


  FOLParser parser;

  @Before
  public void setUp() {
    FOLDomain domain = DomainFactory.crusadesDomain();

    lexer = new FOLLexer(domain);
    parser = new FOLParser(lexer);
  }
View Full Code Here

public class FOLLexerTest {
  FOLLexer lexer;

  @Before
  public void setUp() {
    FOLDomain domain = new FOLDomain();
    domain.addConstant("P");
    domain.addConstant("John");
    domain.addConstant("Saladin");
    domain.addFunction("LeftLeg");
    domain.addFunction("BrotherOf");
    domain.addFunction("EnemyOf");
    domain.addPredicate("HasColor");
    domain.addPredicate("King");
    lexer = new FOLLexer(domain);
  }
View Full Code Here

public class FOLOTTERLikeTheoremProverTest extends
    CommonFOLInferenceProcedureTests {

  @Test
  public void testDefaultClauseSimplifier() {
    FOLDomain domain = new FOLDomain();
    domain.addConstant("ZERO");
    domain.addConstant("ONE");
    domain.addPredicate("P");
    domain.addFunction("Plus");
    domain.addFunction("Power");

    FOLParser parser = new FOLParser(domain);

    List<TermEquality> rewrites = new ArrayList<TermEquality>();
    rewrites.add((TermEquality) parser.parse("Plus(x, ZERO) = x"));
View Full Code Here

  // uses subsumption correctly so that it exhausts
  // its search space.
  @Test
  public void testExhaustsSearchSpace() {
    // Taken from AIMA pg 679
    FOLDomain domain = new FOLDomain();
    domain.addPredicate("alternate");
    domain.addPredicate("bar");
    domain.addPredicate("fri_sat");
    domain.addPredicate("hungry");
    domain.addPredicate("patrons");
    domain.addPredicate("price");
    domain.addPredicate("raining");
    domain.addPredicate("reservation");
    domain.addPredicate("type");
    domain.addPredicate("wait_estimate");
    domain.addPredicate("will_wait");
    domain.addConstant("Some");
    domain.addConstant("Full");
    domain.addConstant("French");
    domain.addConstant("Thai");
    domain.addConstant("Burger");
    domain.addConstant("$");
    domain.addConstant("_30_60");
    domain.addConstant("X0");
    FOLParser parser = new FOLParser(domain);

    // The hypothesis
    String c1 = "patrons(v,Some)";
    String c2 = "patrons(v,Full) AND (hungry(v) AND type(v,French))";
View Full Code Here

    Assert.assertFalse(c1.isImplicationDefiniteClause());
  }

  @Test
  public void testBinaryResolvents() {
    FOLDomain domain = new FOLDomain();
    domain.addPredicate("Pred1");
    domain.addPredicate("Pred2");
    domain.addPredicate("Pred3");
    domain.addPredicate("Pred4");

    Clause c1 = new Clause();

    // Ensure that resolving to self when empty returns an empty clause
    Assert.assertNotNull(c1.binaryResolvents(c1));
View Full Code Here

    } while (System.currentTimeMillis() < finishTime);
  }

  @Test
  public void testEqualityBinaryResolvents() {
    FOLDomain domain = new FOLDomain();
    domain.addConstant("A");
    domain.addConstant("B");

    FOLParser parser = new FOLParser(domain);

    // B = A
    Clause c1 = new Clause();
View Full Code Here

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

  @Test
  public void testComplexEquals() {
    FOLDomain domain = new FOLDomain();
    domain.addConstant("A");
    domain.addConstant("B");
    domain.addConstant("C");
    domain.addConstant("D");
    domain.addPredicate("P");
    domain.addPredicate("Animal");
    domain.addPredicate("Kills");
    domain.addFunction("F");
    domain.addFunction("SF0");

    FOLParser parser = new FOLParser(domain);

    CNFConverter cnfConverter = new CNFConverter(parser);
    Sentence s1 = parser.parse("((x1 = y1 AND y1 = z1) => x1 = z1)");
View Full Code Here

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

  @Test
  public void testNonTrivialFactors() {
    FOLDomain domain = new FOLDomain();
    domain.addConstant("A");
    domain.addConstant("B");
    domain.addFunction("F");
    domain.addFunction("G");
    domain.addFunction("H");
    domain.addPredicate("P");
    domain.addPredicate("Q");

    FOLParser parser = new FOLParser(domain);

    // p(x,y), q(a,b), p(b,a), q(y,x)
    Clause c = new Clause();
View Full Code Here

  // Note: Tests derived from:
  // http://logic.stanford.edu/classes/cs157/2008/notes/chap09.pdf
  // page 16.
  @Test
  public void testIsTautology() {
    FOLDomain domain = new FOLDomain();
    domain.addConstant("A");
    domain.addPredicate("P");
    domain.addPredicate("Q");
    domain.addPredicate("R");
    domain.addFunction("F");

    FOLParser parser = new FOLParser(domain);

    // {p(f(a)),~p(f(a))}
    Clause c = new Clause();
View Full Code Here

TOP

Related Classes of aima.core.logic.fol.domain.FOLDomain

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.