Package org.ggp.base.util.gdl.model

Examples of org.ggp.base.util.gdl.model.SentenceDomainModel


      for(Gdl gdl : description)
        System.out.println(gdl);

    //We want to start with a rule graph and follow the rule graph.
    //Start by finding general information about the game
    SentenceDomainModel model = SentenceDomainModelFactory.createWithCartesianDomains(description);
    //Restrict domains to values that could actually come up in rules.
    //See chinesecheckers4's "count" relation for an example of why this
    //could be useful.
    model = SentenceDomainModelOptimizer.restrictDomainsToUsefulValues(model);

    if(verbose)
      System.out.println("Setting constants...");

    ConstantChecker constantChecker = ConstantCheckerFactory.createWithForwardChaining(model);
    if(verbose)
      System.out.println("Done setting constants");

    Set<String> sentenceFormNames = SentenceForms.getNames(model.getSentenceForms());
    boolean usingBase = sentenceFormNames.contains("base");
    boolean usingInput = sentenceFormNames.contains("input");


    //For now, we're going to build this to work on those with a
    //particular restriction on the dependency graph:
    //Recursive loops may only contain one sentence form.
    //This describes most games, but not all legal games.
    Multimap<SentenceForm, SentenceForm> dependencyGraph = model.getDependencyGraph();
    if(verbose) {
      System.out.print("Computing topological ordering... ");
      System.out.flush();
    }
    ConcurrencyUtils.checkForInterruption();
    List<SentenceForm> topologicalOrdering = getTopologicalOrdering(model.getSentenceForms(), dependencyGraph, usingBase, usingInput);
    if(verbose)
      System.out.println("done");

    List<Role> roles = Role.computeRoles(description);
    Map<GdlSentence, Component> components = new HashMap<GdlSentence, Component>();
View Full Code Here


        newDescription.add(gdl);
    }

    //Don't use the model indiscriminately; it reflects the old description,
    //not necessarily the new one
    SentenceDomainModel model = SentenceDomainModelFactory.createWithCartesianDomains(description);
    model = SentenceDomainModelOptimizer.restrictDomainsToUsefulValues(model);
    UnusedSentenceNameSource sentenceNameSource = UnusedSentenceNameSource.create(model);
    ConstantChecker constantChecker = ConstantCheckerFactory.createWithForwardChaining(model);

    Set<SentenceForm> constantForms = model.getConstantSentenceForms();

    ConcurrencyUtils.checkForInterruption();

    List<Gdl> curDescription = Lists.newArrayList(description);
    while(!rulesToAdd.isEmpty()) {
View Full Code Here

    //And if we split them up...
    List<GdlRule> newRules = applyCondensation(minSet, rule, sentenceNameSource);
    GdlRule r1 = newRules.get(0), r2 = newRules.get(1);

    //Augment the model
    SentenceDomainModel newModel = augmentModelWithNewForm(model, newRules);

    long a1 = AssignmentsImpl.getNumAssignmentsEstimate(r1,
        SentenceDomainModels.getVarDomains(r1, newModel, VarDomainOpts.INCLUDE_HEAD), checker);
    long a2 = AssignmentsImpl.getNumAssignmentsEstimate(r2,
        SentenceDomainModels.getVarDomains(r2, newModel, VarDomainOpts.INCLUDE_HEAD), checker);
View Full Code Here

  private static SentenceDomainModel augmentModelWithNewForm(
      final SentenceDomainModel oldModel, List<GdlRule> newRules) {
    final SentenceForm newForm = SimpleSentenceForm.create(newRules.get(0).getHead());
    final SentenceFormDomain newFormDomain = getNewFormDomain(newRules.get(0), oldModel, newForm);
    return new SentenceDomainModel() {
      @Override
      public SentenceFormDomain getDomain(SentenceForm form) {
        if (form.equals(newForm)) {
          return newFormDomain;
        }
View Full Code Here

TOP

Related Classes of org.ggp.base.util.gdl.model.SentenceDomainModel

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.