Package aima.core.logic.propositional.visitors

Examples of aima.core.logic.propositional.visitors.SymbolClassifier


  //

  private Set<Sentence> filterOutClausesWithTwoComplementaryLiterals(
      Set<Sentence> clauses) {
    Set<Sentence> filtered = new HashSet<Sentence>();
    SymbolClassifier classifier = new SymbolClassifier();
    Iterator<Sentence> iter = clauses.iterator();
    while (iter.hasNext()) {
      Sentence clause = iter.next();
      Set<Symbol> positiveSymbols = classifier
          .getPositiveSymbolsIn(clause);
      Set<Symbol> negativeSymbols = classifier
          .getNegativeSymbolsIn(clause);
      if ((SetOps.intersection(positiveSymbols, negativeSymbols).size() == 0)) {
        filtered.add(clause);
      }
    }
View Full Code Here


    Set<Symbol> positiveInClause1NegativeInClause2,
        negativeInClause1PositiveInClause2;

    public ClauseSymbols(Sentence clause1, Sentence clause2) {

      SymbolClassifier classifier = new SymbolClassifier();

      clause1Symbols = classifier.getSymbolsIn(clause1);
      clause1PositiveSymbols = classifier.getPositiveSymbolsIn(clause1);
      clause1NegativeSymbols = classifier.getNegativeSymbolsIn(clause1);

      clause2Symbols = classifier.getSymbolsIn(clause2);
      clause2PositiveSymbols = classifier.getPositiveSymbolsIn(clause2);
      clause2NegativeSymbols = classifier.getNegativeSymbolsIn(clause2);

      positiveInClause1NegativeInClause2 = SetOps.intersection(
          clause1PositiveSymbols, clause2NegativeSymbols);
      negativeInClause1PositiveInClause2 = SetOps.intersection(
          clause1NegativeSymbols, clause2PositiveSymbols);
View Full Code Here

    // System.out.println("model= " + model);
    // }

    // debug
    List<Symbol> purePositiveSymbols = SYMBOL_CONVERTER.setToList(SetOps
        .difference(new SymbolClassifier()
            .getPurePositiveSymbolsIn(nonTrueClauses),
            symbolsAlreadyAssigned));

    List<Symbol> pureNegativeSymbols = SYMBOL_CONVERTER.setToList(SetOps
        .difference(new SymbolClassifier()
            .getPureNegativeSymbolsIn(nonTrueClauses),
            symbolsAlreadyAssigned));
    // if none found return "not found
    if ((purePositiveSymbols.size() == 0)
        && (pureNegativeSymbols.size() == 0)) {
View Full Code Here

    return true;
  }

  private boolean isClauseTrueInModel(Sentence clause, Model model) {
    List<Symbol> positiveSymbols = SYMBOL_CONVERTER
        .setToList(new SymbolClassifier().getPositiveSymbolsIn(clause));
    List<Symbol> negativeSymbols = SYMBOL_CONVERTER
        .setToList(new SymbolClassifier().getNegativeSymbolsIn(clause));

    for (Symbol symbol : positiveSymbols) {
      if ((model.isTrue(symbol))) {
        return true;
      }
View Full Code Here

  //

  private Set<Sentence> filterOutClausesWithTwoComplementaryLiterals(
      Set<Sentence> clauses) {
    Set<Sentence> filtered = new HashSet<Sentence>();
    SymbolClassifier classifier = new SymbolClassifier();
    Iterator<Sentence> iter = clauses.iterator();
    while (iter.hasNext()) {
      Sentence clause = iter.next();
      Set<Symbol> positiveSymbols = classifier
          .getPositiveSymbolsIn(clause);
      Set<Symbol> negativeSymbols = classifier
          .getNegativeSymbolsIn(clause);
      if ((SetOps.intersection(positiveSymbols, negativeSymbols).size() == 0)) {
        filtered.add(clause);
      }
    }
View Full Code Here

    Set<Symbol> positiveInClause1NegativeInClause2,
        negativeInClause1PositiveInClause2;

    public ClauseSymbols(Sentence clause1, Sentence clause2) {

      SymbolClassifier classifier = new SymbolClassifier();

      clause1Symbols = classifier.getSymbolsIn(clause1);
      clause1PositiveSymbols = classifier.getPositiveSymbolsIn(clause1);
      clause1NegativeSymbols = classifier.getNegativeSymbolsIn(clause1);

      clause2Symbols = classifier.getSymbolsIn(clause2);
      clause2PositiveSymbols = classifier.getPositiveSymbolsIn(clause2);
      clause2NegativeSymbols = classifier.getNegativeSymbolsIn(clause2);

      positiveInClause1NegativeInClause2 = SetOps.intersection(
          clause1PositiveSymbols, clause2NegativeSymbols);
      negativeInClause1PositiveInClause2 = SetOps.intersection(
          clause1NegativeSymbols, clause2PositiveSymbols);
View Full Code Here

    // System.out.println("model= " + model);
    // }

    // debug
    List<Symbol> purePositiveSymbols = SYMBOL_CONVERTER.setToList(SetOps
        .difference(new SymbolClassifier()
            .getPurePositiveSymbolsIn(nonTrueClauses),
            symbolsAlreadyAssigned));

    List<Symbol> pureNegativeSymbols = SYMBOL_CONVERTER.setToList(SetOps
        .difference(new SymbolClassifier()
            .getPureNegativeSymbolsIn(nonTrueClauses),
            symbolsAlreadyAssigned));
    // if none found return "not found
    if ((purePositiveSymbols.size() == 0)
        && (pureNegativeSymbols.size() == 0)) {
View Full Code Here

    return true;
  }

  private boolean isClauseTrueInModel(Sentence clause, Model model) {
    List<Symbol> positiveSymbols = SYMBOL_CONVERTER
        .setToList(new SymbolClassifier().getPositiveSymbolsIn(clause));
    List<Symbol> negativeSymbols = SYMBOL_CONVERTER
        .setToList(new SymbolClassifier().getNegativeSymbolsIn(clause));

    for (Symbol symbol : positiveSymbols) {
      if ((model.isTrue(symbol))) {
        return true;
      }
View Full Code Here

  private PEParser parser;

  @Before
  public void setUp() {
    classifier = new SymbolClassifier();
    parser = new PEParser();

  }
View Full Code Here

TOP

Related Classes of aima.core.logic.propositional.visitors.SymbolClassifier

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.