|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ai.planning.strips.Action
public class Action
An Action is an activity that may be executable by some agent. Every Action must be a fully ground instance of some ActionType, i.e. all the parameters are mapped to objects in the domain. A unique id is given to an Action to distinguish multiple occurrences of Actions of the same ActionType in a plan.
Field Summary | |
---|---|
protected ActionType |
actionType
the ActionType which this Action instantiates |
protected Grounding |
params
the mapping of parameter variables (from the type) to domain objects |
Constructor Summary | |
---|---|
Action(ActionType type,
Grounding g,
boolean allowComplements)
This constructor creates a new Action of the given type. |
|
Action(ActionType type,
java.util.List<ai.krr.fol.Constant> params,
boolean allowComplements)
This constructor creates a new Action of the given type. |
Method Summary | |
---|---|
protected java.lang.String |
addrString()
This function returns a String that corresponds to the address of this Object in memory. |
WorldState |
applyIn(WorldState state)
This function computes a new WorldState that is the result of applying this Action in the given state. |
WorldState<ai.krr.fol.Atom> |
applyIn(WorldState<ai.krr.fol.Atom> state)
This function computes a new WorldState that is the result of applying this Action in the given state. |
Action |
clone()
This function returns an equal copy of this action. |
boolean |
equals(Action other)
|
boolean |
equals(java.lang.Object obj)
This function tests whether this and the given action are equal. |
ActionType |
getActionType()
This function returns the ActionType of this Action. |
ai.krr.fol.Atom[] |
getNegativeEffects()
This function returns the negative effects associated with this Action. |
ai.krr.fol.Atom[] |
getNegativePreconditions()
This function returns the negative preconditions associated with this Action. |
ai.krr.fol.Atom[] |
getPositiveEffects()
This function returns the positive effects associated with this Action. |
ai.krr.fol.Atom[] |
getPositivePreconditions()
This function returns the positive preconditions associated with this Action. |
int |
hashCode()
This function returns a hash value for this action. |
boolean |
isApplicableIn(WorldState state)
This function tests whether this Action is applicable in the given state. |
boolean |
isApplicableIn(WorldState<ai.krr.fol.Atom> state)
This function tests whether this Action is applicable in the given state. |
java.lang.String |
toString()
This function creates a String representation for this ActionType. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected ActionType actionType
protected Grounding params
Constructor Detail |
---|
public Action(ActionType type, java.util.List<ai.krr.fol.Constant> params, boolean allowComplements)
This constructor creates a new Action of the given type. The Action is automatically given a unique id. The parameters are instantiated in the given order.
The final parameter determines whether an Action may have inconsistent effects. However, this is only tested with an assertion!
type
- the ActionType which this Action instantiatesparams
- the objects used by this ActionallowComplements
- whether complementary effects are permittedpublic Action(ActionType type, Grounding g, boolean allowComplements)
This constructor creates a new Action of the given type. The Action is automatically given a unique id. The parameters are instantiated using the given Grounding.
The final parameter determines whether an Action may have inconsistent effects. However, this is only tested with an assertion!
type
- the ActionType which this Action instantiatesg
- the grounding of the parameters defined in the typeallowComplements
- whether complementary effects are permittedMethod Detail |
---|
public Action clone()
This function returns an equal copy of this action. Note that the clone will have a different id.
clone
in class java.lang.Object
public boolean isApplicableIn(WorldState<ai.krr.fol.Atom> state)
This function tests whether this Action is applicable in the given state. It returns true iff all the Action's positive preconditions are entailed by the given WolrdState and the negative preconditions are falsified by the given WolrdState.
isApplicableIn
in interface Action<ai.krr.fol.Atom>
state
- the WorldState in which applicability is to be tested
public WorldState<ai.krr.fol.Atom> applyIn(WorldState<ai.krr.fol.Atom> state)
This function computes a new WorldState that is the result of applying this Action in the given state. The Action should be applicable or the result of this function may not be as expected. If assertions are switched on, applicability will be tested. The resulting WorldState is computed by first removing all the negative effects of the given Action from this state and then adding all the positive effects. This order is only relevant if this action may have inconsistent effects.
applyIn
in interface Action<ai.krr.fol.Atom>
state
- the WorldState in which this Action to be applied
public ActionType getActionType()
This function returns the ActionType of this Action.
getActionType
in interface Action<ai.krr.fol.Atom>
public ai.krr.fol.Atom[] getNegativePreconditions()
This function returns the negative preconditions associated with this Action. These are taken from the ActionType of this Action and instantiated using the Grounding of this Action.
public ai.krr.fol.Atom[] getPositivePreconditions()
This function returns the positive preconditions associated with this Action. These are taken from the ActionType of this Action and instantiated using the Grounding of this Action.
public ai.krr.fol.Atom[] getNegativeEffects()
This function returns the negative effects associated with this Action. These are taken from the ActionType of this Action and instantiated using the Grounding of this Action.
public ai.krr.fol.Atom[] getPositiveEffects()
This function returns the positive effects associated with this Action. These are taken from the ActionType of this Action and instantiated using the Grounding of this Action.
public boolean isApplicableIn(WorldState state)
This function tests whether this Action is applicable in the given state. It returns true iff all the Action's positive preconditions are entailed by the given WolrdState and the negative preconditions are falsified by the given WolrdState.
state
- the WorldState in which applicability is to be tested
public WorldState applyIn(WorldState state)
This function computes a new WorldState that is the result of applying this Action in the given state. The Action should be applicable or the result of this function may not be as expected. If assertions are switched on, applicability will be tested. The resulting WorldState is computed by first removing all the negative effects of the given Action from this state and then adding all the positive effects. This order is only relevant if this action may have inconsistent effects.
state
- the WorldState in which this Action to be applied
protected java.lang.String addrString()
This function returns a String that corresponds to the address of this Object in memory. Thus, this String should be unique to this Action. The returned String will begin with the character '@' followed by a hexadecimal number.
String a unique String for this Action
public boolean equals(java.lang.Object obj)
This function tests whether this and the given action are equal. This is true iff the unique ids of the two Actions are the same or iff they are the same Object.
equals
in class java.lang.Object
obj
- the Object this Action is compared to
public boolean equals(Action other)
public int hashCode()
This function returns a hash value for this action.
hashCode
in class java.lang.Object
public java.lang.String toString()
This function creates a String representation for this ActionType.
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |