|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ai.planning.propositional.Problem
public class Problem
A planning problem over a planning Domain is defined by an initial WorldState and a Goal.
Field Summary | |
---|---|
protected Domain |
domain
the Domain over which this problem is defined |
protected Goal |
goal
the goal condition to be achieved |
protected WorldState |
initialState
the initial state of the world |
protected static inf.compilers.SyntaxAdaptor<Problem> |
ioAdaptor
the SyntaxAdaptor used for input/output operations |
Constructor Summary | |
---|---|
Problem(Domain d,
WorldState s0,
Goal g)
This constructor creates a new planning problem over the given domain. |
Method Summary | |
---|---|
protected Problem |
clone()
This class does not support cloning and an Exception will be thrown if this method is called. |
Domain |
getDomain()
This function returns the domain over which this Problem is defined. |
Goal |
getGoal()
This function returns the goal conditions that define this Problem. |
WorldState |
getInitialState()
This function returns the initial state of the world that defines this Problem. |
int |
hashCode()
This function returns a hash value for this problem. |
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 Problem |
read(java.io.Reader r,
inf.compilers.SyntaxAdaptor<Problem> sa)
This function can be used to parse a Problem from the given Reader. |
static Problem |
readFromFile(java.io.File file)
This convenience function can be used to read a Problem from the given File. |
static void |
setSyntax(inf.compilers.SyntaxAdaptor<Problem> 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 Problem. |
void |
write(java.io.Writer w,
inf.compilers.SyntaxAdaptor sa)
This function can be used write this propositional planning problem to the given Writer. |
void |
writeToFile(java.io.File file)
This convenience function can be used to write this Problem to the given File. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static inf.compilers.SyntaxAdaptor<Problem> ioAdaptor
protected final Domain domain
protected final WorldState initialState
protected final Goal goal
Constructor Detail |
---|
public Problem(Domain d, WorldState s0, Goal g)
This constructor creates a new planning problem over the given domain.
d
- the domain over which the problem is defineds0
- the initial state of the worldg
- the goal to be achievedMethod Detail |
---|
protected Problem 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 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 planning problem 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 Problem 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 final Domain getDomain()
This function returns the domain over which this Problem is defined.
getDomain
in interface Problem<ai.krr.propositions.Atom>
public final WorldState getInitialState()
This function returns the initial state of the world that defines this Problem.
getInitialState
in interface Problem<ai.krr.propositions.Atom>
public final Goal getGoal()
This function returns the goal conditions that define this Problem.
getGoal
in interface Problem<ai.krr.propositions.Atom>
public void writeToFile(java.io.File file) throws java.io.IOException, inf.compilers.ExpressivenessException
This convenience function can be used to write this Problem to the given
File. Note that it actually pretty-prints this Problem. The SyntaxAdaptor
used can specified using setSyntax(SyntaxAdaptor)
.
file
- the File to which this Problem 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 Problem. 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 Problem 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 problem.
hashCode
in class java.lang.Object
public static void setSyntax(inf.compilers.SyntaxAdaptor<Problem> 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
PplProblemAdaptor
.
sa
- the SyntaxAdaptor that defines the syntax for I/O operationspublic static Problem read(java.io.Reader r, inf.compilers.SyntaxAdaptor<Problem> sa) throws inf.compilers.ExpressivenessException, java.text.ParseException, java.io.IOException
This function can be used to parse a Problem from the given Reader. The syntax that is expected from the input and how this is transformed into a propositional planning problem is determined by the given SyntaxAdaptor.
r
- the Reader from which character input is parsedsa
- the SyntaxAdaptor that creates the Problem
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 Problem readFromFile(java.io.File file) throws inf.compilers.ExpressivenessException, java.text.ParseException, java.io.IOException
This convenience function can be used to read a Problem 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 Problem 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 |