Examples of GdlConstant


Examples of org.ggp.base.util.gdl.grammar.GdlConstant

    {
      return function;
    }
    else
    {
      GdlConstant name = substituteConstant(function.getName(), theta);

      List<GdlTerm> body = new ArrayList<GdlTerm>();
      for (int i = 0; i < function.arity(); i++)
      {
        body.add(substituteTerm(function.get(i), theta));
View Full Code Here

Examples of org.ggp.base.util.gdl.grammar.GdlConstant

    {
      return relation;
    }
    else
    {
      GdlConstant name = substituteConstant(relation.getName(), theta);

      List<GdlTerm> body = new ArrayList<GdlTerm>();
      for (int i = 0; i < relation.arity(); i++)
      {
        body.add(substituteTerm(relation.get(i), theta));
View Full Code Here

Examples of org.ggp.base.util.gdl.grammar.GdlConstant

    SymbolList arg3 = (SymbolList) list.get(3);
    SymbolAtom arg4 = (SymbolAtom) list.get(4);
    SymbolAtom arg5 = (SymbolAtom) list.get(5);

    String matchId = arg1.getValue();
    GdlConstant roleName = (GdlConstant) GdlFactory.createTerm(arg2);
    String theRulesheet = arg3.toString();
    int startClock = Integer.valueOf(arg4.getValue());
    int playClock = Integer.valueOf(arg5.getValue());

    // For now, there are only five standard arguments. If there are any
View Full Code Here

Examples of org.ggp.base.util.gdl.grammar.GdlConstant

    public void testProverOnTicTacToe() throws Exception {
        List<Gdl> ticTacToeDesc = new TestGameRepository().getGame("ticTacToe").getRules();
        sm.initialize(ticTacToeDesc);
        MachineState state = sm.getInitialState();
        assertFalse(sm.isTerminal(state));
        GdlConstant X_PLAYER = GdlPool.getConstant("xplayer");
        GdlConstant O_PLAYER = GdlPool.getConstant("oplayer");
        Role xRole = new Role(X_PLAYER);
        Role oRole = new Role(O_PLAYER);
        List<Role> roles = Arrays.asList(xRole, oRole);
        assertEquals(roles, sm.getRoles());
View Full Code Here

Examples of org.ggp.base.util.gdl.grammar.GdlConstant

        assertEquals(Collections.singletonList(100), sm.getGoals(state));
    }

    protected Move move(String description) {
        String[] parts = description.split(" ");
        GdlConstant head = GdlPool.getConstant(parts[0]);
        if(parts.length == 1)
            return new Move(head);
        List<GdlTerm> body = new ArrayList<GdlTerm>();
        for(int i = 1; i < parts.length; i++) {
            body.add(GdlPool.getConstant(parts[i]));
View Full Code Here

Examples of org.ggp.base.util.gdl.grammar.GdlConstant

    //"or" in them, especially if ors are nested. For best results, deOR
    //before testing.
    //The restriction goes something like this:
    //Look at all the terms in each positive relation in the rule that
    // is in a cycle with the head.
    GdlConstant head = rule.getHead().getName();
    Set<GdlRelation> cyclicRelations = new HashSet<GdlRelation>();
    Set<GdlRelation> acyclicRelations = new HashSet<GdlRelation>();
    for(GdlLiteral literal : rule.getBody()) {
      //Is it a relation?
      if(literal instanceof GdlRelation) {
View Full Code Here

Examples of org.ggp.base.util.gdl.grammar.GdlConstant

  private static SetMultimap<GdlConstant, GdlConstant> getDependencyGraphAndValidateNoNegativeCycles(
      Set<GdlConstant> relationNames, List<GdlRule> rules) throws ValidatorException {
    SetMultimap<GdlConstant, GdlConstant> dependencyGraph = HashMultimap.create();
    SetMultimap<GdlConstant, GdlConstant> negativeEdges = HashMultimap.create();
    for(GdlRule rule : rules) {
      GdlConstant headName = rule.getHead().getName();
      for(GdlLiteral literal : rule.getBody()) {
        addLiteralAsDependent(literal, dependencyGraph.get(headName), negativeEdges.get(headName));
      }
    }
View Full Code Here

Examples of org.ggp.base.util.gdl.grammar.GdlConstant

      SetMultimap<GdlConstant, GdlConstant> dependencyGraph,
      SetMultimap<GdlConstant, GdlConstant> negativeEdges,
      Set<GdlConstant> allNames) throws ValidatorException {
    while(!negativeEdges.isEmpty()) {
      //Look for a cycle containing this edge
      GdlConstant tail = negativeEdges.keySet().iterator().next();
      Set<GdlConstant> heads = negativeEdges.get(tail);
      negativeEdges.removeAll(tail);

      for(GdlConstant head : heads) {
        Set<GdlConstant> upstreamNames =
View Full Code Here

Examples of org.ggp.base.util.gdl.grammar.GdlConstant

    return GdlPool.getDistinct(arg1, arg2);
  }

  private static GdlFunction createFunction(SymbolList list)
  {
    GdlConstant name = createConstant((SymbolAtom) list.get(0));

    List<GdlTerm> body = new ArrayList<GdlTerm>();
    for (int i = 1; i < list.size(); i++)
    {
      body.add(createTerm(list.get(i)));
View Full Code Here

Examples of org.ggp.base.util.gdl.grammar.GdlConstant

    return GdlPool.getProposition(createConstant(atom));
  }

  private static GdlRelation createRelation(SymbolList list)
  {
    GdlConstant name = createConstant((SymbolAtom) list.get(0));

    List<GdlTerm> body = new ArrayList<GdlTerm>();
    for (int i = 1; i < list.size(); i++)
    {
      body.add(createTerm(list.get(i)));
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.