Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ix.iplan
Interface Planner

All Known Implementing Classes:
  FilteredPlanner, IPlanOptionManager.ModelHolder, PlannerBase, Slip, Thatcher

    public interface Planner

Planner / planning algorithm. This interface provides a standard way to use a planner from within Java. One way to create a planner is to call the static `IPlan.makeDefaultPlanner()` method. A convenient way to use a planner (created by thet method) from outside Java is to use the class `FilePlanner` as a main program. Here is how a planner might be used in Java:

       import ix.icore.plan.Plan;
       import ix.icore.domain.Domain;
       import ix.iplan.IPlan;
       import ix.iplan.Planner;
       import ix.iplan.NoPlanException;

       ...

       Planner planner = IPlan.makeDefaultPlanner();
       planner.setDomain(...);
       planner.loadPlan(...);
       try {
           planner.plan();
           Plan plan = planner.getPlan();
           while (!isGoodEnoughPlan(plan)) {
               planner.replan();
               plan = planner.getPlan();
           }
       }
       catch (NoPlanException e) {
           ...
       }

Method Summary
`Plan` | `getPlan()` Returns this planner's current plan.
`PlanStats` | `getStatistics()` Returns statistics gathered by the most recent `plan()` or `replan()`.
`void` | `loadPlan(Plan plan)` Adds the contents of the specified plan to this planner's current plan.
`void` | `plan()` Finds a plan that is a completion of this planner's current plan and makes it the new current plan.
`void` | `replan()` Finds the next in a series of plans that are completions of the plan that was current when `plan()` was most recently called.
`void` | `setDomain(Domain domain)` Sets this planner's domain.

Method Detail

### setDomain

    void setDomain(Domain domain)

  Sets this planner's domain. This is normally done before plan() or replan() are called. The consequences of calling this method at other times are unspecified.

### loadPlan

    void loadPlan(Plan plan)

  Adds the contents of the specified plan to this planner's current plan. This is normally done before plan() or replan() are called. If it is done later, it should be followed by a call to plan() rather than to replan(). The consequences of calling this method at other times are unspecified.

### plan

    void plan()

  Finds a plan that is a completion of this planner's current plan and makes it the new current plan. The precise meaning of "completion" depends on the planner in question, but typically it will mean that all activities in the initial plan that might be expanded into subactions, using refinements in this planner's domain, will be expanded, and that all constraints in the initial plan or introduced by expansion would be satisfied if the plan were executed in a way that respected all of the ordering constraints. (Here, the initial plan is the plan that was current when plan() was called.)

  A successful call to plan() leaves this planner in a state in which `replan()` can be called.

  Throws:
    `NoPlanException` - if no plan can be found by this planner.

### replan

    void replan()

  Finds the next in a series of plans that are completions of the plan that was current when `plan()` was most recently called. That completion then becomes the new current plan. You can think of this as reconsidering some choice made when producing earlier plans in the sequence and making different decision at that point. However, it is not guaranteed that the plan found in this way will be interestingly different from all of the earlier plans in the sequence.

  The replan() method should not be called if plan() has not been called or if this planner has thrown an exception.

  A successful call to replan() leaves this planner in a state in which `replan()` can be called again. plan() may be called instead, but this will begin a new sequence of plans based on this planner's now current plan, rather than on the plan that was the base for the previous sequence.

  Throws:
    `NoPlanException` - if no new plan can be found by this planner.

### getPlan

    Plan getPlan()

  Returns this planner's current plan. This value is well-defined only if this planner has not thrown an exception.

### getStatistics

    PlanStats getStatistics()

  Returns statistics gathered by the most recent `plan()` or `replan()`.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD