org.hops.dm.tad
Class PlanSet

java.lang.Object
  extended by org.hops.dm.tad.PlanSet
All Implemented Interfaces:
java.io.Serializable

public class PlanSet
extends java.lang.Object
implements java.io.Serializable

Stores the knows plans and dependent attributes Reads the plans from input file Dependet attribute are those that change the value its other attribute value has change, as database queries.

Version:
3.0
Author:
Meritxell Gonzalez
See Also:
Serialized Form

Constructor Summary
PlanSet()
          Creates a new instance of plan set
 
Method Summary
 void add(plan planin)
          the plan to the table of plans
 boolean AllAnswerAreRelevant(queueact ansActs, stackact planin)
          all the answer are relevant for the plan stack
 boolean answerIsRelevant(stackact planin, attrval ans)
          there is a qud on planin for wichi the ans is relevant
 boolean belongsToDomain(java.util.ArrayList lstin, java.lang.String attr)
          checks whether the attribute name belongs to the same plan that the attributes in list
 boolean belongsToDomain(java.lang.String plan_name, java.lang.String attr)
          checks whether the attribute name belongs to the plan named plan_name
static boolean depends(attrval q, attrval q2)
          search if q is an attribute with dependences and q2 is in the list of q dependents
 boolean exists(attrval taskid)
          Tests wheter exists a plan with the taskid name
 boolean exists(java.lang.String taskid)
          Tests wheter exists a plan with the taskid name
static boolean ExistsDependents(queuepair pairqueue, attrval prevmove)
          PrevMove=ask(Q) or (PrevMove=icm:und*int:DP*C and Q=und(DP*C)) not Moves/ELEM=ask(Q') and domain::depends(Q,Q') no move performed in the latest utterance is ( relevant to Q neither by answering it not by ) asking a question on which Q pedens from update.cpp - irrelevant followup
 boolean ExistsSubsumedAsk(queuepair actions, action actin)
          search an action in the queue subsummed by the action in the second parameter.
 plan get()
          Returns the initial plan
 plan get(attrval inf, plantype pltype)
          Returns the plan named inf and of type pltype
 stackp get(queueact ansActs, plantype pltype)
          obtain all the plans of the type pltype which questions are relevant to ALL the ansActs
 stackp get(queueact ansActs, plantype pltype, java.lang.String currPlan)
          obtain all the plans of the type pltype which questions are relevant to ALL the ansActs.
 plan get(java.lang.String taskid)
          Returns the plan identified with the specific taskid name
 attrval_ary getArity(java.lang.String attr_name)
          Returns the arity of an attribute
 java.lang.String getAttrName(java.lang.String attr_name)
          Retruns the name of an attribute
 java.util.Set getPlansKeys()
          Returs all the plan keys
 void ini_dependences(java.io.FileInputStream fileString)
          initialized dependencies, reads from file
 void ini_plans(java.io.FileInputStream fileString, java.io.FileInputStream params)
          initialize plans, reads plans from file
 boolean isBoolean(java.lang.String attr_name)
          Return true if there is a plan with an action named attr_name that is boolean
 boolean IsIssueQ(stackp issues, attrval qud)
          qud represents a plan where there is a question for which there is a solution on issues
 stackact ObtainDefaultMatchQUD(stackact planstack, stackp answers)
          Search all the questions in the stack that has a default value which condition is matching with the answer
 stackp ObtainDependentActions(action ansA)
          2: setof(Action, domain::depends(a,Q) and domain::relevant(A,Q),ActionSet)
 stackp ObtainDependentIssues(action q)
          7:domain::depends(Q,Q') Obtain all the dependent issues for ansA ObtainDependentIssues( QSetOut, depIssues );
static stackp ObtainDependents(stackact planin, action ansA)
          it is dependent if the exeprop is of type executing/answering in the same plan where ansprop is asking
static stackp ObtainDependentsRelevantActions(stackact planin, action ansA)
          2: setof(Action, domain::depends(a,Q) and domain::relevant(A,Q),ActionSet)
 stackp ObtainDepQPlan(attrval ansA)
          obtain all the taskid-values plans where there is a questions for which the answer is relevant 2:setof ( Q', domain::plan(Q',Plan) and // constructs the set of dependent issues in(Plan, findout(SomeQ)) and domain:: relevant(A, someQ), QSet')
 stackp ObtainDepQPrecondPlan(IS sharetis, attrval ansA)
          equal than obtainDepqPlan but matching the condition
 stackact ObtainRelevantPrecondQUD(IS sharetis, stackact planstack, attrval answer)
          equal than ObtainRelevantQUD but it must also accomplish the action condition
 stackact ObtainRelevantQUD(stackact planstack, attrval answer)
          Search all the questions in the stack that are relevant for the prop in the second parameter setof(C,in(/private/plan, findout(Q)) and domain::relevant(A,Q), QSet) there is more than one question in the plan to which the answer is relevant
 stackact ObtainRelevantQUD(stackact planstack, condition cond)
          Search all the questions in the stack that are relevant for ANY prop in the condition
 stackact ObtainRelevants(attrval answer)
          Search all the questions in the stack that are relevant for the prop in the second parameter setof(C,in(/private/plan, findout(Q)) and domain::relevant(A,Q), QSet) there is more than one question in the plan to which the answer is relevant 3:domain::question(Q) 4:domain::relevant(A,Q) 5:domain::relevant(P,Q)
 stackp remove_unifiables(stackp p)
          for all propo1 in source, if propo1 is subaction of propo2 and propo2 is in the stack, remove propo2
 stackp SearchPlansFromSubAction(java.lang.String attrname)
          search all the plans that CONTAINS the subaction
 boolean subsumes(attrval subs, attrval sumed)
          subs subsumes sumed if there is a plan P represented by subs that it is more concrete that the one represented by sumed ONLY used with ASK propositions ( tasks )
 boolean taskIsCovered(stackact next_moves)
          check whether the task is covered in the current next moves stack
 java.lang.String toString()
          Returns a string representation of the object.
 boolean validPlansParameter(attrval param)
          search all the actions for the param
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PlanSet

public PlanSet()
Creates a new instance of plan set

Method Detail

ini_dependences

public void ini_dependences(java.io.FileInputStream fileString)
                     throws java.lang.Exception
initialized dependencies, reads from file

Throws:
java.lang.Exception

depends

public static boolean depends(attrval q,
                              attrval q2)
search if q is an attribute with dependences and q2 is in the list of q dependents


remove_unifiables

public stackp remove_unifiables(stackp p)
for all propo1 in source, if propo1 is subaction of propo2 and propo2 is in the stack, remove propo2

Parameters:
p - the list os attributes
Returns:
p without the unifiabled attributes

ObtainDependents

public static stackp ObtainDependents(stackact planin,
                                      action ansA)
it is dependent if the exeprop is of type executing/answering in the same plan where ansprop is asking

Parameters:
planin - the current plan
ansA - the answer action
Returns:
the list of attributes that are dependent from ansA

ObtainDependentsRelevantActions

public static stackp ObtainDependentsRelevantActions(stackact planin,
                                                     action ansA)
2: setof(Action, domain::depends(a,Q) and domain::relevant(A,Q),ActionSet)

Parameters:
planin - the current plan
ansA - the current answer action
Returns:
the list of actions in the plan that are relevant to ansA

ExistsDependents

public static boolean ExistsDependents(queuepair pairqueue,
                                       attrval prevmove)
PrevMove=ask(Q) or (PrevMove=icm:und*int:DP*C and Q=und(DP*C)) not Moves/ELEM=ask(Q') and domain::depends(Q,Q') no move performed in the latest utterance is ( relevant to Q neither by answering it not by ) asking a question on which Q pedens from update.cpp - irrelevant followup

Parameters:
pairqueue - the list pairs
prevmove - the previous move

ini_plans

public void ini_plans(java.io.FileInputStream fileString,
                      java.io.FileInputStream params)
               throws java.lang.Exception
initialize plans, reads plans from file

Throws:
java.lang.Exception

getPlansKeys

public java.util.Set getPlansKeys()
Returs all the plan keys


add

public void add(plan planin)
the plan to the table of plans


exists

public boolean exists(java.lang.String taskid)
Tests wheter exists a plan with the taskid name


exists

public boolean exists(attrval taskid)
Tests wheter exists a plan with the taskid name


get

public plan get(java.lang.String taskid)
Returns the plan identified with the specific taskid name


get

public plan get()
Returns the initial plan


get

public plan get(attrval inf,
                plantype pltype)
Returns the plan named inf and of type pltype

Parameters:
inf - the attribute
pltype - type of attribute

get

public stackp get(queueact ansActs,
                  plantype pltype,
                  java.lang.String currPlan)
obtain all the plans of the type pltype which questions are relevant to ALL the ansActs. BUT only PLANS that are subplans of planin

Parameters:
ansActs - the list of actions
pltype - the type of the plan
currPlan - the current plan name

get

public stackp get(queueact ansActs,
                  plantype pltype)
obtain all the plans of the type pltype which questions are relevant to ALL the ansActs

Parameters:
ansActs - the list of answers
pltype - the type of plans

getAttrName

public java.lang.String getAttrName(java.lang.String attr_name)
Retruns the name of an attribute


getArity

public attrval_ary getArity(java.lang.String attr_name)
Returns the arity of an attribute


toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object

isBoolean

public boolean isBoolean(java.lang.String attr_name)
Return true if there is a plan with an action named attr_name that is boolean

Parameters:
attr_name - the action name we are searching for.
Returns:
yes is a boolean action found

subsumes

public boolean subsumes(attrval subs,
                        attrval sumed)
subs subsumes sumed if there is a plan P represented by subs that it is more concrete that the one represented by sumed ONLY used with ASK propositions ( tasks )

Parameters:
subs - the name of a plan
sumed - the name of an attribute

ExistsSubsumedAsk

public boolean ExistsSubsumedAsk(queuepair actions,
                                 action actin)
search an action in the queue subsummed by the action in the second parameter. from update.cpp (downdateNIM)

Parameters:
actions - the list of actions
actin - the action to search

belongsToDomain

public boolean belongsToDomain(java.lang.String plan_name,
                               java.lang.String attr)
checks whether the attribute name belongs to the plan named plan_name

Parameters:
plan_name - the name of the plan
attr - the name of the attribute

belongsToDomain

public boolean belongsToDomain(java.util.ArrayList lstin,
                               java.lang.String attr)
checks whether the attribute name belongs to the same plan that the attributes in list

Parameters:
lstin - the list of attributes
attr - the attribute to search

AllAnswerAreRelevant

public boolean AllAnswerAreRelevant(queueact ansActs,
                                    stackact planin)
all the answer are relevant for the plan stack

Parameters:
ansActs - the list of actions
planin - the current plan
Returns:
true if the answers are reevant

answerIsRelevant

public boolean answerIsRelevant(stackact planin,
                                attrval ans)
there is a qud on planin for wichi the ans is relevant

Parameters:
planin - the current plan
ans - the attribute
Returns:
true if the ans is relevant in the plan

ObtainDepQPlan

public stackp ObtainDepQPlan(attrval ansA)
obtain all the taskid-values plans where there is a questions for which the answer is relevant 2:setof ( Q', domain::plan(Q',Plan) and // constructs the set of dependent issues in(Plan, findout(SomeQ)) and domain:: relevant(A, someQ), QSet')

Parameters:
ansA - the attribute
Returns:
the list of plans-depQ

SearchPlansFromSubAction

public stackp SearchPlansFromSubAction(java.lang.String attrname)
search all the plans that CONTAINS the subaction

Parameters:
attrname -
Returns:
the attributes representing the plans found

ObtainRelevantQUD

public stackact ObtainRelevantQUD(stackact planstack,
                                  condition cond)
Search all the questions in the stack that are relevant for ANY prop in the condition

Parameters:
planstack - the current plan
cond - the condition from an action
Returns:
the questions

ObtainRelevantQUD

public stackact ObtainRelevantQUD(stackact planstack,
                                  attrval answer)
Search all the questions in the stack that are relevant for the prop in the second parameter setof(C,in(/private/plan, findout(Q)) and domain::relevant(A,Q), QSet) there is more than one question in the plan to which the answer is relevant

Parameters:
planstack - the current plan
answer - the answer attribute
Returns:
the questions

ObtainDefaultMatchQUD

public stackact ObtainDefaultMatchQUD(stackact planstack,
                                      stackp answers)
Search all the questions in the stack that has a default value which condition is matching with the answer

Parameters:
planstack - the current plan
answers - the current answers
Returns:
the questions in the plan

IsIssueQ

public boolean IsIssueQ(stackp issues,
                        attrval qud)
qud represents a plan where there is a question for which there is a solution on issues

Parameters:
issues - the issues stack from IS
qud - the question
Returns:
the issue found

ObtainDependentIssues

public stackp ObtainDependentIssues(action q)
7:domain::depends(Q,Q') Obtain all the dependent issues for ansA ObtainDependentIssues( QSetOut, depIssues );

Parameters:
q - the question
Returns:
the dependents issues (attributes)

ObtainDependentActions

public stackp ObtainDependentActions(action ansA)
2: setof(Action, domain::depends(a,Q) and domain::relevant(A,Q),ActionSet)

Parameters:
ansA - the attribute
Returns:
the stack of acitons

ObtainRelevants

public stackact ObtainRelevants(attrval answer)
Search all the questions in the stack that are relevant for the prop in the second parameter setof(C,in(/private/plan, findout(Q)) and domain::relevant(A,Q), QSet) there is more than one question in the plan to which the answer is relevant 3:domain::question(Q) 4:domain::relevant(A,Q) 5:domain::relevant(P,Q)

Parameters:
answer - the attributes
Returns:
all the questions

validPlansParameter

public boolean validPlansParameter(attrval param)
search all the actions for the param

Parameters:
param - ant attribute
Returns:
true if exists a plan containing this attribute

ObtainDepQPrecondPlan

public stackp ObtainDepQPrecondPlan(IS sharetis,
                                    attrval ansA)
equal than obtainDepqPlan but matching the condition

Parameters:
sharetis - the IS
ansA - the answer we are looking for
Returns:
all the DepQ actions in sharetis that are plans with actions relevant to ansA and conditions are matched

ObtainRelevantPrecondQUD

public stackact ObtainRelevantPrecondQUD(IS sharetis,
                                         stackact planstack,
                                         attrval answer)
equal than ObtainRelevantQUD but it must also accomplish the action condition

Parameters:
sharetis - the IS
planstack - the current plan
answer - the answer that must be found
Returns:
all the actions in the current plan that are relevant to answer and conditions are matched

taskIsCovered

public boolean taskIsCovered(stackact next_moves)
check whether the task is covered in the current next moves stack

Parameters:
next_moves - the current next_moves stack
Returns:
true if the task will finishes in the next_moves (so, there is a reset move)