Package org.ggp.base.util.prover.aima

Examples of org.ggp.base.util.prover.aima.AimaProver


  public List<ValidatorWarning> checkValidity(Game theGame) throws ValidatorException {
    try {
      StateMachine sm = new ProverStateMachine();
      sm.initialize(theGame.getRules());

      AimaProver prover = new AimaProver(theGame.getRules());
      GdlSentence basesQuery = GdlPool.getRelation(BASE, new GdlTerm[] {X});
      Set<GdlSentence> bases = prover.askAll(basesQuery, Collections.<GdlSentence>emptySet());
      GdlSentence inputsQuery = GdlPool.getRelation(INPUT, new GdlTerm[] {X, Y});
      Set<GdlSentence> inputs = prover.askAll(inputsQuery, Collections.<GdlSentence>emptySet());

      if (bases.size() == 0) {
        throw new ValidatorException("Could not find base propositions.");
      } else if (inputs.size() == 0) {
        throw new ValidatorException("Could not find input propositions.");
View Full Code Here


  }

  private static void addSentencesTrueByRules(
      Multimap<SentenceForm, GdlSentence> sentencesByForm,
      SentenceFormModel model) throws InterruptedException {
    AimaProver prover = new AimaProver(model.getDescription());
    for (SentenceForm form : model.getConstantSentenceForms()) {
      GdlSentence query = form.getSentenceFromTuple(getVariablesTuple(form.getTupleSize()));
      for (GdlSentence result : prover.askAll(query, ImmutableSet.<GdlSentence>of())) {
        ConcurrencyUtils.checkForInterruption();
        //Variables may end up being replaced with functions, which is not
        //what we want here, so we have to double-check that the form is correct.
        if (form.matches(result)) {
          sentencesByForm.put(form, result);
View Full Code Here

  }

  @Override
  public void initialize(List<Gdl> description)
  {
    prover = new AimaProver(description);
    roles = ImmutableList.copyOf(Role.computeRoles(description));
    initialState = computeInitialState();
  }
View Full Code Here

TOP

Related Classes of org.ggp.base.util.prover.aima.AimaProver

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.