|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectai.planning.strips.WorldState
public abstract class WorldState
A WorldState is a logical representation of all the facts that are true in the state of the world represented by this WorldState. In AI planning this is often called a situation.
In the STRIPS representation a WorldState consists of the set of function-free, ground first-order Atoms that are true in the state. Atoms not in the given set are considered to be false, i.e. this representation assumes a closed world.The relations used in these Atoms can be divided into static and dynamic (fluent) relations, which depends on the underlying Domain. This is why the constructor for this class requires a Domain to be specified.
Atom
Nested Class Summary | |
---|---|
protected static class |
WorldState.MetaIterator<E>
|
protected static class |
WorldState.NoElementIterator<E>
|
Field Summary | |
---|---|
protected Domain |
domain
the Domain with respect to which this WorldState is defined |
protected int |
hashValue
the cashed (positive) hash value of this state or -1 if not yet computed |
Constructor Summary | |
---|---|
WorldState(Domain domain)
This constructor creates a new WorldState. |
Method Summary | |
---|---|
abstract void |
add(ai.krr.fol.Atom atom)
This function asserts the given Atom in this WorldState. |
void |
addAll(ai.krr.fol.Atom[] atoms)
This function asserts all the given Atoms in this WorldState. |
abstract WorldState |
clone()
This function creates a copy of this WorldState. |
abstract boolean |
entails(ai.krr.fol.Atom atom)
This function tests whether the given Atom holds in this WorldState. |
boolean |
entailsAll(ai.krr.fol.Atom[] atoms)
This function tests whether all the given Atoms hold in this WorldState. |
boolean |
equals(java.lang.Object obj)
This function tests whether this and the given state are equal. |
boolean |
equals(WorldState state)
|
abstract boolean |
falsifies(ai.krr.fol.Atom atom)
This function tests whether the given Atom does not hold in this WorldState. |
Domain |
getDomain()
This function returns the Domain with which this WorldState is associated. |
int |
hashCode()
This function returns a (cached) hash value for this state. |
abstract java.util.Iterator<ai.krr.fol.Atom> |
iterator()
This function returns an Iterator that enumerates all the fluents that hold in this state. |
abstract java.util.Iterator<ai.krr.fol.Atom> |
iterator(ai.krr.NamedSymbol relation)
This function returns an Iterator that enumerates some of the fluents that hold in this state. |
abstract void |
retract(ai.krr.fol.Atom atom)
This function deletes the given Atom from this WorldState. |
void |
retractAll(ai.krr.fol.Atom[] atoms)
This function deletes all the given Atoms from this WorldState. |
abstract int |
size()
This function returns the number of Atoms (static and fluent) that are holding in this state. |
abstract int |
size(ai.krr.NamedSymbol relation)
This function returns the number of atoms that are holding in this state for the given relation. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Domain domain
protected int hashValue
Constructor Detail |
---|
public WorldState(Domain domain)
This constructor creates a new WorldState. Static and dynamic relations are defined by the given Domain.
domain
- the Domain to which this WorldState refersMethod Detail |
---|
public abstract WorldState clone()
This function creates a copy of this WorldState. Subsequent modifications will not change the original state.
clone
in class java.lang.Object
public abstract int size()
This function returns the number of Atoms (static and fluent) that are holding in this state.
size
in interface WorldState<ai.krr.fol.Atom>
public abstract int size(ai.krr.NamedSymbol relation)
This function returns the number of atoms that are holding in this state for the given relation. The relation may be fluent or static.
public abstract void add(ai.krr.fol.Atom atom)
This function asserts the given Atom in this WorldState. Note that all static relations must be defined in the constructor and thus this atom must be a fluent relation.
add
in interface WorldState<ai.krr.fol.Atom>
atom
- the Atom that is to hold in this statepublic abstract void retract(ai.krr.fol.Atom atom)
This function deletes the given Atom from this WorldState. Note that the given Atom should be a fluent relation.
retract
in interface WorldState<ai.krr.fol.Atom>
atom
- the Atom that is not to hold in this statepublic abstract boolean entails(ai.krr.fol.Atom atom)
This function tests whether the given Atom holds in this WorldState.
entails
in interface WorldState<ai.krr.fol.Atom>
atom
- the Atom that may or may not be true
public abstract boolean falsifies(ai.krr.fol.Atom atom)
This function tests whether the given Atom does not hold in this WorldState.
falsifies
in interface WorldState<ai.krr.fol.Atom>
atom
- the Atom that may or may not be true
public abstract java.util.Iterator<ai.krr.fol.Atom> iterator()
This function returns an Iterator that enumerates all the fluents that hold in this state.
iterator
in interface java.lang.Iterable<ai.krr.fol.Atom>
public abstract java.util.Iterator<ai.krr.fol.Atom> iterator(ai.krr.NamedSymbol relation)
This function returns an Iterator that enumerates some of the fluents that hold in this state. The enumerated Atoms are exactly those that are related by the given relation.
relation
- the relation for which Atoms should be enumerated
public void addAll(ai.krr.fol.Atom[] atoms)
This function asserts all the given Atoms in this WorldState.
addAll
in interface WorldState<ai.krr.fol.Atom>
atoms
- the Atoms that are to hold in this statepublic void retractAll(ai.krr.fol.Atom[] atoms)
This function deletes all the given Atoms from this WorldState.
retractAll
in interface WorldState<ai.krr.fol.Atom>
atoms
- the Atoms that are not to hold in this statepublic boolean entailsAll(ai.krr.fol.Atom[] atoms)
This function tests whether all the given Atoms hold in this WorldState.
entailsAll
in interface WorldState<ai.krr.fol.Atom>
atoms
- the Atoms that may or may not be true
public final Domain getDomain()
This function returns the Domain with which this WorldState is associated.
public boolean equals(java.lang.Object obj)
This function tests whether this and the given state are equal. It returns true iff the two states contain exactly the same fluent Atoms. Static relations are ignored!
equals
in class java.lang.Object
obj
- the Object this WorldState is compared to
public boolean equals(WorldState state)
public int hashCode()
This function returns a (cached) hash value for this state.
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |