|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ai.planning.strips.WorldState ai.planning.strips.ModelBasedState
public class ModelBasedState
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 situation. Atoms not in the set are considered to be false, i.e. this representation assumes a closed world.
Atom
Nested Class Summary | |
---|---|
static interface |
ModelBasedState.RelationModel
|
protected static class |
ModelBasedState.SetModel
|
Nested classes/interfaces inherited from class ai.planning.strips.WorldState |
---|
WorldState.MetaIterator<E>, WorldState.NoElementIterator<E> |
Field Summary | |
---|---|
protected ModelBasedState.RelationModel[] |
fluents
the (fluent) relations that hold in this state (indexed by predicate) |
protected ai.krr.NamedSymbol[] |
fRelSys
the array containing the fluent predicates (for indexing fluents) |
protected java.util.Map<ai.krr.NamedSymbol,ModelBasedState.RelationModel> |
statics
the (static) relations that hold in all states (indexed by predicate) |
Fields inherited from class ai.planning.strips.WorldState |
---|
domain, hashValue |
Constructor Summary | |
---|---|
ModelBasedState(java.util.Set<ai.krr.fol.Atom> atoms,
Domain domain)
This constructor creates a new WorldState in which the given Atoms are true. |
Method Summary | |
---|---|
void |
add(ai.krr.fol.Atom atom)
This function asserts the given Atom in this WorldState. |
ModelBasedState |
clone()
This function creates a copy of this WorldState. |
boolean |
entails(ai.krr.fol.Atom atom)
This function tests whether the given Atom holds in this WorldState. |
boolean |
equals(ModelBasedState state)
|
boolean |
equals(WorldState state)
This function tests whether this and the given state are equal. |
boolean |
falsifies(ai.krr.fol.Atom atom)
This function tests whether the given Atom does not hold in this WorldState. |
ModelBasedState.RelationModel |
getModel(ai.krr.NamedSymbol relation)
This function retrieves all those Atoms that are true for the given (static or fluent) relation in this state. |
java.util.Iterator<ai.krr.fol.Atom> |
iterator()
This function returns an Iterator that enumerates all the fluents that hold in this state. |
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. |
void |
retract(ai.krr.fol.Atom atom)
This function deletes the given Atom from this WorldState. |
int |
size()
This function returns the number of different fluents that are holding in this state. |
int |
size(ai.krr.NamedSymbol relation)
This function returns the number of atoms that are holding in this state for the given relation. |
java.lang.String |
toString()
This function creates a String representation for this WorldState. |
Methods inherited from class ai.planning.strips.WorldState |
---|
addAll, entailsAll, equals, getDomain, hashCode, retractAll |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.util.Map<ai.krr.NamedSymbol,ModelBasedState.RelationModel> statics
protected ai.krr.NamedSymbol[] fRelSys
protected ModelBasedState.RelationModel[] fluents
Constructor Detail |
---|
public ModelBasedState(java.util.Set<ai.krr.fol.Atom> atoms, Domain domain)
This constructor creates a new WorldState in which the given Atoms are true. Static relations that hold must be added in this constructor.
atoms
- the Atoms holding in this WorldStatedomain
- the Domain to which this WorldState refersMethod Detail |
---|
public ModelBasedState clone()
This function creates a copy of this WorldState. Subsequent modifications will not change the original state.
clone
in class WorldState
public int size()
This function returns the number of different fluents that are holding in this state.
size
in interface WorldState<ai.krr.fol.Atom>
size
in class WorldState
public 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.
size
in class WorldState
public 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 the given atom must be a fluent relation.
add
in interface WorldState<ai.krr.fol.Atom>
add
in class WorldState
atom
- the Atom that is to hold in this statepublic 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>
retract
in class WorldState
atom
- the Atom that is not to hold in this statepublic 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>
entails
in class WorldState
atom
- the Atom that may or may not be true
public 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>
falsifies
in class WorldState
atom
- the Atom that may or may not be true
public 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>
iterator
in class WorldState
public 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.
iterator
in class WorldState
relation
- the relation for which Atoms should be enumerated
public ModelBasedState.RelationModel getModel(ai.krr.NamedSymbol relation)
This function retrieves all those Atoms that are true for the given (static or fluent) relation in this state.
relation
- the relation that is sought
public boolean equals(WorldState state)
This function tests whether this and the given state are equal. It returns true iff the two states contain exactly the same fluents.
equals
in class WorldState
obj
- the Object this WorldState is compared to
public boolean equals(ModelBasedState state)
public java.lang.String toString()
This function creates a String representation for this WorldState. This is simply the String representing the contained Set of Atoms.
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |