|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ai.planning.propositional.Domain
public class Domain
A propositional planning domain corresponds to a state-transition system in which the state space is implicitly defined by the propositional Atoms used to define the Domain and the planning problems for this Domain. The state-transition function is also defined implicitly by the actions defined in the Domain. Thus, the most important explicit component defining Domain here is the set of ActionTypes the provide the possible actions. The only additional element defined here is the name of the Domain.
Field Summary | |
---|---|
protected static java.util.Map<ai.krr.NamedSymbol,Domain> |
allDomains
all known Domains indexed by their name |
protected static inf.compilers.SyntaxAdaptor<Domain> |
ioAdaptor
the SyntaxAdaptor used for input/output operations |
protected ai.krr.NamedSymbol |
name
the name given to this Domain |
protected java.util.List<ActionType> |
operators
the ActionTypes that define this Domain |
Constructor Summary | |
---|---|
Domain(ai.krr.NamedSymbol name,
ActionType... ops)
This constructor creates a new Domain that has the given name and is defined by the given ActionTypes. |
|
Domain(ai.krr.NamedSymbol name,
java.util.Collection<ActionType> ops)
This constructor creates a new Domain that has the given name and is defined by the given ActionTypes. |
Method Summary | |
---|---|
protected Domain |
clone()
This class does not support cloning and an Exception will be thrown if this method is called. |
ai.krr.NamedSymbol |
getName()
This function returns the name of this Domain. |
ActionType |
getOperator(ai.krr.NamedSymbol name)
This function returns the ActionType with the given name that may be defined in this Domain. |
java.util.List<ActionType> |
getOperators()
This function returns the List of ActionTypes that define this Domain. |
java.util.Set<Goal> |
getSubGoals(Goal goal)
This function computes the regression set of the given Goal. |
java.util.Set<Goal> |
getSubGoals(java.util.Set<Goal> goals)
This function computes the possible sub-goals of the given Set of Goals. |
java.util.Set<WorldState> |
getSuccessors(java.util.Set<WorldState> states)
This function computes all the successor states of the given Set of WorldStates. |
java.util.Set<WorldState> |
getSuccessors(WorldState state)
This function computes all the successor states of the given WorldState. |
int |
hashCode()
This function returns a hash value for this domain. |
void |
prettyPrint(int indent,
java.io.Writer w,
inf.compilers.SyntaxAdaptor sa)
This function can be used write this SyntaxAdaptable object to the given Writer. |
static Domain |
read(java.io.Reader r,
inf.compilers.SyntaxAdaptor<Domain> sa)
This function can be used to parse a Domain from the given Reader. |
static Domain |
readFromFile(java.io.File file)
This convenience function can be used to read a Domain from the given File. |
static void |
setSyntax(inf.compilers.SyntaxAdaptor<Domain> sa)
This function can be used to define the syntax with which instances of this class are written or read. |
java.lang.String |
toString()
This function returns a String representation of this Domain. |
void |
write(java.io.Writer w,
inf.compilers.SyntaxAdaptor sa)
This function can be used write this propositional Domain to the given Writer. |
void |
writeToFile(java.io.File file)
This convenience function can be used to write this Domain to the given File. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static java.util.Map<ai.krr.NamedSymbol,Domain> allDomains
protected static inf.compilers.SyntaxAdaptor<Domain> ioAdaptor
protected final ai.krr.NamedSymbol name
protected java.util.List<ActionType> operators
Constructor Detail |
---|
public Domain(ai.krr.NamedSymbol name, java.util.Collection<ActionType> ops)
This constructor creates a new Domain that has the given name and is defined by the given ActionTypes. Note that ActionTypes should have unique names, which is verified if assertions are on.
name
- the Symbol representing the name of this Domainops
- the ActionTypes in this Domainpublic Domain(ai.krr.NamedSymbol name, ActionType... ops)
This constructor creates a new Domain that has the given name and is defined by the given ActionTypes. This constructor simply uses the one taking a Collection of ActionTypes
name
- the Symbol representing the name of this Domainops
- the ActionTypes in this DomainMethod Detail |
---|
protected Domain clone() throws java.lang.CloneNotSupportedException
This class does not support cloning and an Exception will be thrown if this method is called.
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- will be thrownpublic final ai.krr.NamedSymbol getName()
This function returns the name of this Domain.
getName
in interface Domain<ai.krr.propositions.Atom>
public java.util.List<ActionType> getOperators()
This function returns the List of ActionTypes that define this Domain.
getOperators
in interface Domain<ai.krr.propositions.Atom>
public ActionType getOperator(ai.krr.NamedSymbol name)
This function returns the ActionType with the given name that may be defined in this Domain. It returns null if there is no ActionType with the given name.
getOperator
in interface Domain<ai.krr.propositions.Atom>
name
- the name identifying the ActionType
public void write(java.io.Writer w, inf.compilers.SyntaxAdaptor sa) throws inf.compilers.ExpressivenessException, java.io.IOException
This function can be used write this propositional Domain to the given Writer. The syntax in which it is written is defined by the SyntaxAdaptor that is also given to this function.
write
in interface inf.compilers.SyntaxAdaptable
w
- the Writer to which this Domain is writtensa
- the SyntaxAdaptor that determines the syntax
inf.compilers.ExpressivenessException
- if the syntax does not support every
construct occurring in this Domain
java.io.IOException
- if writing to the Writer failspublic void prettyPrint(int indent, java.io.Writer w, inf.compilers.SyntaxAdaptor sa) throws inf.compilers.ExpressivenessException, java.io.IOException
This function can be used write this SyntaxAdaptable object to the given Writer. The syntax is the same as for normal writing. The only difference is the inclusion of extra space and newlines for better readability.
prettyPrint
in interface inf.compilers.SyntaxAdaptable
indent
- the amount of indentation for the first linew
- the Writer to which this Sentence is writtensa
- the SyntaxAdaptor that determines the syntax
inf.compilers.ExpressivenessException
- if the syntax does not support every
construct occurring in this Sentence
java.io.IOException
- if writing to the Writer failspublic java.util.Set<WorldState> getSuccessors(WorldState state)
This function computes all the successor states of the given WorldState. This domain defines the ActionTypes that may be used to generate the successors.
state
- the WorldState from which the successors are generated
public java.util.Set<WorldState> getSuccessors(java.util.Set<WorldState> states)
This function computes all the successor states of the given Set of WorldStates. This domain defines the ActionTypes that may be used to generate the successors.
states
- the WorldStates from which the successors are generated
public java.util.Set<Goal> getSubGoals(Goal goal)
This function computes the regression set of the given Goal. If a WorldState satisfies any one of these sub-goals then a state in which this Goal is satisfied is reachable. This domain defines the ActionTypes that may be used to generate the sub-goals.
goal
- the Goal of which the possible sub-goals are to be computed
public java.util.Set<Goal> getSubGoals(java.util.Set<Goal> goals)
This function computes the possible sub-goals of the given Set of Goals. If a WorldState satisfies any one of these sub-goals then a state in which a Goal in the given Set is satisfied is reachable. This domain defines the ActionTypes that may be used to generate the sub-goals.
goals
- the Goals of which the possible sub-goals are to be computed
public void writeToFile(java.io.File file) throws java.io.IOException, inf.compilers.ExpressivenessException
This convenience function can be used to write this Domain to the given
File. Note that it actually pretty-prints this domain. The SyntaxAdaptor
used can specified using setSyntax(SyntaxAdaptor)
.
file
- the File to which this Domain is to be written
java.io.IOException
- if writing to the File fails
inf.compilers.ExpressivenessException
- if the SyntaxAdaptor used throws this Exceptionpublic java.lang.String toString()
This function returns a String representation of this Domain. The exact
syntax is determined by the SyntaxAdaptor used, which can be set using
setSyntax(SyntaxAdaptor)
. If the transformation causes an
ExpressivenessException (if there are constructs in this Domain that
cannot be expressed in the syntax) this function will return null.
toString
in class java.lang.Object
public int hashCode()
This function returns a hash value for this domain.
hashCode
in class java.lang.Object
public static void setSyntax(inf.compilers.SyntaxAdaptor<Domain> sa)
This function can be used to define the syntax with which instances of this
class are written or read. The default is the PPL syntax defined by a
PplDomainAdaptor
.
sa
- the SyntaxAdaptor that defines the syntax for I/O operationspublic static Domain read(java.io.Reader r, inf.compilers.SyntaxAdaptor<Domain> sa) throws inf.compilers.ExpressivenessException, java.text.ParseException, java.io.IOException
This function can be used to parse a Domain from the given Reader. The syntax that is expected from the input and how this is transformed into a propositional Domain is determined by the given SyntaxAdaptor.
r
- the Reader from which character input is parsedsa
- the SyntaxAdaptor that creates the Domain
inf.compilers.ExpressivenessException
- if the syntax does not support every
construct occurring in the input
java.text.ParseException
- if the input contains syntax errors
java.io.IOException
- if reading from the Reader failspublic static Domain readFromFile(java.io.File file) throws inf.compilers.ExpressivenessException, java.text.ParseException, java.io.IOException
This convenience function can be used to read a Domain from the given
File. It uses the SyntaxAdaptor that can be set using
setSyntax(SyntaxAdaptor)
to perform this operation.
file
- the File from which the Domain is to be read
inf.compilers.ExpressivenessException
- if the syntax does not support every
construct occurring in the input
java.text.ParseException
- if the input contains syntax errors
java.io.IOException
- if reading from the File fails
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |