ai.planning.propositional
Class Goal

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

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

A goal is defined as a set of Atoms in propositional planning. Implicitly defined is the set of goal states which are exactly those WorldStates in which the Goal is satisfied. This can be tested using the function satisfiedIn(WorldState).

Author:
Gerhard Wickler

Field Summary
protected  java.util.Set<ai.krr.propositions.Atom> goals
          the set of Atoms that define this Goal
 
Constructor Summary
Goal(ai.krr.propositions.Atom... atoms)
           This constructor creates a new Goal in which the given Atoms are to be achieved.
Goal(java.util.Set<ai.krr.propositions.Atom> atoms)
           This constructor creates a new Goal in which the given Atoms are to be achieved.
 
Method Summary
 Goal clone()
           This function creates a copy of this Goal.
 boolean equals(java.lang.Object obj)
           This function tests whether this and the given Goal are equal.
 java.util.Set<ai.krr.propositions.Atom> getNegativeGoals()
           This function is not supported as there are no negative goals.
 java.util.Set<ai.krr.propositions.Atom> getPositiveGoals()
           This function returns the set of goal conditions that define this Goal.
 int hashCode()
           This function returns a hash value for this Goal.
 boolean isRelevant(Action<ai.krr.propositions.Atom> action)
           This function tests whether the given Action is relevant for this Goal.
 Goal regress(Action<ai.krr.propositions.Atom> action)
           This function computes a new Goal that is the result of regressing this Goal through the given Action.
 boolean satisfiedIn(WorldState<ai.krr.propositions.Atom> state)
           This function tests whether this Goal is achieved in the given state.
 java.lang.String toString()
           This function creates a String representation for this Goal.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

goals

protected final java.util.Set<ai.krr.propositions.Atom> goals
the set of Atoms that define this Goal

Constructor Detail

Goal

public Goal(java.util.Set<ai.krr.propositions.Atom> atoms)

This constructor creates a new Goal in which the given Atoms are to be achieved.

Parameters:
atoms - the goal conditions to be achieved in some WorldState

Goal

public Goal(ai.krr.propositions.Atom... atoms)

This constructor creates a new Goal in which the given Atoms are to be achieved.

Parameters:
atoms - the goal conditions to be achieved in some WorldState
Method Detail

clone

public Goal clone()

This function creates a copy of this Goal. Subsequent modifications will not change the original Goal.

Overrides:
clone in class java.lang.Object
Returns:
a new Goal with the same Atoms

getPositiveGoals

public final java.util.Set<ai.krr.propositions.Atom> getPositiveGoals()

This function returns the set of goal conditions that define this Goal.

Specified by:
getPositiveGoals in interface Goal<ai.krr.propositions.Atom>
Returns:
the set of Atoms to be achieved for this Goal

getNegativeGoals

public java.util.Set<ai.krr.propositions.Atom> getNegativeGoals()

This function is not supported as there are no negative goals.

Specified by:
getNegativeGoals in interface Goal<ai.krr.propositions.Atom>
Returns:
an Exception

isRelevant

public boolean isRelevant(Action<ai.krr.propositions.Atom> action)

This function tests whether the given Action is relevant for this Goal. It returns true iff at least one of the Action's positive effects is part of this goal and none of the negative effects are goal conditions.

Specified by:
isRelevant in interface Goal<ai.krr.propositions.Atom>
Parameters:
action - the Action to be tested for relevance
Returns:
whether the given Action may contribute to achieving this Goal

regress

public Goal regress(Action<ai.krr.propositions.Atom> action)

This function computes a new Goal that is the result of regressing this Goal through the given Action. The given Action should be relevant or the result of this function may not be as expected. If assertions are switched on, relevance will be tested. The resulting Goal is computed by first removing all the positive effects of the given Action from this Goal and then adding all the preconditions.

Specified by:
regress in interface Goal<ai.krr.propositions.Atom>
Parameters:
action - the (relevant) Action used for regression in this Goal
Returns:
a new Goal that is the result of the reverse state transition function applied to this Gaol

satisfiedIn

public boolean satisfiedIn(WorldState<ai.krr.propositions.Atom> state)

This function tests whether this Goal is achieved in the given state. This is true if all the Atoms in the Goal are true in the given WorldState.

Specified by:
satisfiedIn in interface Goal<ai.krr.propositions.Atom>
Parameters:
state - the WorldState in which this Goal may be satisfied
Returns:
whether all the goal conditions are satisfied in the state

equals

public boolean equals(java.lang.Object obj)

This function tests whether this and the given Goal are equal. It returns true iff the two Goals contain exactly the same Atoms.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the Object this Goal is compared to
Returns:
whether the same Atoms must hold in both Goals

hashCode

public int hashCode()

This function returns a hash value for this Goal.

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 Goal. This is simply the String representing the contained Set of Atoms.

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