zeus.actors
Class Planner

java.lang.Object
  extended byjava.util.Dictionary
      extended byjava.util.Hashtable
          extended byzeus.actors.PlanDb
              extended byzeus.actors.Planner
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class Planner
extends PlanDb

This component implements the agent's Planning and Scheduling mechanism. Its role is to construct action sequences that will achieve desired input goals. Hence the Planner is under the control of the Engine component, which initiates planning and manages the contracting of any subgoals that the agent cannot achieve.

Planning operators (actions or tasks) are represented in the classical fashion as primitive or summary operators. Primitive operators are defined in terms of their preconditions, effects, cost, duration and constraints and precondition order, while summary operators are defined in terms of a graph of existing primitive tasks.

The Planner utilises classical partial order means end planning in its plan construction process. So when given a goal the Planner searches its PlanDb for an operator with a public effect that unifies (with unification bindings q) with the desired_effect of the goal. If multiple operators are found, they are ranked by cost, and then by duration. Next, the Planner selects the first ranked operator, constrains its preconditions and effects with q, and then attempts to schedule the operator into its diary. If the operator cannot be scheduled, the Planner backtracks and re-peats the process with the next applicable operator.

Details on how the Planner functions are provided in the Zeus Technical Manual.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.Hashtable
 
Field Summary
protected  java.util.Hashtable BindTable
           
protected  AgentContext context
           
static int CREATE
           
static int DISPOSE
           
private  HSet[] eventMonitor
           
static boolean EXPAND
           
static int FAIL
           
protected  int now
           
static int PLAN
           
protected  int plannerLength
           
protected  int plannerWidth
           
static int REPLAN
           
static int START
           
static int STATE_CHANGE
           
static int SUCCEED
           
protected  PlanRecord[][] table
          This object stores the Planner's diary as is a two-dimensional array, with time on one dimension and processors on another.
protected  boolean user_responded
           
protected  long USER_TIME_OUT
           
 
Fields inherited from class java.util.Hashtable
 
Constructor Summary
Planner()
           
Planner(AgentContext context, int plannerWidth, int plannerLength)
           
 
Method Summary
 void addPlanningMonitor(PlanningMonitor monitor, long type)
          Use a PlanningMonitor if your code needs to react to changes in the Planner
 void addPlanStepMonitor(PlanStepMonitor monitor, long type)
           
 void addPlanStepMonitor(PlanStepMonitor monitor, long type, boolean notify_previous)
          Use a PlanStepMonitor if your code needs to react to state changes in a particular plan
protected  void addToExternal(java.util.Vector List, Goal goal)
           
(package private)  int anySideEffect(Fact desc, PlanRecord rec, int position, int required)
           
(package private)  int anySideEffect(Fact desc, PlanRecord rec, java.lang.Object precond, int required)
           
protected  void assignCell(int proc, int t, PlanRecord rec)
           
 java.util.Vector bind(java.util.Vector goals)
           
 BindResults bind(java.util.Vector goals, java.util.Vector input, int mode)
           
protected  void book(int type, Goal goal, java.util.Vector rootSet)
           
 void book(int type, java.util.Vector goals, java.util.Vector records)
           
 PlannerQueryStruct canAchieve(java.util.Vector goals, java.lang.String key)
           
 void checkRecords()
          start Firmly booked tasks & cancel Tentatively booked ones 1.3 - promoted to public // synched ?
 PlannerQueryStruct clear_bind(java.util.Vector goals)
           
 PlannerEnactStruct enact(Goal goal, Goal sla)
           
(package private)  void executeEarliest()
           
(package private)  void executeEarliest(PlanRecord rec)
           
(package private)  java.util.Vector expand_summary(Decomposition decomposition, PlannerQueryStruct struct, boolean mode)
           
 void failParentOf(Goal g)
           
 void failParentOf(java.util.Vector goals)
           
(package private)  void freeCell(int proc, int t)
           
(package private)  void freeCells(int proc, int s, int e)
           
 AgentContext getAgentContext()
           
 int getPlannerLength()
           
 int getPlannerWidth()
           
 void goalConfirmed(java.util.Vector original_goals, java.util.Vector confirmed_goals, java.util.Vector selection)
           
(package private)  boolean incrementProcessorTime(PlanRecord rec, int time)
           
protected  void index(PlannerQueryStruct Results)
           
protected  boolean isFreeCell(int proc, int t)
           
(package private)  int latestConfirmTime(Goal goal)
           
(package private)  int latestConfirmTime(java.util.Vector goals)
           
protected  boolean loopFound(java.util.Vector goals)
           
protected  java.lang.String makeIndex(java.util.Vector goals)
           
(package private)  void notifyMonitors(Goal goal, int event_type, int sub_type)
           
(package private)  void notifyMonitors(PlanRecord record, int type)
           
 void notifyReceived(Fact f1, java.lang.String goalId, java.lang.String subgoalId)
           
protected  double now()
          now introduced to prevent the need for a call back to the context object to get timeing - decouples the Planner a bit..
 void reconfirmParentOf(Goal g)
           
 void reconfirmParentOf(java.util.Vector goals)
           
 Goal recreateSubgoal(Goal goal)
           
protected  void reject(Goal goal, java.util.Vector rootSet)
           
 void reject(java.util.Vector goals, java.util.Vector records)
           
protected  void removeFromIndexTable(java.util.Vector goals)
           
 void removePlanningMonitor(PlanningMonitor monitor, long type)
           
 void removePlanStepMonitor(PlanStepMonitor monitor, long type)
           
 void reset_bind(java.util.Vector goals, PlannerQueryStruct data)
           
protected  void resume_planning(DelegationStruct[] ds, PlannerQueryStruct struct)
           
protected  java.util.Vector schedule_children(java.lang.String key, PlanRecord rec, java.util.Vector path, PlannerQueryStruct struct, boolean mode)
           
(package private)  java.util.Vector schedule_primitive(java.lang.String key, PlanRecord parent, java.util.Vector path, Goal goal, java.util.Vector tasks, PlannerQueryStruct struct, boolean mode)
           
(package private)  java.util.Vector schedule_summary(java.lang.String key, PlanRecord parent, java.util.Vector path, Goal goal, java.util.Vector tasks, PlannerQueryStruct struct, boolean mode)
           
(package private)  java.util.Vector schedule(java.lang.String key, PlanRecord parent, java.util.Vector path, Goal goal, PlannerQueryStruct struct, boolean mode)
           
(package private)  java.util.Vector schedule(java.lang.String key, PlanRecord parent, java.util.Vector path, Goal goal, java.util.Vector tasks, PlannerQueryStruct struct, boolean mode)
           
(package private)  java.util.Vector schedule(java.lang.String key, PlanRecord parent, java.util.Vector path, java.util.Vector goals, PlannerQueryStruct struct, boolean mode)
           
 void shuffle()
          1.3 promoted to public - used to decide which job to execute
(package private)  void softFailParentOf(java.util.Vector goals, PlannerQueryStruct struct, int mode)
           
protected  java.util.Vector sortFeasible(java.lang.String gid, java.util.Vector input)
           
 void userResponded()
           
protected  boolean validProc(int proc)
           
protected  boolean validTime(int t)
           
 
Methods inherited from class zeus.actors.PlanDb
add, add, containsRecord, del, del, lookUp, lookUp
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

eventMonitor

private HSet[] eventMonitor

START

public static final int START
See Also:
Constant Field Values

FAIL

public static final int FAIL
See Also:
Constant Field Values

SUCCEED

public static final int SUCCEED
See Also:
Constant Field Values

CREATE

public static final int CREATE
See Also:
Constant Field Values

DISPOSE

public static final int DISPOSE
See Also:
Constant Field Values

STATE_CHANGE

public static final int STATE_CHANGE
See Also:
Constant Field Values

EXPAND

public static final boolean EXPAND
See Also:
Constant Field Values

REPLAN

public static final int REPLAN
See Also:
Constant Field Values

PLAN

public static final int PLAN
See Also:
Constant Field Values

table

protected PlanRecord[][] table
This object stores the Planner's diary as is a two-dimensional array, with time on one dimension and processors on another.


plannerWidth

protected int plannerWidth

plannerLength

protected int plannerLength

now

protected int now

BindTable

protected java.util.Hashtable BindTable

user_responded

protected boolean user_responded

USER_TIME_OUT

protected long USER_TIME_OUT

context

protected AgentContext context
Constructor Detail

Planner

public Planner()

Planner

public Planner(AgentContext context,
               int plannerWidth,
               int plannerLength)
Method Detail

getAgentContext

public AgentContext getAgentContext()

getPlannerWidth

public int getPlannerWidth()

getPlannerLength

public int getPlannerLength()

anySideEffect

int anySideEffect(Fact desc,
                  PlanRecord rec,
                  int position,
                  int required)

anySideEffect

int anySideEffect(Fact desc,
                  PlanRecord rec,
                  java.lang.Object precond,
                  int required)

canAchieve

public PlannerQueryStruct canAchieve(java.util.Vector goals,
                                     java.lang.String key)

loopFound

protected boolean loopFound(java.util.Vector goals)

clear_bind

public PlannerQueryStruct clear_bind(java.util.Vector goals)

reset_bind

public void reset_bind(java.util.Vector goals,
                       PlannerQueryStruct data)

bind

public java.util.Vector bind(java.util.Vector goals)

userResponded

public void userResponded()

bind

public BindResults bind(java.util.Vector goals,
                        java.util.Vector input,
                        int mode)

sortFeasible

protected java.util.Vector sortFeasible(java.lang.String gid,
                                        java.util.Vector input)

enact

public PlannerEnactStruct enact(Goal goal,
                                Goal sla)

latestConfirmTime

int latestConfirmTime(java.util.Vector goals)

latestConfirmTime

int latestConfirmTime(Goal goal)

makeIndex

protected java.lang.String makeIndex(java.util.Vector goals)

index

protected void index(PlannerQueryStruct Results)

removeFromIndexTable

protected void removeFromIndexTable(java.util.Vector goals)

book

public void book(int type,
                 java.util.Vector goals,
                 java.util.Vector records)

book

protected void book(int type,
                    Goal goal,
                    java.util.Vector rootSet)

reject

public void reject(java.util.Vector goals,
                   java.util.Vector records)

reject

protected void reject(Goal goal,
                      java.util.Vector rootSet)

schedule

java.util.Vector schedule(java.lang.String key,
                          PlanRecord parent,
                          java.util.Vector path,
                          java.util.Vector goals,
                          PlannerQueryStruct struct,
                          boolean mode)

schedule

java.util.Vector schedule(java.lang.String key,
                          PlanRecord parent,
                          java.util.Vector path,
                          Goal goal,
                          PlannerQueryStruct struct,
                          boolean mode)

addToExternal

protected void addToExternal(java.util.Vector List,
                             Goal goal)

schedule

java.util.Vector schedule(java.lang.String key,
                          PlanRecord parent,
                          java.util.Vector path,
                          Goal goal,
                          java.util.Vector tasks,
                          PlannerQueryStruct struct,
                          boolean mode)

schedule_summary

java.util.Vector schedule_summary(java.lang.String key,
                                  PlanRecord parent,
                                  java.util.Vector path,
                                  Goal goal,
                                  java.util.Vector tasks,
                                  PlannerQueryStruct struct,
                                  boolean mode)

expand_summary

java.util.Vector expand_summary(Decomposition decomposition,
                                PlannerQueryStruct struct,
                                boolean mode)

schedule_primitive

java.util.Vector schedule_primitive(java.lang.String key,
                                    PlanRecord parent,
                                    java.util.Vector path,
                                    Goal goal,
                                    java.util.Vector tasks,
                                    PlannerQueryStruct struct,
                                    boolean mode)

schedule_children

protected java.util.Vector schedule_children(java.lang.String key,
                                             PlanRecord rec,
                                             java.util.Vector path,
                                             PlannerQueryStruct struct,
                                             boolean mode)

resume_planning

protected void resume_planning(DelegationStruct[] ds,
                               PlannerQueryStruct struct)

goalConfirmed

public void goalConfirmed(java.util.Vector original_goals,
                          java.util.Vector confirmed_goals,
                          java.util.Vector selection)

validTime

protected boolean validTime(int t)

validProc

protected boolean validProc(int proc)

isFreeCell

protected boolean isFreeCell(int proc,
                             int t)

shuffle

public void shuffle()
1.3 promoted to public - used to decide which job to execute


executeEarliest

void executeEarliest()

executeEarliest

void executeEarliest(PlanRecord rec)

incrementProcessorTime

boolean incrementProcessorTime(PlanRecord rec,
                               int time)

checkRecords

public void checkRecords()
start Firmly booked tasks & cancel Tentatively booked ones 1.3 - promoted to public // synched ?


notifyReceived

public void notifyReceived(Fact f1,
                           java.lang.String goalId,
                           java.lang.String subgoalId)

assignCell

protected void assignCell(int proc,
                          int t,
                          PlanRecord rec)

freeCell

void freeCell(int proc,
              int t)

freeCells

void freeCells(int proc,
               int s,
               int e)

recreateSubgoal

public Goal recreateSubgoal(Goal goal)

reconfirmParentOf

public void reconfirmParentOf(java.util.Vector goals)

reconfirmParentOf

public void reconfirmParentOf(Goal g)

failParentOf

public void failParentOf(java.util.Vector goals)

failParentOf

public void failParentOf(Goal g)

softFailParentOf

void softFailParentOf(java.util.Vector goals,
                      PlannerQueryStruct struct,
                      int mode)

addPlanningMonitor

public void addPlanningMonitor(PlanningMonitor monitor,
                               long type)
Use a PlanningMonitor if your code needs to react to changes in the Planner


removePlanningMonitor

public void removePlanningMonitor(PlanningMonitor monitor,
                                  long type)

addPlanStepMonitor

public void addPlanStepMonitor(PlanStepMonitor monitor,
                               long type,
                               boolean notify_previous)
Use a PlanStepMonitor if your code needs to react to state changes in a particular plan


addPlanStepMonitor

public void addPlanStepMonitor(PlanStepMonitor monitor,
                               long type)

removePlanStepMonitor

public void removePlanStepMonitor(PlanStepMonitor monitor,
                                  long type)

notifyMonitors

void notifyMonitors(Goal goal,
                    int event_type,
                    int sub_type)

notifyMonitors

void notifyMonitors(PlanRecord record,
                    int type)

now

protected double now()
now introduced to prevent the need for a call back to the context object to get timeing - decouples the Planner a bit..



Copyright © 2000-2003 BT Exact Technologies. All Rights Reserved.