Examples of UnarySentence


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

   *
   * @return the answer to the specified question using PL-Resolution.
   */
  public boolean plResolution(KnowledgeBase kb, Sentence alpha) {
    Sentence kBAndNotAlpha = new BinarySentence("AND", kb.asSentence(),
        new UnarySentence(alpha));
    Set<Sentence> clauses = new CNFClauseGatherer()
        .getClausesFrom(new CNFTransformer().transform(kBAndNotAlpha));
    clauses = filterOutClausesWithTwoComplementaryLiterals(clauses);
    Set<Sentence> newClauses = new HashSet<Sentence>();
    while (true) {
View Full Code Here

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

    List<Sentence> sentences = new ArrayList<Sentence>();
    for (int i = 0; i < positiveSymbols.size(); i++) {
      sentences.add(positiveSymbols.get(i));
    }
    for (int i = 0; i < negativeSymbols.size(); i++) {
      sentences.add(new UnarySentence(negativeSymbols.get(i)));
    }
    if (sentences.size() == 0) {
      return new Symbol("EMPTY_CLAUSE"); // == empty clause
    } else {
      return LogicUtils.chainWith("OR", sentences);
View Full Code Here

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

        .accept(this, null));
    return new BinarySentence("AND", first, second);
  }

  private Sentence transformImpliedSentence(BinarySentence bs) {
    Sentence first = new UnarySentence((Sentence) bs.getFirst().accept(
        this, null));
    return new BinarySentence("OR", first, (Sentence) bs.getSecond()
        .accept(this, null));
  }
View Full Code Here

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

      return (Sentence) ((UnarySentence) us.getNegated()).getNegated()
          .accept(this, null);
    } else if (us.getNegated() instanceof BinarySentence) {
      BinarySentence bs = (BinarySentence) us.getNegated();
      if (bs.isAndSentence()) {
        Sentence first = new UnarySentence((Sentence) bs.getFirst()
            .accept(this, null));
        Sentence second = new UnarySentence((Sentence) bs.getSecond()
            .accept(this, null));
        return new BinarySentence("OR", first, second);
      } else if (bs.isOrSentence()) {
        Sentence first = new UnarySentence((Sentence) bs.getFirst()
            .accept(this, null));
        Sentence second = new UnarySentence((Sentence) bs.getSecond()
            .accept(this, null));
        return new BinarySentence("AND", first, second);
      } else {
        return (Sentence) super.visitNotSentence(us, null);
      }
View Full Code Here

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

        return new SymbolValuePair(new Symbol(
            ((Symbol) clause).getValue()), true);
      }

      if (clause instanceof UnarySentence) {
        UnarySentence sentence = (UnarySentence) clause;
        Sentence negated = sentence.getNegated();
        if ((negated instanceof Symbol)
            && (!(model.getAssignedSymbols().contains(negated)))) {
          // System.out.println("found unit clause type 2 -
          // assigning");
          return new SymbolValuePair(new Symbol(
View Full Code Here

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

   *
   * @return the answer to the specified question using PL-Resolution.
   */
  public boolean plResolution(KnowledgeBase kb, Sentence alpha) {
    Sentence kBAndNotAlpha = new BinarySentence("AND", kb.asSentence(),
        new UnarySentence(alpha));
    Set<Sentence> clauses = new CNFClauseGatherer()
        .getClausesFrom(new CNFTransformer().transform(kBAndNotAlpha));
    clauses = filterOutClausesWithTwoComplementaryLiterals(clauses);
    Set<Sentence> newClauses = new HashSet<Sentence>();
    while (true) {
View Full Code Here

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

    List<Sentence> sentences = new ArrayList<Sentence>();
    for (int i = 0; i < positiveSymbols.size(); i++) {
      sentences.add(positiveSymbols.get(i));
    }
    for (int i = 0; i < negativeSymbols.size(); i++) {
      sentences.add(new UnarySentence(negativeSymbols.get(i)));
    }
    if (sentences.size() == 0) {
      return new Symbol("EMPTY_CLAUSE"); // == empty clause
    } else {
      return LogicUtils.chainWith("OR", sentences);
View Full Code Here

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

        return new SymbolValuePair(new Symbol(
            ((Symbol) clause).getValue()), true);
      }

      if (clause instanceof UnarySentence) {
        UnarySentence sentence = (UnarySentence) clause;
        Sentence negated = sentence.getNegated();
        if ((negated instanceof Symbol)
            && (!(model.getAssignedSymbols().contains(negated)))) {
          // System.out.println("found unit clause type 2 -
          // assigning");
          return new SymbolValuePair(new Symbol(
View Full Code Here

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

        .accept(this, null));
    return new BinarySentence("AND", first, second);
  }

  private Sentence transformImpliedSentence(BinarySentence bs) {
    Sentence first = new UnarySentence((Sentence) bs.getFirst().accept(
        this, null));
    return new BinarySentence("OR", first, (Sentence) bs.getSecond()
        .accept(this, null));
  }
View Full Code Here

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

      return (Sentence) ((UnarySentence) us.getNegated()).getNegated()
          .accept(this, null);
    } else if (us.getNegated() instanceof BinarySentence) {
      BinarySentence bs = (BinarySentence) us.getNegated();
      if (bs.isAndSentence()) {
        Sentence first = new UnarySentence((Sentence) bs.getFirst()
            .accept(this, null));
        Sentence second = new UnarySentence((Sentence) bs.getSecond()
            .accept(this, null));
        return new BinarySentence("OR", first, second);
      } else if (bs.isOrSentence()) {
        Sentence first = new UnarySentence((Sentence) bs.getFirst()
            .accept(this, null));
        Sentence second = new UnarySentence((Sentence) bs.getSecond()
            .accept(this, null));
        return new BinarySentence("AND", first, second);
      } else {
        return (Sentence) super.visitNotSentence(us, null);
      }
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.