ai.planning.strips
Class ActionType

java.lang.Object
  extended by ai.planning.strips.ActionType
All Implemented Interfaces:
ActionType<ai.krr.fol.Atom>

public class ActionType
extends java.lang.Object
implements ActionType<ai.krr.fol.Atom>

An ActionType represents a class of Actions. ActionTypes correspond to Operators in classical STRIPS planning.

Author:
Gerhard Wickler

Nested Class Summary
static class ActionType.ArrayGrounding
           A Substitution maps a set of Variables to a set of Terms.
 
Field Summary
protected  ai.krr.NamedSymbol name
          the name of this action type (used to refer to this type)
protected  ai.krr.fol.Atom[] negativeEffects
          preconditions, negative and positive effects of this ActionTpye
protected  ai.krr.fol.Atom[] negativePreconds
          preconditions, negative and positive effects of this ActionTpye
protected  ai.krr.fol.Variable[] params
          the variables representing the parameters of this action type
protected  ai.krr.fol.Atom[] positiveEffects
          preconditions, negative and positive effects of this ActionTpye
protected  ai.krr.fol.Atom[] positivePreconds
          preconditions, negative and positive effects of this ActionTpye
 
Constructor Summary
ActionType(ai.krr.NamedSymbol name, java.util.List<ai.krr.fol.Variable> vars, java.util.Collection<ai.krr.fol.Literal> preconds, java.util.Collection<ai.krr.fol.Literal> effects)
           This constructor takes a NamedSymbol representing the name of the ActionType, a List of Variables representing the parameters of the ActionType, and two Lists of propositional Literals representing the preconditions and effects of this ActionType.
ActionType(ai.krr.NamedSymbol name, java.util.List<ai.krr.fol.Variable> vars, java.util.List<ai.krr.fol.Atom> negP, java.util.List<ai.krr.fol.Atom> posP, java.util.List<ai.krr.fol.Atom> negE, java.util.List<ai.krr.fol.Atom> posE)
           This constructor takes a NamedSymbol representing the name of the ActionType, a List of Variables representing the parameters of the ActionType, and four Lists of propositional Atoms representing the negative and positive preconditions, the negative effects (also known as the delete list), and the positive effects of this ActionType.
 
Method Summary
protected  ActionType clone()
           This class does not support cloning and an Exception will be thrown if this method is called.
protected static boolean disjoint(ai.krr.fol.Atom[] atoms1, ai.krr.fol.Atom[] atoms2)
           
static boolean disjoint(ai.krr.fol.Atom[] atoms1, ai.krr.fol.Atom[] atoms2, Grounding g)
           
static boolean fullyGrounded(ai.krr.fol.Atom atom, Grounding g)
           
 java.util.List<Action> getApplicableActions(WorldState state, boolean allowComplements)
           This function returns a List of all the Actions that are instances of this ActionType and which are applicable in the given WorldState.
 ai.krr.NamedSymbol getName()
           This function returns the NamedSymbol representing the name of this ActionType.
 ai.krr.fol.Atom[] getNegativeEffects()
           This function returns the negative effects of this ActionTpye.
 ai.krr.fol.Atom[] getNegativePreconditions()
           This function returns the preconditions that must be false in a WorldState before an Action of this type can be applied.
 ai.krr.fol.Variable[] getParameters()
           This function returns the variables representing parameters of this ActionType.
 ai.krr.fol.Atom[] getPositiveEffects()
           This function returns the positive effects of this ActionTpye.
 ai.krr.fol.Atom[] getPositivePreconditions()
           This function returns the preconditions that must be true in a WorldState before an Action of this type can be applied.
 int hashCode()
           This function returns a hash value for this action type.
protected static int nrVarsUnground(ai.krr.fol.Atom atom, Grounding g)
           
 java.lang.String toString()
           This function creates a String representation for this ActionType.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected final ai.krr.NamedSymbol name
the name of this action type (used to refer to this type)


params

protected final ai.krr.fol.Variable[] params
the variables representing the parameters of this action type


negativePreconds

protected final ai.krr.fol.Atom[] negativePreconds
preconditions, negative and positive effects of this ActionTpye


positivePreconds

protected final ai.krr.fol.Atom[] positivePreconds
preconditions, negative and positive effects of this ActionTpye


negativeEffects

protected final ai.krr.fol.Atom[] negativeEffects
preconditions, negative and positive effects of this ActionTpye


positiveEffects

protected final ai.krr.fol.Atom[] positiveEffects
preconditions, negative and positive effects of this ActionTpye

Constructor Detail

ActionType

public ActionType(ai.krr.NamedSymbol name,
                  java.util.List<ai.krr.fol.Variable> vars,
                  java.util.List<ai.krr.fol.Atom> negP,
                  java.util.List<ai.krr.fol.Atom> posP,
                  java.util.List<ai.krr.fol.Atom> negE,
                  java.util.List<ai.krr.fol.Atom> posE)

This constructor takes a NamedSymbol representing the name of the ActionType, a List of Variables representing the parameters of the ActionType, and four Lists of propositional Atoms representing the negative and positive preconditions, the negative effects (also known as the delete list), and the positive effects of this ActionType.

Note that, for an ActionType to be valid, the following conditions must be satisfied:

Parameters:
name - the name of this ActionType
vars - the parameter list for this action type
negP - the List of Atoms constituting negative preconditions
posP - the List of Atoms constituting positive preconditions
negE - the List of Atoms constituting negative effects
posE - the List of Atoms constituting positive effects

ActionType

public ActionType(ai.krr.NamedSymbol name,
                  java.util.List<ai.krr.fol.Variable> vars,
                  java.util.Collection<ai.krr.fol.Literal> preconds,
                  java.util.Collection<ai.krr.fol.Literal> effects)

This constructor takes a NamedSymbol representing the name of the ActionType, a List of Variables representing the parameters of the ActionType, and two Lists of propositional Literals representing the preconditions and effects of this ActionType.

Note that, for an ActionType to be valid, the following conditions must be satisfied:

Parameters:
name - the name of this ActionType
vars - the parameter list for this action type
preconds - the List of Literals constituting preconditions
effects - the List of Literals constituting negative effects
Method Detail

clone

protected ActionType clone()
                    throws java.lang.CloneNotSupportedException

This class does not support cloning and an Exception will be thrown if this method is called.

Overrides:
clone in class java.lang.Object
Returns:
nothing
Throws:
java.lang.CloneNotSupportedException - will be thrown

getName

public final ai.krr.NamedSymbol getName()

This function returns the NamedSymbol representing the name of this ActionType.

Specified by:
getName in interface ActionType<ai.krr.fol.Atom>
Returns:
the name of this ActionType

getParameters

public final ai.krr.fol.Variable[] getParameters()

This function returns the variables representing parameters of this ActionType.

Specified by:
getParameters in interface ActionType<ai.krr.fol.Atom>
Returns:
the parameters manipulated by this ActionType

getNegativePreconditions

public final ai.krr.fol.Atom[] getNegativePreconditions()

This function returns the preconditions that must be false in a WorldState before an Action of this type can be applied.

Specified by:
getNegativePreconditions in interface ActionType<ai.krr.fol.Atom>
Returns:
the negative preconditions associated with this ActionType

getPositivePreconditions

public final ai.krr.fol.Atom[] getPositivePreconditions()

This function returns the preconditions that must be true in a WorldState before an Action of this type can be applied.

Specified by:
getPositivePreconditions in interface ActionType<ai.krr.fol.Atom>
Returns:
the positive preconditions associated with this ActionType

getNegativeEffects

public final ai.krr.fol.Atom[] getNegativeEffects()

This function returns the negative effects of this ActionTpye. Negative effects are deleted from a WorldState in which an Action of this type is applied.

Specified by:
getNegativeEffects in interface ActionType<ai.krr.fol.Atom>
Returns:
the negative effects associated with this ActionType

getPositiveEffects

public final ai.krr.fol.Atom[] getPositiveEffects()

This function returns the positive effects of this ActionTpye. Positive effects are added to a WorldState in which an Action of this type is applied.

Specified by:
getPositiveEffects in interface ActionType<ai.krr.fol.Atom>
Returns:
the positive effects associated with this ActionType

getApplicableActions

public java.util.List<Action> getApplicableActions(WorldState state,
                                                   boolean allowComplements)

This function returns a List of all the Actions that are instances of this ActionType and which are applicable in the given WorldState. The given boolean determines whether this List may contain Actions with inconsistent effects.

Parameters:
state - the WorldState in which the returned Actions are applicable
allowComplements - whether complementary effects are permitted
Returns:
an Iterator over all the applicable Actions

toString

public java.lang.String toString()

This function creates a String representation for this ActionType.

Overrides:
toString in class java.lang.Object
Returns:
the String representing this WorldState

hashCode

public int hashCode()

This function returns a hash value for this action type.

Overrides:
hashCode in class java.lang.Object
Returns:
an integer that can be used for hashing

disjoint

public static boolean disjoint(ai.krr.fol.Atom[] atoms1,
                               ai.krr.fol.Atom[] atoms2,
                               Grounding g)

fullyGrounded

public static boolean fullyGrounded(ai.krr.fol.Atom atom,
                                    Grounding g)

disjoint

protected static boolean disjoint(ai.krr.fol.Atom[] atoms1,
                                  ai.krr.fol.Atom[] atoms2)

nrVarsUnground

protected static int nrVarsUnground(ai.krr.fol.Atom atom,
                                    Grounding g)