Package graphplan.domain

Examples of graphplan.domain.Operator


  @Before
  public void setUp() throws Exception {
    graphplan = new Graphplan();
    operators = new ArrayList<Operator>();
    operatorFactory = OperatorFactory.getInstance();
    Operator o = operatorFactory.createOperatorTemplate("process(Block,ProcUnit)",
        new String[] {"over(Block,ProcUnit)"},
        new String[] {"processed(Block,ProcUnit)"});
    operators.add(o);
   
    o = operatorFactory.createOperatorTemplate("consume(Block)",
View Full Code Here


        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
   
    Operator concreteOperators[] = new Operator[plan.size()];
   
    //First, get operator instances corresponing to the operator invocations
    //in the parameter
    for (int i = 0; i < concreteOperators.length; i++) {
      try {
View Full Code Here

  public boolean visitActionLevel(ActionLevel actionLevel) {
    StringBuilder sbMutexes = new StringBuilder();
   
    sbOutput.append(" Action Level [");
    for(Iterator<Operator> iter = actionLevel.getActions(); iter.hasNext(); ) {
      Operator operator = iter.next();
      sbOutput.append(operator.toString());
      if(iter.hasNext()) {
        sbOutput.append(", ");
      }
      sbMutexes.append("   "+operator.toString()+": ");
      for(Iterator<Operator> j = actionLevel.getMutexes(operator); j.hasNext(); ) {
        Operator mutex = j.next();
        sbMutexes.append(mutex.toString());
        if(j.hasNext()) {
          sbMutexes.append(", ");
        }
      }
      sbMutexes.append(System.getProperty("line.separator"));
View Full Code Here

  @Override
  public void addActionMutexes(GraphLevel<Proposition> previousLevel, GraphLevel<Operator> actionLevel) {
    //For every action in this level
    for(Iterator<Operator> i=actionLevel.iterator(); i.hasNext();) {
      //Check every other operator for static mutexes
      Operator operator1 = i.next();
      for(Iterator<Operator> j=actionLevel.iterator(); j.hasNext(); ) {
        Operator operator2 = j.next();
        //for nested iterators, we check everything before the current
        //node, so if we hit the same operator twice, break
        if(operator1 == operator2) {
          break;
        }
View Full Code Here

   */
  public List<Operator> getRequiringActions(Proposition proposition) {
    List<Operator> requiringActions = new ArrayList<Operator>();
   
    for (Iterator<Operator> iter = actions.iterator(); iter.hasNext();) {
      Operator oper = iter.next();
      if(oper.getPreconds().contains(proposition)) {
        requiringActions.add(oper);
      }
    }
   
    return requiringActions;
View Full Code Here

      generatingActions = this.generatingActionsCache.get(proposition);
    } else {
      generatingActions = new ArrayList<Operator>();
     
      for (Iterator<Operator> iter = this.actions.iterator(); iter.hasNext();) {
        Operator oper = iter.next();
        if(oper.getEffects().contains(proposition)) {
          generatingActions.add(oper);
        }
      }
      /*Heuristic: select actions that appears latest in the planning graph*/
      if(Graphplan.operatorsLatest)
 
View Full Code Here

   * Adds a noop action to propagate the supplied proposition to the subsequent
   * proposition level.
   * @param proposition
   */
  public void addNoop(Proposition proposition) {
    Operator noop = OperatorFactory.getInstance().getNoop(proposition);
    this.addAction(noop);
  }
View Full Code Here

  public boolean visitActionLevel(ActionLevel actionLevel) {
    Comment comment = graphDoc.createComment("Action Level "+actionLevel.getIndex());
    graphElement.appendChild(comment);
    for (Iterator<Operator> iter = actionLevel.getActions(); iter.hasNext();) {
      Operator operator = iter.next();
     
      String label = operator.getSignature();
      String id = actionLevel.getIndex()+label;
     
      Element nodeElement = createNode(id, label);
      graphElement.appendChild(nodeElement);
     
      for(Iterator<Proposition> iterPre = operator.getPreconds().iterator(); iterPre.hasNext(); ){
        Proposition prop = iterPre.next();
        String target = (actionLevel.getIndex()-1)+prop.getSignature();
        Element edgeElement = createEdge(id, target);
        graphElement.appendChild(edgeElement);
      }
     
      for(Iterator<Proposition> iterEff = operator.getEffects().iterator(); iterEff.hasNext(); ){
        Proposition prop = iterEff.next();
        String target = (actionLevel.getIndex()+1)+prop.getSignature();
        Element edgeElement = createEdge(id, target);
        graphElement.appendChild(edgeElement);
      }
View Full Code Here

    planningGraph = new PlanningGraph();

    initialState = new PropositionLevel();
   
    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);
   
View Full Code Here

  }
 
  private void addLevels() {
    ActionLevel level = new ActionLevel();
    try {
      Operator op = operatorFactory.getOperator("move(a,b)");
      level.addAction(op);
      planningGraph.addGraphLevel(level);
    } catch (OperatorFactoryException e) {
      fail(e.toString());
    }
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.