Package graphplan.domain

Examples of graphplan.domain.DomainDescription


  public static GraphplanTestUtil getInstance() {
    return singleton;
  }

  public DomainDescription []createDomains() {
    DomainDescription domains[] = new DomainDescription[3];
   
    String propositions[] = null;
    List<Proposition> initialState = null;
    List<Proposition> goalState = null;
    List<Operator> operators = null;
    // The dinner date domain
    propositions = new String[] {"garbage","cleanHands","quiet"};
    initialState = Arrays.asList(propositionFactory.getPropositions(propositions));
   
    propositions = new String[] {"dinner","present","~garbage"};
    goalState = Arrays.asList(propositionFactory.getPropositions(propositions));
   
    operators = new ArrayList<Operator>(4);
    operators.add(operatorFactory.createOperatorTemplate("cook",
                    new String[] {"cleanHands"},
                    new String[] {"dinner"}));
   
    operators.add(operatorFactory.createOperatorTemplate("wrap",
        new String[] {"quiet"},
        new String[] {"present"}));
 
    operators.add(operatorFactory.createOperatorTemplate("carry",
        new String[] {},
        new String[] {"~cleanHands", "~garbage"}));
   
    operators.add(operatorFactory.createOperatorTemplate("dolly",
        new String[] {},
        new String[] {"~quiet", "~garbage"}));
   
    domains[0] = new DomainDescription(operators, initialState, goalState);
   
    // The production cell domain
    propositions = new String[] {"procUnit(procUnit1)", "procUnit(procUnit2)",
                     "procUnit(procUnit3)", "procUnit(procUnit4)",
                     "device(procUnit1)", "device(procUnit2)",
                     "device(procUnit3)", "device(procUnit4)",
                     "device(depositBelt)", "device(feedBelt)",
                     "empty(procUnit1)", "empty(procUnit2)",
                     "empty(procUnit3)", "empty(procUnit4)",
                     "empty(depositBelt)", "empty(feedBelt)",
                     "block(block1)","over(block1,procUnit1)"};
    initialState = Arrays.asList(propositionFactory.getPropositions(propositions));
   
    propositions = new String[] {"processed(block1,procUnit2)", "processed(block1,procUnit4)",
                   "finished(block1)"};
    goalState = Arrays.asList(propositionFactory.getPropositions(propositions));
   
    operators = new ArrayList<Operator>(3);
   
    operators.add(operatorFactory.createOperatorTemplate("process(Block,ProcUnit)",
            new String[] {"block(Block)", "procUnit(ProcUnit)",
                    "over(Block, ProcUnit)"},
            new String[] {"processed(Block, ProcUnit)"}));
   
    operators.add(operatorFactory.createOperatorTemplate("consume(Block)",
        new String[] {"block(Block)", "over(Block, depositBelt)"},
        new String[] {"~over(Block, depositBelt)","empty(depositBelt)",
                "finished(Block)"}));
   
    operators.add(operatorFactory.createOperatorTemplate("move(Block,Device1,Device2)",
        new String[] {"block(Block)", "empty(Device2)",
                "over(Block, Device1)", "device(Device2)",
                "device(Device1)"},
        new String[] {"over(Block, Device2)", "~over(Block, Device1)",
                "~empty(Device2)", "empty(Device1)"}));
   
    domains[1] = new DomainDescription(operators, initialState, goalState);
   
    // A larger variation of the production cell domain
    propositions = new String[] {"procUnit(procUnit1)", "procUnit(procUnit2)",
           "procUnit(procUnit3)", "procUnit(procUnit4)",
           "device(procUnit1)", "device(procUnit2)",
           "device(procUnit3)", "device(procUnit4)",
           "device(depositBelt)", "device(feedBelt)",
           "empty(procUnit1)", "empty(procUnit2)",
           "empty(procUnit3)", "empty(procUnit4)",
           "empty(depositBelt)", "empty(feedBelt)",
           "block(block1)","over(block1,procUnit1)",
           "block(block2)","over(block2,procUnit2)"};
    initialState = Arrays.asList(propositionFactory.getPropositions(propositions));
    domains[2] = new DomainDescription(operators, initialState, goalState);
   
    return domains;
  }
View Full Code Here


    }
  }
 
  public void testPlan() {
    GraphplanTestUtil util = GraphplanTestUtil.getInstance();
    DomainDescription domainDescriptions[] = util.createDomains();
     
    PlanResult planResult = null;
    try {
      graphplan.setMaxLevels(6);
      planResult = graphplan.plan(domainDescriptions[0]);
View Full Code Here

   
    assertTrue(planResult.isTrue());
  }

  public void testGetPlanPreconditions() {
    DomainDescription description = new DomainDescription(operators, Arrays.asList(new Proposition[] {}), Arrays.asList(new Proposition[] {}));
    String plan[] = new String[] {"move(b1,pu1,pu2)",
                  "process(b1,pu2)",
                  "move(b1,pu2,pu3)"};
   
    List<Proposition> planPreconds = graphplan.getPlanPreconditions(Arrays.asList(plan), description);
View Full Code Here

      argsOk = (operators != null) && (problem != null);
    }
   
    if(argsOk) {
      long t1 = System.currentTimeMillis();
      DomainDescription domain = null;
      try {
        if(pddl){
          logger.finest("JavaGP - PDDL\n");
          logger.finest("+ DOMAIN: " + domainFilename);
          logger.finest("+ PROBLEM: " + problemFilename);
View Full Code Here

  @Test
  public void testParseProblemFileFile() {
    File operators = new File(OPERATORS_FILE);
    File problem = new File(PROBLEM_FILE);
   
    DomainDescription domainDescription = null;
   
    try {
      domainDescription = plannerParser.parseProblem(operators, problem);
    } catch (FileNotFoundException e) {
      fail(e.toString());
View Full Code Here

      problemStream = new FileInputStream(PROBLEM_FILE);
    } catch (FileNotFoundException e) {
      fail(e.toString());
    }
   
    DomainDescription domainDescription = null;
   
    try {
      domainDescription = plannerParser.parseProblem(operatorStream, problemStream);
    } catch (ParseException e) {
      fail(e.toString());
View Full Code Here

  }

  @Test
  public void testGetAllPossibleInstantiations() {
    GraphplanTestUtil util = GraphplanTestUtil.getInstance();
    DomainDescription domainDescriptions[] = util.createDomains();
    operatorFactory.resetOperatorTemplates();
   
    for(Operator operator : domainDescriptions[1].getOperators()) {
      try {
        operatorFactory.addOperatorTemplate(operator);
View Full Code Here

      logger.finest(this.pddlObject.getGoal().toString());

      goalState.addAll(this.getPropositionFromProblemExp(this.pddlObject.getGoal()));

      logger.finest("\nPDDL Parser\n");
      DomainDescription domainDescription = new DomainDescription(operators, initialState, goalState, this.types, this.parameterTypes, negativePreconditions);
      return domainDescription;
    }
   
    return null;
  }
View Full Code Here

TOP

Related Classes of graphplan.domain.DomainDescription

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.