Package aima.core.logic.propositional.algorithms

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


    dpll = new DPLL();
  }

  @Test
  public void testDPLLReturnsTrueWhenAllClausesTrueInModel() {
    Model model = new Model();
    model = model.extend(new Symbol("A"), true).extend(new Symbol("B"),
        true);
    Sentence sentence = (Sentence) parser.parse("((A AND B) AND (A OR B))");
    boolean satisfiable = dpll.dpllSatisfiable(sentence, model);
    Assert.assertEquals(true, satisfiable);
  }
View Full Code Here


    Assert.assertEquals(true, satisfiable);
  }

  @Test
  public void testDPLLReturnsFalseWhenOneClauseFalseInModel() {
    Model model = new Model();
    model = model.extend(new Symbol("A"), true).extend(new Symbol("B"),
        false);
    Sentence sentence = (Sentence) parser.parse("((A OR B) AND (A => B))");
    boolean satisfiable = dpll.dpllSatisfiable(sentence, model);
    Assert.assertEquals(false, satisfiable);
  }
View Full Code Here

    Assert.assertEquals(false, satisfiable);
  }

  @Test
  public void testDPLLFiltersClausesTheStatusOfWhichAreKnown() {
    Model model = new Model();
    model = model.extend(new Symbol("A"), true).extend(new Symbol("B"),
        true);
    Sentence sentence = (Sentence) parser
        .parse("((A AND B) AND (B AND C))");
    List<Sentence> clauseList = new Converter<Sentence>()
        .setToList(new CNFClauseGatherer()
View Full Code Here

    clausesWithNonTrueValues.contains(nonTrueClause);
  }

  @Test
  public void testDPLLFilteringNonTrueClausesGivesNullWhenAllClausesAreKnown() {
    Model model = new Model();
    model = model.extend(new Symbol("A"), true)
        .extend(new Symbol("B"), true).extend(new Symbol("C"), true);
    Sentence sentence = (Sentence) parser
        .parse("((A AND B) AND (B AND C))");
    List<Sentence> clauseList = new Converter<Sentence>()
        .setToList(new CNFClauseGatherer()
View Full Code Here

    Assert.assertEquals(0, clausesWithNonTrueValues.size());
  }

  @Test
  public void testDPLLFindsPurePositiveSymbolsWhenTheyExist() {
    Model model = new Model();
    model = model.extend(new Symbol("A"), true).extend(new Symbol("B"),
        true);
    Sentence sentence = (Sentence) parser
        .parse("((A AND B) AND (B AND C))");
    List<Sentence> clauseList = new Converter<Sentence>()
        .setToList(new CNFClauseGatherer()
View Full Code Here

    Assert.assertEquals(new Boolean(true), sv.value);
  }

  @Test
  public void testDPLLFindsPureNegativeSymbolsWhenTheyExist() {
    Model model = new Model();
    model = model.extend(new Symbol("A"), true).extend(new Symbol("B"),
        true);
    Sentence sentence = (Sentence) parser
        .parse("((A AND B) AND ( B  AND (NOT C) ))");
    List<Sentence> clauseList = new Converter<Sentence>()
        .setToList(new CNFClauseGatherer()
View Full Code Here

  }

  @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

    kb.tell("(B11 <=> (P12 OR P21))");
    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

    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

    falseSentence = (Sentence) parser.parse("false");
    andSentence = (Sentence) parser.parse("(P  AND  Q)");
    orSentence = (Sentence) parser.parse("(P  OR  Q)");
    impliedSentence = (Sentence) parser.parse("(P  =>  Q)");
    biConditionalSentence = (Sentence) parser.parse("(P  <=>  Q)");
    m = new Model();
  }
View Full Code Here

TOP

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

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.