ai.planning.propositional
Class ActionType

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

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

An ActionType represents a class of Actions. ActionTypes correspond to Operators in classical planning. In propositional planning the distinction between an ActionType and an Action is almost non-existent.

Author:
Gerhard Wickler

Field Summary
protected  ai.krr.NamedSymbol name
          the name of this action type (only used for external reference)
protected  ai.krr.propositions.Atom[] negEffects
          preconditions, negative and positive effects of this ActionTpye
protected  ai.krr.propositions.Atom[] posEffects
          preconditions, negative and positive effects of this ActionTpye
protected  ai.krr.propositions.Atom[] preconds
          preconditions, negative and positive effects of this ActionTpye
 
Constructor Summary
protected ActionType(ai.krr.NamedSymbol name, ai.krr.propositions.Atom[] pre, ai.krr.propositions.Atom[] negE, ai.krr.propositions.Atom[] posE)
           This constructor takes a NamedSymbol representing the name of the ActionType and three Arrays of propositional Atoms representing the preconditions, negative effects (also known as the delete list), and positive effects of this ActionType.
  ActionType(ai.krr.NamedSymbol name, java.util.Set<ai.krr.propositions.Atom> pre, java.util.Set<ai.krr.propositions.Atom> negE, java.util.Set<ai.krr.propositions.Atom> posE)
           This constructor takes a NamedSymbol representing the name of the ActionType and three Sets of propositional Atoms representing the preconditions, negative effects (also known as the delete list), and 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.
static boolean dependent(ActionType op1, ActionType op2)
           This function tests whether the two given ActionTypes are dependent.
 boolean equals(java.lang.Object obj)
           This function tests whether this and the given action type are equal.
 ai.krr.NamedSymbol getName()
           This function returns the NamedSymbol representing the name of this ActionType.
 ai.krr.propositions.Atom[] getNegativeEffects()
           This function returns the negative effects of this ActionTpye.
 ai.krr.propositions.Atom[] getNegativePreconditions()
           This function returns null as there are no negative preconditions in this representation.
 ai.krr.fol.Variable[] getParameters()
           This function is not supported as there are no parameters in the propositional representation.
 ai.krr.propositions.Atom[] getPositiveEffects()
           This function returns the positive effects of this ActionTpye.
 ai.krr.propositions.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.
 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

name

protected final ai.krr.NamedSymbol name
the name of this action type (only used for external reference)


preconds

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


negEffects

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


posEffects

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

Constructor Detail

ActionType

public ActionType(ai.krr.NamedSymbol name,
                  java.util.Set<ai.krr.propositions.Atom> pre,
                  java.util.Set<ai.krr.propositions.Atom> negE,
                  java.util.Set<ai.krr.propositions.Atom> posE)

This constructor takes a NamedSymbol representing the name of the ActionType and three Sets of propositional Atoms representing the preconditions, negative effects (also known as the delete list), and positive effects of this ActionType. Note that the two effect sets must be disjoint.

Parameters:
name - the name of this ActionType
pre - the Set of Atoms constituting preconditions
negE - the Set of Atoms constituting negative effects
posE - the Set of Atoms constituting positive effects

ActionType

protected ActionType(ai.krr.NamedSymbol name,
                     ai.krr.propositions.Atom[] pre,
                     ai.krr.propositions.Atom[] negE,
                     ai.krr.propositions.Atom[] posE)

This constructor takes a NamedSymbol representing the name of the ActionType and three Arrays of propositional Atoms representing the preconditions, negative effects (also known as the delete list), and positive effects of this ActionType. Note that the two effect sets must be disjoint and the Arrays should not contain duplicates.

Parameters:
name - the name of this ActionType
pre - the Atoms constituting preconditions
negE - the Atoms constituting negative effects
posE - the Atoms constituting positive 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.propositions.Atom>
Returns:
the name of this ActionType

getParameters

public ai.krr.fol.Variable[] getParameters()
                                    throws java.lang.UnsupportedOperationException

This function is not supported as there are no parameters in the propositional representation. Calling this function will cause an Exception to be thrown.

Specified by:
getParameters in interface ActionType<ai.krr.propositions.Atom>
Returns:
nothing
Throws:
java.lang.UnsupportedOperationException

getNegativePreconditions

public ai.krr.propositions.Atom[] getNegativePreconditions()
                                                    throws java.lang.UnsupportedOperationException

This function returns null as there are no negative preconditions in this representation.

Specified by:
getNegativePreconditions in interface ActionType<ai.krr.propositions.Atom>
Returns:
always null
Throws:
java.lang.UnsupportedOperationException

getPositivePreconditions

public final ai.krr.propositions.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.propositions.Atom>
Returns:
the preconditions associated with this ActionType

getNegativeEffects

public final ai.krr.propositions.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.propositions.Atom>
Returns:
the negative effects associated with this ActionType

getPositiveEffects

public final ai.krr.propositions.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.propositions.Atom>
Returns:
the positive effects associated with this ActionType

equals

public boolean equals(java.lang.Object obj)

This function tests whether this and the given action type are equal. It returns true iff the two types have the same preconditions, positive effects, and negative effects. Note that the name of the action type is ignored.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the Object this ActionType is compared to
Returns:
whether the two ActionTypes are equivalent

hashCode

public final 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

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

dependent

public static boolean dependent(ActionType op1,
                                ActionType op2)

This function tests whether the two given ActionTypes are dependent. Two ActionTypes are dependent if one deletes a precondition or a positive effect of the other. If there are at most n preconditions, positive, or negative effects defined for either ActionType then the time complexity of this operation is in O(n2).

Parameters:
op1 - the first given ActionType
op2 - the second given ActionType
Returns:
true iff the two types are dependent