Package javaff.planning

Examples of javaff.planning.State


    // ********************************

    // Get the initial state
    TemporalMetricState initialState = ground.getTemporalMetricInitialState();
   
                State goalState = goalState = performFFSearch(initialState);
               
    long afterPlanning = System.currentTimeMillis();

                TotalOrderPlan top = null;
    if (goalState != null) top = (TotalOrderPlan) goalState.getSolution();
    if (top != null) top.print(planOutput);


    /*javaff.planning.PlanningGraph pg = initialState.getRPG();
    Plan plan  = pg.getPlan(initialState);
View Full Code Here


  EnforcedHillClimbingSearch EHCS = new EnforcedHillClimbingSearch(initialState);
 
  EHCS.setFilter(HelpfulFilter.getInstance()); // and use the helpful actions neighbourhood
 
  // Try and find a plan using EHC
  State goalState = EHCS.search();

  if (goalState == null) // if we can't find one
  {
    infoOutput.println("EHC failed, using best-first search, with all actions");
   
View Full Code Here

    return (State) ((LinkedList) open).removeFirst();
  }
 
  public boolean needToVisit(State s) {
    Integer Shash = new Integer(s.hashCode()); // compute hash for state
    State D = (State) closed.get(Shash); // see if its on the closed list
   
    if (closed.containsKey(Shash) && D.equals(s)) return false// if it is return false
   
    closed.put(Shash, s); // otherwise put it on
    return true; // and return true
  }
View Full Code Here

    javaff.JavaFF.infoOutput.println(bestHValue);
   
    while (!open.isEmpty()) // whilst still states to consider
   
      State s = removeNext(); // get the next one
     
      Set successors = s.getNextStates(filter.getActions(s)); // and find its neighbourhood
     
      Iterator succItr = successors.iterator();     
   
      while (succItr.hasNext()) {
        State succ = (State) succItr.next(); // next successor
     
        if (needToVisit(succ)) {
          if (succ.goalReached()) { // if we've found a goal state - return it as the solution
            return succ;
          } else if (succ.getHValue().compareTo(bestHValue) < 0) {
            // if we've found a state with a better heuristic value than the best seen so far
         
            bestHValue = succ.getHValue(); // note the new best avlue
            javaff.JavaFF.infoOutput.println(bestHValue);
            open = new LinkedList(); // clear the open list
            open.add(succ); // put this on it
            break; // and skip looking at the other successors
          } else {
View Full Code Here

    return (State) ((LinkedList) open).removeFirst();
  }
 
  public boolean needToVisit(State s) {
    Integer Shash = new Integer(s.hashCode());
    State D = (State) closed.get(Shash);
   
    if (closed.containsKey(Shash) && D.equals(s)) return false;
   
    closed.put(Shash, s);
    return true;
  }
View Full Code Here

   
    open.add(start);

    while (!open.isEmpty())
    {
      State s = removeNext();
      if (needToVisit(s)) {
        ++nodeCount;
        if (s.goalReached()) {
          return s;
        } else {
          updateOpen(s);
        }
      }
View Full Code Here

  public int compare(Object obj1, Object obj2)
    {
    int r = 0;
    if ((obj1 instanceof State) && (obj2 instanceof State))
    {
      State s1 = (State) obj1;
      State s2 = (State) obj2;
      BigDecimal d1 = s1.getHValue();
      BigDecimal d2 = s2.getHValue();
      r = d1.compareTo(d2);
      if (r == 0)
      {
        d1 = s1.getGValue();
        d2 = s2.getGValue();
        r = d1.compareTo(d2);
        if (r == 0)
        {
          if (s1.hashCode() > s2.hashCode()) r = 1;
          else if (s1.hashCode() == s2.hashCode() && s1.equals(s2)) r=0;
          else r = -1;
        }
      }
    }
    return r;
View Full Code Here

    open.addAll(S.getNextStates(filter.getActions(S)));
  }

  public State removeNext()
    {
    State S = (State) ((TreeSet) open).first();
    open.remove(S);
                /*
                System.out.println("================================");
    S.getSolution().print(System.out);
    System.out.println("----Helpful Actions-------------");
View Full Code Here

    return S;
  }

  public boolean needToVisit(State s) {
    Integer Shash = new Integer(s.hashCode());
    State D = (State) closed.get(Shash);
   
    if (closed.containsKey(Shash) && D.equals(s)) return false;
   
    closed.put(Shash, s);
    return true;
  }
View Full Code Here

   
    open.add(start);

    while (!open.isEmpty())
    {
      State s = removeNext();
      if (needToVisit(s)) {
        ++nodeCount;
        if (s.goalReached()) {
          return s;
        } else {
          updateOpen(s);
        }
      }
View Full Code Here

TOP

Related Classes of javaff.planning.State

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.