ABLE 2.3.0 07/13/2005 14:21:00

com.ibm.able.rules
Class AblePlanningEngine

java.lang.Object
  extended bycom.ibm.able.rules.AbleInferenceEngine
      extended bycom.ibm.able.rules.AblePlanningEngine
All Implemented Interfaces:
java.io.Serializable

public class AblePlanningEngine
extends AbleInferenceEngine
implements java.io.Serializable

This class provides the control code and inferencing algorithms for processing a set of planning rules in a ruleblock.

The AblePlanningEngine processes AbleAssertionRules and AblePlanningRules and ignores all others.

The control parameters ARL.InitialState and ARL.GoalState can be used to specify the initial and final states respectively. The control parameter ARL.Domain can be used to specify the planning domain.

The control parameter ARL.Requirements can be used to specify requirements on the planning engine for the specified domain.

The major processing method is infer() which is called by the AbleRuleSet bean as part of the normal bean process() method.

Instances of this class are not directly constructed by the user but are dynamically created by the AbleRuleBlock init() method.

See Also:
AbleRuleSet, AbleRuleBlock, AbleAssertionRule, AblePlanningRule, Serialized Form

Field Summary
protected  boolean myDebugFlag
           
protected  java.lang.String myDomain
           
protected  java.lang.Class myDomainActionsClass
           
protected  java.lang.String myDomainFile
           
protected  com.ibm.able.planner4J.planners.IDomain myDomainObj
           
protected  java.util.ArrayList myExecutablePlan
           
protected  AbleExpression myGoalState
           
protected  boolean myHTNProblemFlag
           
protected  AbleExpression[] myInitialState
           
protected  java.util.HashMap myParams
           
protected  com.ibm.able.planner4J.planners.IPlanner myPlanner
           
protected  java.lang.String myProblemFile
           
protected  AbleExpression[] myProblemInitObjects
           
protected  boolean myProblemInitObjectsExplicitFlag
           
protected  com.ibm.able.planner4J.planners.IProblem myProblemObj
           
protected  java.lang.Object[] myRequirements
           
protected  com.ibm.able.planner4J.planners.IPlanSolution myResult
           
 
Fields inherited from class com.ibm.able.rules.AbleInferenceEngine
myDebugLevel, myRuleBlock, myRuleSet, myRulesFiredCount, myTracer, myWorkingMemory
 
Constructor Summary
AblePlanningEngine(AbleRuleSet theRuleSet, AbleLogger theTracer, AbleRuleBlock theRuleBlock)
          Create a new planning inference engine.
 
Method Summary
 com.ibm.able.planner4J.planners.classicalPlannerImpl.PredicateImpl convertAblePredicateToGroundP4JPredicate(AblePredicate theAblePredicate)
          Take an AblePredicate as input and convert it into a ground planner4J predicate.
 java.util.Vector convertExprToPredicateList(AbleExpression theExpr)
          Takes an AbleExpression representing the preconditions of a planning rule and converts it to a list of AblePredicates.
 void convertPlanToExecutableForm()
           
 void convertPlanToStringForm()
           
 java.lang.Object getControlParameter(java.lang.String theControlParameter)
          Returns the specified control parameter on the associated inference engine.
 java.lang.String getDomain()
          Retrieve the domain control parameter
 java.lang.Class getDomainActionsClass()
          Gets the class that contains the planning actions.
 java.lang.String getDomainActionsClassName()
          Gets the name of the class that contains the planning actions.
 java.lang.String getDomainFile()
          Retrieve the domain file control parameter
 AbleExpression getGoalState()
          Retrieve the goal state
 AbleExpression[] getInitialState()
          Retrieve the initial state
 java.util.HashMap getParams()
          Retrieve the parameter hashmap (control parameter)
 java.util.ArrayList getPlan()
          Gets the plan created by the infer() method.
 java.lang.String getProblemFile()
          Retrieve the problem file control parameter
 AbleExpression[] getProblemObjects()
          Retrieve the objects in the problem
 java.lang.Object[] getRequirements()
          Retrieve the requirements list (control parameter)
 void infer(AbleRuleBlock theRuleBlock)
          Inference over the set of rules in the specified ruleblock object.
 boolean isRuleBlockValid(AbleRuleBlock theRuleBlock)
          Make sure the current ruleblock is "executable" when examined from a static viewpoint.
 void setControlParameter(java.lang.String theControlParameter, java.lang.Object theValue)
          Set the specified control parameter on the associated inference engine.
 void setDomain(java.lang.String theDomain)
          Set the domain control parameter
 void setDomainActionsClass(java.lang.Class theDomainActionsClass)
          Sets the class that contains the planning actions.
 void setDomainFile(java.lang.String theDomainFile)
          Set the domain file name control parameter
 void setGoalState(AbleExpression theGoalState)
          Set the goal state
 void setInitialState(AbleExpression[] theInitialState)
          Set the initial state
 void setParams(java.util.HashMap theParams)
          Set the parameter hashmap (control parameter)
 void setProblemFile(java.lang.String theProblemFile)
          Set the problem file control parameter
 void setProblemObjects(AbleExpression[] theProblemObjects)
          Set the objects in the problem.
 void setRequirements(java.lang.Object[] theRequirements)
          Set the requirements list (control parameter)
 
Methods inherited from class com.ibm.able.rules.AbleInferenceEngine
allocateWorkingMemory, askUser, conditionalRulesValid, evalAntecedentClause, evalAntecedentExpression, evalAssertionClause, evalAssertionRule, evalConditionalRule, evalConsequentClause, evalDoUntilRule, evalDoWhileRule, evalForLoopRule, evalIfThenElseRule, evalPatternMatchRule, evalSwitchRule, evaluateDoActions, evalWhileDoRule, fireEngineBreakpoint, firePropertyChange, getRuleSet, getRulesFiredCount, getWorkingMemory, init, processAssertions, processConsequent, processConsequent, processConsequentClauses, processRuleBlock, reset, resetRuleSet, setControlParameters, setDebugLevel, setInferenceContext, setInferenceContext, setInferenceContext, setRuleSet, setWorkingMemory, startDebugConsole, stopDebugConsole, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myDomainObj

protected com.ibm.able.planner4J.planners.IDomain myDomainObj

myProblemObj

protected com.ibm.able.planner4J.planners.IProblem myProblemObj

myPlanner

protected com.ibm.able.planner4J.planners.IPlanner myPlanner

myResult

protected com.ibm.able.planner4J.planners.IPlanSolution myResult

myDebugFlag

protected boolean myDebugFlag

myHTNProblemFlag

protected boolean myHTNProblemFlag

myProblemInitObjectsExplicitFlag

protected boolean myProblemInitObjectsExplicitFlag

myProblemInitObjects

protected AbleExpression[] myProblemInitObjects

myInitialState

protected AbleExpression[] myInitialState

myGoalState

protected AbleExpression myGoalState

myDomain

protected java.lang.String myDomain

myDomainFile

protected java.lang.String myDomainFile

myProblemFile

protected java.lang.String myProblemFile

myRequirements

protected java.lang.Object[] myRequirements

myParams

protected java.util.HashMap myParams

myDomainActionsClass

protected java.lang.Class myDomainActionsClass

myExecutablePlan

protected java.util.ArrayList myExecutablePlan
Constructor Detail

AblePlanningEngine

public AblePlanningEngine(AbleRuleSet theRuleSet,
                          AbleLogger theTracer,
                          AbleRuleBlock theRuleBlock)
Create a new planning inference engine.

Parameters:
theRuleSet - A ruleset whose context is used for inferencing by this inference engine.

theTracer - A tracer object to which this inference engine can log information. This may be null, in which case no information is logged.

theRuleBlock - A ruleblock whose rules are to be used for inferencing by this inference engine.

Method Detail

isRuleBlockValid

public boolean isRuleBlockValid(AbleRuleBlock theRuleBlock)
                         throws AbleDataException
Description copied from class: AbleInferenceEngine
Make sure the current ruleblock is "executable" when examined from a static viewpoint. Certain invalid configurations cannot be detected via static analysis of the rule objects. If validation fails, the inference engine must call myRuleSet.addIsExReason(java.lang.String) to set the reason.

Specified by:
isRuleBlockValid in class AbleInferenceEngine
Returns:
true, if the ruleblock is OK; false, if the ruleblock is not executable.
Throws:
AbleDataException

infer

public void infer(AbleRuleBlock theRuleBlock)
           throws AbleDataException
Description copied from class: AbleInferenceEngine
Inference over the set of rules in the specified ruleblock object.

Specified by:
infer in class AbleInferenceEngine
Parameters:
theRuleBlock - The ruleblock to be processed by the engine.

Throws:
AbleDataException

convertPlanToExecutableForm

public void convertPlanToExecutableForm()
                                 throws AbleDataException
Throws:
AbleDataException

convertPlanToStringForm

public void convertPlanToStringForm()
                             throws AbleDataException
Throws:
AbleDataException

convertExprToPredicateList

public java.util.Vector convertExprToPredicateList(AbleExpression theExpr)
                                            throws AbleDataException
Takes an AbleExpression representing the preconditions of a planning rule and converts it to a list of AblePredicates. NOTE: This assumes that the preconditions are conjunctions of predicates only!!!! *

Returns:
a Vector of AblePredicates
Throws:
AbleDataException

convertAblePredicateToGroundP4JPredicate

public com.ibm.able.planner4J.planners.classicalPlannerImpl.PredicateImpl convertAblePredicateToGroundP4JPredicate(AblePredicate theAblePredicate)
                                                                                                            throws AbleDataException
Take an AblePredicate as input and convert it into a ground planner4J predicate. Note: The type of the planning predicate is assumed to be default.

Returns:
PredicateImpl
Throws:
AbleDataException

setControlParameter

public void setControlParameter(java.lang.String theControlParameter,
                                java.lang.Object theValue)
                         throws AbleDataException
Description copied from class: AbleInferenceEngine
Set the specified control parameter on the associated inference engine. The target engine validates both the parameter name and value.

Specified by:
setControlParameter in class AbleInferenceEngine
Throws:
AbleDataException

getControlParameter

public java.lang.Object getControlParameter(java.lang.String theControlParameter)
                                     throws AbleDataException
Description copied from class: AbleInferenceEngine
Returns the specified control parameter on the associated inference engine. The target engine validates both the parameter name.

Specified by:
getControlParameter in class AbleInferenceEngine
Throws:
AbleDataException

setProblemObjects

public void setProblemObjects(AbleExpression[] theProblemObjects)
Set the objects in the problem.

Parameters:
theProblemObjects -

getProblemObjects

public AbleExpression[] getProblemObjects()
Retrieve the objects in the problem

Returns:
The objects in the planning problem.

setInitialState

public void setInitialState(AbleExpression[] theInitialState)
Set the initial state

Parameters:
theInitialState -

getInitialState

public AbleExpression[] getInitialState()
Retrieve the initial state

Returns:
The current initial planning state.

setGoalState

public void setGoalState(AbleExpression theGoalState)
Set the goal state

Parameters:
theGoalState -

getGoalState

public AbleExpression getGoalState()
Retrieve the goal state

Returns:
The current planning goal state.

setDomain

public void setDomain(java.lang.String theDomain)
Set the domain control parameter

Parameters:
theDomain -

getDomain

public java.lang.String getDomain()
Retrieve the domain control parameter

Returns:
the domain

setDomainFile

public void setDomainFile(java.lang.String theDomainFile)
Set the domain file name control parameter

Parameters:
theDomainFile -

getDomainFile

public java.lang.String getDomainFile()
Retrieve the domain file control parameter

Returns:
the domain file

setProblemFile

public void setProblemFile(java.lang.String theProblemFile)
Set the problem file control parameter

Parameters:
theProblemFile -

getProblemFile

public java.lang.String getProblemFile()
Retrieve the problem file control parameter

Returns:
the problem file

setRequirements

public void setRequirements(java.lang.Object[] theRequirements)
Set the requirements list (control parameter)

Parameters:
theRequirements -

getRequirements

public java.lang.Object[] getRequirements()
Retrieve the requirements list (control parameter)

Returns:
the requirements list

setParams

public void setParams(java.util.HashMap theParams)
Set the parameter hashmap (control parameter)

Parameters:
theParams -

getParams

public java.util.HashMap getParams()
Retrieve the parameter hashmap (control parameter)

Returns:
the parameters

setDomainActionsClass

public void setDomainActionsClass(java.lang.Class theDomainActionsClass)
Sets the class that contains the planning actions.

Parameters:
theDomainActionsClass -

getDomainActionsClass

public java.lang.Class getDomainActionsClass()
Gets the class that contains the planning actions.

Returns:
the class that contains the planning actions.

getDomainActionsClassName

public java.lang.String getDomainActionsClassName()
Gets the name of the class that contains the planning actions.

Returns:
the name of the class that contains the planning actions.

getPlan

public java.util.ArrayList getPlan()
Gets the plan created by the infer() method.

Returns:
the plan. The plan may be empty.

ABLE 2.3.0 07/13/2005 14:21:00

(C) Copyright IBM Corporation 1999, 2005