|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ai.planning.propositional.WorldState
public 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 propositional representation a WorldState consists of the set of propositional Atoms that are true in the represented situation. Atoms not in the set are considered to be false, i.e. this representation assumes a closed world.
Atom
Field Summary | |
---|---|
protected java.util.Set<ai.krr.propositions.Atom> |
holding
the set of Atoms that hold in this state |
Constructor Summary | |
---|---|
WorldState()
This constructor creates a new empty WorldState. |
|
WorldState(ai.krr.propositions.Atom... atoms)
This constructor creates a new WorldState in which exactly the given Atoms are true. |
|
WorldState(java.util.Set<ai.krr.propositions.Atom> atoms)
This constructor creates a new WorldState in which exactly the given Atoms are true. |
Method Summary | |
---|---|
void |
add(ai.krr.propositions.Atom atom)
This function asserts the given Atom in this WorldState. |
void |
addAll(ai.krr.propositions.Atom[] atoms)
This function asserts all the given Atoms in this WorldState. |
WorldState |
clone()
This function creates a copy of this WorldState. |
boolean |
entails(ai.krr.propositions.Atom atom)
This function tests whether the given Atom holds in this WorldState. |
boolean |
entailsAll(ai.krr.propositions.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 |
falsifies(ai.krr.propositions.Atom atom)
This function tests whether the given Atom does not hold in this WorldState. |
int |
hashCode()
This function returns a hash value for this state. |
java.util.Iterator<ai.krr.propositions.Atom> |
iterator()
This function returns an Iterator over all the Atoms that are holding in this WorldState. |
void |
retract(ai.krr.propositions.Atom atom)
This function deletes the given Atom from this WorldState. |
void |
retractAll(ai.krr.propositions.Atom[] atoms)
This function deletes all the given Atoms from this WorldState. |
int |
size()
This function returns the number of Atoms that are true in this state. |
java.lang.String |
toString()
This function creates a String representation for this WorldState. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.util.Set<ai.krr.propositions.Atom> holding
Constructor Detail |
---|
public WorldState()
This constructor creates a new empty WorldState. Initially nothing holds in this state.
public WorldState(java.util.Set<ai.krr.propositions.Atom> atoms)
This constructor creates a new WorldState in which exactly the given Atoms are true.
atoms
- the Set of Atoms holding in this WorldStatepublic WorldState(ai.krr.propositions.Atom... atoms)
This constructor creates a new WorldState in which exactly the given Atoms are true.
atoms
- the Atoms holding in this WorldStateMethod Detail |
---|
public WorldState clone()
This function creates a copy of this WorldState. Subsequent modifications will not change the original state. Note that the time complexity of this function is in O(n) where n is the number of Atoms that hold in this state, i.e. this function is relatively expensive.
clone
in class java.lang.Object
public int size()
This function returns the number of Atoms that are true in this state.
size
in interface WorldState<ai.krr.propositions.Atom>
public void add(ai.krr.propositions.Atom atom)
This function asserts the given Atom in this WorldState.
add
in interface WorldState<ai.krr.propositions.Atom>
atom
- the Atom that is to hold in this statepublic void addAll(ai.krr.propositions.Atom[] atoms)
This function asserts all the given Atoms in this WorldState.
addAll
in interface WorldState<ai.krr.propositions.Atom>
atoms
- the Atoms that are to hold in this statepublic void retract(ai.krr.propositions.Atom atom)
This function deletes the given Atom from this WorldState.
retract
in interface WorldState<ai.krr.propositions.Atom>
atom
- the Atom that is not to hold in this statepublic void retractAll(ai.krr.propositions.Atom[] atoms)
This function deletes all the given Atoms from this WorldState.
retractAll
in interface WorldState<ai.krr.propositions.Atom>
atoms
- the Atoms that are not to hold in this statepublic boolean entails(ai.krr.propositions.Atom atom)
This function tests whether the given Atom holds in this WorldState.
entails
in interface WorldState<ai.krr.propositions.Atom>
atom
- the Atom that may or may not be true
public boolean entailsAll(ai.krr.propositions.Atom[] atoms)
This function tests whether all the given Atoms hold in this WorldState.
entailsAll
in interface WorldState<ai.krr.propositions.Atom>
atoms
- the Atoms that may or may not be true
public boolean falsifies(ai.krr.propositions.Atom atom)
This function tests whether the given Atom does not hold in this WorldState.
falsifies
in interface WorldState<ai.krr.propositions.Atom>
atom
- the Atom that may or may not be true
public java.util.Iterator<ai.krr.propositions.Atom> iterator()
This function returns an Iterator over all the Atoms that are holding in this WorldState.
iterator
in interface java.lang.Iterable<ai.krr.propositions.Atom>
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 equal Atoms.
equals
in class java.lang.Object
obj
- the Object this WorldState is compared to
public int hashCode()
This function returns a hash value for this state.
hashCode
in class java.lang.Object
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 |