Examples of PlanningGraph


Examples of graphplan.graph.planning.PlanningGraph

      logger.fine("OPTIMIZATION: JavaGP using Types");
      //If domain has negative preconditions, the planner will use the closed world assumption
      if(domainDescription.isNegativePreconditions()) {
        logger.fine("OPTIMIZATION: JavaGP using Closed World Assumption (Lazily)");
        this.planningGraph = new PlanningGraphClosedWorldAssumption(initialLevel, domainDescription.getTypes(), domainDescription.getParameterTypes(), new StaticMutexesTable(new ArrayList<Operator>(domainDescription.getOperators())));
      } else this.planningGraph = new PlanningGraph(initialLevel, domainDescription.getTypes(), domainDescription.getParameterTypes(), new StaticMutexesTable(new ArrayList<Operator>(domainDescription.getOperators())));
    } else this.planningGraph = new PlanningGraph(initialLevel, new StaticMutexesTable(new ArrayList<Operator>(domainDescription.getOperators())));
   
//    System.out.println();
   
    OperatorFactory.getInstance().resetOperatorTemplates();
   
View Full Code Here

Examples of graphplan.graph.planning.PlanningGraph

    PropositionLevel initialLevel = new PropositionLevel();
    initialLevel.addPropositions(domainDescription.getInitialState());
    this.solutionExtraction = new TimeoutSolutionExtractionVisitor(domainDescription.getGoalState());
    ((TimeoutSolutionExtractionVisitor)solutionExtraction).setTimeout(timeout);
   
    this.planningGraph = new PlanningGraph(initialLevel, new StaticMutexesTable(new ArrayList<Operator>(domainDescription.getOperators())));
    OperatorFactory.getInstance().resetOperatorTemplates();
   
    for(Operator operator:domainDescription.getOperators()) {
      OperatorFactory.getInstance().addOperatorTemplate(operator);
    }
View Full Code Here

Examples of graphplan.graph.planning.PlanningGraph

        e.printStackTrace();
      }
    }
   
    //Then Create the planning graph with an empty initial state
    PlanningGraph graph = new PlanningGraph(new PropositionLevel());
    //And populate it with action levels and proposition levels containing the obvious
    //preconditions from the subsequent action level
    for (int i = 0; i < concreteOperators.length; i++) {
      //We always assume our graph has a proposition level as its last level
      PropositionLevel propositionLevel = (PropositionLevel) graph.getGraphLevel(graph.size()-1);
      //into which we add the preconditions for this action
      propositionLevel.addPropositions(concreteOperators[i].getPreconds());
      //We then create an action level to contain this action
      ActionLevel actionLevel = new ActionLevel();
      actionLevel.addAction(concreteOperators[i]);
      graph.addGraphLevel(actionLevel);
      //And create another proposition level for its effects
      PropositionLevel propositionLevel2 = new PropositionLevel();
      propositionLevel2.addPropositions(concreteOperators[i].getEffects());
     
      graph.addGraphLevel(propositionLevel2);
    }
   
    //Then walk the graph backwards propagating the preconditions that were not generated
    //by the previous action level using noops
    for(int i = graph.size()-1; i > 0; i=i-2) {
      //We need to get the proposition levels surrounding our action level
      //As in: precond <- action <- effect
      PropositionLevel effectLevel = (PropositionLevel) graph.getGraphLevel(i);
      PropositionLevel precondLevel = (PropositionLevel) graph.getGraphLevel(i-2);
      ActionLevel actionLevel = (ActionLevel) graph.getGraphLevel(i-1);
      //Then see if each proposition in the effectLevel is connected by some action
      //to the precondLevel
      for (Iterator<Proposition> iter = effectLevel.getPropositions(); iter.hasNext();) {
        Proposition proposition = iter.next();
        //If no action is connected to the effect level
        if(actionLevel.getGeneratingActions(proposition).size() == 0) {
          //We need to propagate this action to the previous level
          actionLevel.addNoop(proposition);
          precondLevel.addProposition(proposition);
        }
      }
    }
   
    //this last bit looks rather nasty, I should review this when time allows
    PropositionLevel level = (PropositionLevel) graph.getGraphLevel(0);
    List<Proposition> planPreconditions = new ArrayList<Proposition>(level.size());
   
    for (Iterator<Proposition> iter = level.getPropositions(); iter.hasNext();) {
      planPreconditions.add(iter.next());
    }
View Full Code Here

Examples of graphplan.graph.planning.PlanningGraph

  }

  @SuppressWarnings("unchecked")
  public boolean visitElement(GraphElement element) {
    if(element instanceof PlanningGraph) {
      PlanningGraph planningGraph = (PlanningGraph) element;
      for (int i=0; i<planningGraph.size(); i++) {
        this.visitGraphLevel(planningGraph.getGraphLevel(i));
      }
    }
    return true;
  }
View Full Code Here

Examples of graphplan.graph.planning.PlanningGraph

  }

  @SuppressWarnings("unchecked")
  public boolean visitElement(GraphElement element) {
    if(element instanceof PlanningGraph) {
      PlanningGraph planningGraph = (PlanningGraph) element;
      for (int i=0; i<planningGraph.size(); i++) {
        this.visitGraphLevel(planningGraph.getGraphLevel(i));
      }
    }
    return true;
  }
View Full Code Here

Examples of graphplan.graph.planning.PlanningGraph

    supportActionStack = new Stack<Set<Operator>>();
  }

  public boolean visitElement(GraphElement element) {
    if(element instanceof PlanningGraph) {
      PlanningGraph planningGraph = (PlanningGraph) element;
      //TODO implement the actual iteration over the graph
      if(planningGraph.getLastGraphLevel().isPropositionLevel()) {
        subGoalStack.clear();
        supportActionStack.clear();
        subGoalStack.push(new TreeSet<Proposition>(goals));
       
        /*TextDrawVisitor visitor = new TextDrawVisitor();
        planningGraph.accept(visitor);
        logger.fine("Planning Graph is:");
        logger.fine(visitor.toString());*/
       
        if(planningGraph.getLastGraphLevel().accept(this)) {
          planResult = new PlanResult(this.supportActionStack);
        } else {
          planResult = new PlanResult(false);
        }
       
View Full Code Here

Examples of graphplan.graph.planning.PlanningGraph

  }

  @SuppressWarnings("unchecked")
  public boolean visitElement(GraphElement element) {
    if(element instanceof PlanningGraph) {
      PlanningGraph planningGraph = (PlanningGraph) element;
      for (int i=0; i<planningGraph.size(); i++) {
        this.visitGraphLevel(planningGraph.getGraphLevel(i));
      }
    }
    return true;
  }
View Full Code Here

Examples of graphplan.graph.planning.PlanningGraph

  protected Document document;
 

  public boolean visitElement(GraphElement element) {
    if(element instanceof PlanningGraph) {
      PlanningGraph planningGraph = (PlanningGraph) element;
      DocumentBuilder builder;
      try {
        builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
      } catch (ParserConfigurationException e) {
        e.printStackTrace();
View Full Code Here

Examples of graphplan.graph.planning.PlanningGraph

  @Before
  public void setUp() throws Exception {
    propositionFactory = PropositionFactory.getInstance();
   
    planningGraph = new PlanningGraph();

    initialState = new PropositionLevel();
   
    operatorFactory = OperatorFactory.getInstance();
    Operator operTemplate = operatorFactory.createOperatorTemplate("move(A,B)",
View Full Code Here

Examples of graphplan.graph.planning.PlanningGraph

        } catch (OperatorFactoryException e) {
          fail(e.getMessage());
        }
      }
     
      planningGraph = new PlanningGraph(level);
      visitor.reset();
      planningGraph.accept(visitor);
      logger.info("Initial Graph is: "+visitor.toString());
      logger.info("Expanding Graph...");
      planningGraph.expandGraph();
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.