Package org.ggp.base.util.reasoner.gdl

Examples of org.ggp.base.util.reasoner.gdl.GdlSentenceSet


   *
   * On average, this approach is more efficient than {@link #createWithProver(SentenceFormModel)}.
   */
  public static ImmutableConstantChecker createWithForwardChaining(SentenceDomainModel model) throws InterruptedException {
    GdlChainingReasoner reasoner = GdlChainingReasoner.create(model);
    GdlSentenceSet sentencesByForm = reasoner.getConstantSentences();
    addSentencesTrueByRulesDifferentially(sentencesByForm, model, reasoner);
    return ImmutableConstantChecker.create(model,
        Multimaps.filterKeys(sentencesByForm.getSentences(), Predicates.in(model.getConstantSentenceForms())));
  }
View Full Code Here


    dependencySubgraph = ImmutableMultimap.copyOf(dependencySubgraph);
    List<Set<SentenceForm>> ordering = DependencyGraphs.toposortSafe(constantForms, dependencySubgraph);

    for (Set<SentenceForm> stratum : ordering) {
      // One non-differential pass, collecting the changes
      GdlSentenceSet newlyTrueSentences = GdlSentenceSet.create();
      for (SentenceForm form : stratum) {
        for (GdlRule rule : model.getRules(form)) {
          GdlSentenceSet ruleResults =
              reasoner.getRuleResults(rule, domainModel, sentencesByForm);
          if (!reasoner.isSubsetOf(sentencesByForm, ruleResults)) {
            sentencesByForm = reasoner.getUnion(sentencesByForm, ruleResults);
            newlyTrueSentences = reasoner.getUnion(newlyTrueSentences, ruleResults);
          }
        }
      }

      // Now a lot of differential passes to deal with recursion efficiently
      boolean somethingChanged = true;
      while (somethingChanged) {
        somethingChanged = false;
        GdlSentenceSet newStuffInThisPass = GdlSentenceSet.create();
        for (SentenceForm form : stratum) {
          for (GdlRule rule : model.getRules(form)) {
            GdlSentenceSet ruleResults =
                reasoner.getRuleResultsForNewSentences(rule, domainModel, sentencesByForm,
                    newlyTrueSentences);
            if (!reasoner.isSubsetOf(sentencesByForm, ruleResults)) {
              somethingChanged = true;
              newStuffInThisPass = reasoner.getUnion(newStuffInThisPass, ruleResults);
View Full Code Here

TOP

Related Classes of org.ggp.base.util.reasoner.gdl.GdlSentenceSet

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.