Package graphplan.domain

Examples of graphplan.domain.Operator


  @Test
  public void testAddGraphLevel() {
    logger.info("Testing addition of action level");
    ActionLevel actionLevel = new ActionLevel();
    Operator operator = null;
    try {
      operator = OperatorFactory.getInstance().getOperator(
          "move(a,b)");
    } catch (Exception e) {
      fail(e.toString());
View Full Code Here


    //Find a way to write this to DOT
    writer.println("subgraph cluster_action"+actionLevel.getIndex()+" {");
    String comment = "Action Level "+actionLevel.getIndex();
    writer.println("label=\""+comment+"\";");
    for (Iterator<Operator> iter = actionLevel.getActions(); iter.hasNext();) {
      Operator operator = iter.next();
     
      String label = operator.getSignature();
      String id = actionLevel.getIndex()+label;
      this.createNode(id, label,"box");
     
      for(Iterator<Proposition> iterPre = operator.getPreconds().iterator(); iterPre.hasNext(); ){
        Proposition prop = iterPre.next();
        String target = (actionLevel.getIndex()-1)+prop.getSignature();
        createEdge(id, target);
      }
     
      for(Iterator<Proposition> iterEff = operator.getEffects().iterator(); iterEff.hasNext(); ){
        Proposition prop = iterEff.next();
        String target = (actionLevel.getIndex()+1)+prop.getSignature();
        createEdge(id, target);
      }
    }
View Full Code Here

    Proposition proposition2 = PropositionFactory.getInstance()
        .getProposition("~at(a)");
    initialState.addProposition(proposition2);

    OperatorFactory operatorFactory = OperatorFactory.getInstance();
    Operator operTemplate = operatorFactory.createOperatorTemplate("move(A,B)",
        new String[] { "~at(B)", "at(A)" },
        new String[] { "at(B)", "~at(A)" });
   
    operatorFactory.addOperatorTemplate(operTemplate);
   
    planningGraph = new PlanningGraph(initialState);
   
    ActionLevel actionLevel = new ActionLevel();
    Operator operator = null;
    try {
      operator = OperatorFactory.getInstance().getOperator(
          "move(a,b)");
    } catch (Exception e) {
      fail(e.toString());
View Full Code Here

    }
  }
 
  public void setIndexForOperators(ActionLevel actionLevel){
    for (Iterator<Operator> it = actionLevel.iterator(); it.hasNext();) {
      Operator op = it.next();
      if(!this.operators.contains(op)){
        op.setIndex(actionLevel.getIndex());
        this.operators.add(op);
      } else op.setIndex(this.operators.ceiling(op).getIndex());
    }
  }
View Full Code Here

      if(planFound) this.supportActionStack.push(operators);
    } else {
      List<Operator> resolvers = actionLevel.getGeneratingActions(this.popGoal(subGoals));
      resolvers = this.andNotMutexes(resolvers, mutex);
      while(!resolvers.isEmpty() && !planFound){
        Operator resolver = this.popResolver(resolvers);
        Set<Operator> newOperators = new HashSet<Operator>(operators);
        newOperators.add(resolver);
        List<Proposition> newSubGoals = this.getSubGoals(resolver, subGoals);
        Set<Operator> newMutex = new HashSet<Operator>(mutex);
        if(actionLevel.getMutexes().get(resolver) != null) newMutex.addAll(actionLevel.getMutexes().get(resolver));
View Full Code Here

    Proposition p = subGoals.get(0);
    return p;
  }
 
  private Operator popResolver(List<Operator> resolvers){
    Operator op = resolvers.remove(0);
    return op;
  }
View Full Code Here

TOP

Related Classes of graphplan.domain.Operator

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.