|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ai.planning.strips.SequentialPlan
public class SequentialPlan
Field Summary | |
---|---|
protected java.util.List<Action> |
actions
the sequence of Actions contained in this Plan |
protected Domain |
domain
the Domain in which this plan is defined |
protected ai.krr.NamedSymbol |
name
the reference String that can be used to refer to this problem |
Constructor Summary | |
---|---|
SequentialPlan(Domain domain)
This constructor creates a new, empty plan. |
|
SequentialPlan(Domain domain,
java.util.List<Action> acts)
This constructor creates a new plan consisting of the given actions in the given order. |
Method Summary | |
---|---|
void |
append(Action act)
This function adds the given Action to the end of this plan. |
WorldState<ai.krr.fol.Atom> |
applyIn(WorldState<ai.krr.fol.Atom> istate)
This function computes a new WorldState that is the result of applying this Plan in the given state. |
SequentialPlan<ai.krr.fol.Atom> |
asSequentialPlan()
This function returns a linearised, total-order version of this Plan. |
SequentialPlan |
clone()
This function returns a semi-shallow copy of this plan. |
void |
concatenate(SequentialPlan<ai.krr.fol.Atom> plan)
This function can be used to concatenate two plans. |
boolean |
equals(java.lang.Object obj)
This function compares this plan to the given Object. |
boolean |
equals(SequentialPlan other)
|
java.util.List<Action<ai.krr.fol.Atom>> |
getActionSequence()
This function returns the List of Actions that constitute this SequentialPlan. |
Domain<ai.krr.fol.Atom> |
getDomain()
This function retrieves the Domain which contains the definitions of the ActionTypes of which the Actions in this Plan are instances. |
int |
hashCode()
This function computes a hash code for this Plan. |
int |
length()
This function returns the current length of this SequentialPlan. |
protected java.lang.String |
objectString()
This function returns a String that is the String returned by this Object's toString function. |
void |
prepend(Action act)
This function adds the given Action to the beginning of this plan. |
void |
prettyPrint(int indent,
java.io.Writer w,
inf.compilers.SyntaxAdaptor sa)
This function can be used write this SyntaxAdaptable object to the given Writer. |
static SequentialPlan |
read(java.io.Reader r,
inf.compilers.SyntaxAdaptor<SequentialPlan> sa)
|
boolean |
solves(Problem<ai.krr.fol.Atom> p)
This function tests whether this Plan constitutes a solution to the given Problem. |
java.lang.String |
toString()
This function returns a String representation of this plan. |
void |
write(java.io.Writer w,
inf.compilers.SyntaxAdaptor sa)
This function can be used write this logical Sentence to the given Writer. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Domain domain
protected java.util.List<Action> actions
protected ai.krr.NamedSymbol name
Constructor Detail |
---|
public SequentialPlan(Domain domain)
This constructor creates a new, empty plan.
domain
- the Domain that defines the context for this planpublic SequentialPlan(Domain domain, java.util.List<Action> acts)
This constructor creates a new plan consisting of the given actions in the given order.
domain
- the Domain that defines the context for this planacts
- the sequence of actions in this planMethod Detail |
---|
public SequentialPlan clone()
This function returns a semi-shallow copy of this plan. The actions in the plan will be the same as the originals, but the List that encapsulates them is new.
clone
in class java.lang.Object
public SequentialPlan<ai.krr.fol.Atom> asSequentialPlan()
This function returns a linearised, total-order version of this Plan.
asSequentialPlan
in interface Plan<ai.krr.fol.Atom>
public Domain<ai.krr.fol.Atom> getDomain()
This function retrieves the Domain which contains the definitions of the ActionTypes of which the Actions in this Plan are instances.
getDomain
in interface Plan<ai.krr.fol.Atom>
public WorldState<ai.krr.fol.Atom> applyIn(WorldState<ai.krr.fol.Atom> istate)
This function computes a new WorldState that is the result of applying this Plan in the given state. If this Plan is not applicable in an intermediate state, the result will be null.
applyIn
in interface Plan<ai.krr.fol.Atom>
istate
- the WorldState in which the SequentialPlan is to be applied
public boolean solves(Problem<ai.krr.fol.Atom> p)
This function tests whether this Plan constitutes a solution to the given Problem. This is true iff this Plan applied to the initial state results in a state that satisfies the goal of the Problem.
solves
in interface Plan<ai.krr.fol.Atom>
p
- the Problem to which this Plan be a solution
public java.util.List<Action<ai.krr.fol.Atom>> getActionSequence()
This function returns the List of Actions that constitute this SequentialPlan.
getActionSequence
in interface SequentialPlan<ai.krr.fol.Atom>
public void concatenate(SequentialPlan<ai.krr.fol.Atom> plan)
This function can be used to concatenate two plans. The result is a SequentialPlan that contains first this plan as its prefix and the given plan as its suffix. The length of the resulting plan will be the sum of the lengths of the two input plans.
concatenate
in interface SequentialPlan<ai.krr.fol.Atom>
plan
- the plan that will be appended to this SequentialPlanpublic int length()
This function returns the current length of this SequentialPlan.
length
in interface SequentialPlan<ai.krr.fol.Atom>
public void write(java.io.Writer w, inf.compilers.SyntaxAdaptor sa) throws inf.compilers.ExpressivenessException, java.io.IOException
This function can be used write this logical Sentence to the given Writer. The syntax in which it is written is defined by the SyntaxAdaptor that is also given to this function.
write
in interface inf.compilers.SyntaxAdaptable
w
- the Writer to which this Sentence is writtensa
- the SyntaxAdaptor that determines the syntax
inf.compilers.ExpressivenessException
- if the syntax does not support every
construct occurring in this Sentence
java.io.IOException
- if writing to the Writer failspublic void prettyPrint(int indent, java.io.Writer w, inf.compilers.SyntaxAdaptor sa) throws inf.compilers.ExpressivenessException, java.io.IOException
This function can be used write this SyntaxAdaptable object to the given Writer. The syntax is the same as for normal writing. The only difference is the inclusion of extra space and newlines for better readability.
prettyPrint
in interface inf.compilers.SyntaxAdaptable
indent
- the amount of indentation for the first linew
- the Writer to which this Sentence is writtensa
- the SyntaxAdaptor that determines the syntax
inf.compilers.ExpressivenessException
- if the syntax does not support every
construct occurring in this Sentence
java.io.IOException
- if writing to the Writer failspublic void append(Action act)
This function adds the given Action to the end of this plan.
act
- the new Action to be appended to this planpublic void prepend(Action act)
This function adds the given Action to the beginning of this plan.
act
- the new Action to be prepended to this planprotected java.lang.String objectString()
This function returns a String that is the String returned by this Object's toString function. Note that this makes it unique to this plan.
String a unique String for this SequentialPlan
public boolean equals(java.lang.Object obj)
This function compares this plan to the given Object. Two SequentialPlans are equal if they contain equal Actions in an equal order.
equals
in class java.lang.Object
public boolean equals(SequentialPlan other)
public int hashCode()
This function computes a hash code for this Plan. The current implementation is not very efficient.
hashCode
in class java.lang.Object
public java.lang.String toString()
This function returns a String representation of this plan.
toString
in class java.lang.Object
public static SequentialPlan read(java.io.Reader r, inf.compilers.SyntaxAdaptor<SequentialPlan> sa) throws inf.compilers.ExpressivenessException, java.text.ParseException, java.io.IOException
inf.compilers.ExpressivenessException
java.text.ParseException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |