ai.planning.strips
Class Problem

java.lang.Object
  extended by ai.planning.strips.Problem
All Implemented Interfaces:
Problem<ai.krr.fol.Atom>, inf.compilers.SyntaxAdaptable

public class Problem
extends java.lang.Object
implements Problem<ai.krr.fol.Atom>, inf.compilers.SyntaxAdaptable

A planning problem over a planning Domain is defined by an initial WorldState and a Goal. A SequentialPlan is a solution to such a planning problem if and only if its execution in the initial state results in a state in which the goal is satisfied.

Author:
Gerhard Wickler

Nested Class Summary
protected static class Problem.ObjectTypeSystem
           
 
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  ai.krr.NamedSymbol name
          the reference String that can be used to refer to this problem
protected  Problem.ObjectTypeSystem types
          the inferred DomainTypes for objects in this Problem (computed on demand)
 
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.
 boolean equals(java.lang.Object obj)
           This function tests whether this and the given problem are the same Object.
 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.
 java.util.Set<ai.krr.NamedSymbol> getInstances(Domain.DomainType type)
           
protected  Problem.ObjectTypeSystem getObjectTypeSystem()
           This function returns the inferred types for this Domain.
 int hashCode()
           This function returns a hash value for this problem.
protected  java.lang.String objectString()
           This function returns a String that is the String returned by this Object's toString function.
 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)
           
 java.lang.String toString()
           This function creates a String representation for this Problem.
 void write(java.io.Writer w, inf.compilers.SyntaxAdaptor sa)
          This function can be used write this logical Sentence to the given Writer.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

domain

protected Domain domain
the Domain over which this problem is defined


initialState

protected WorldState initialState
the initial state of the world


goal

protected Goal goal
the goal condition to be achieved


name

protected ai.krr.NamedSymbol name
the reference String that can be used to refer to this problem


types

protected Problem.ObjectTypeSystem types
the inferred DomainTypes for objects in this Problem (computed on demand)

Constructor Detail

Problem

public Problem(Domain d,
               WorldState s0,
               Goal g)

This constructor creates a new planning problem over the given domain.

Parameters:
d - the domain over which the problem is defined
s0 - the initial state of the world
g - the goal to be achieved
Method Detail

clone

protected Problem clone()
                 throws java.lang.CloneNotSupportedException

This class does not support cloning and an Exception will be thrown if this method is called.

Overrides:
clone in class java.lang.Object
Returns:
nothing
Throws:
java.lang.CloneNotSupportedException - will be thrown

getDomain

public Domain getDomain()

This function returns the domain over which this Problem is defined.

Specified by:
getDomain in interface Problem<ai.krr.fol.Atom>
Returns:
the Domain underlying this Problem

getInitialState

public WorldState getInitialState()

This function returns the initial state of the world that defines this Problem.

Specified by:
getInitialState in interface Problem<ai.krr.fol.Atom>
Returns:
the WorldState assumed to hold initially

getGoal

public Goal getGoal()

This function returns the goal conditions that define this Problem.

Specified by:
getGoal in interface Problem<ai.krr.fol.Atom>
Returns:
the Goal that is to be achieved in this Problem

write

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 logical Sentence to the given Writer. The syntax in which it is written is defined by the SyntaxAdaptor that is also given to this function.

Specified by:
write in interface inf.compilers.SyntaxAdaptable
Parameters:
w - the Writer to which this Sentence is written
sa - the SyntaxAdaptor that determines the syntax
Throws:
inf.compilers.ExpressivenessException - if the syntax does not support every construct occurring in this Sentence
java.io.IOException - if writing to the Writer fails

prettyPrint

public 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.

Specified by:
prettyPrint in interface inf.compilers.SyntaxAdaptable
Parameters:
indent - the amount of indentation for the first line
w - the Writer to which this Sentence is written
sa - the SyntaxAdaptor that determines the syntax
Throws:
inf.compilers.ExpressivenessException - if the syntax does not support every construct occurring in this Sentence
java.io.IOException - if writing to the Writer fails

getInstances

public java.util.Set<ai.krr.NamedSymbol> getInstances(Domain.DomainType type)

getObjectTypeSystem

protected Problem.ObjectTypeSystem getObjectTypeSystem()

This function returns the inferred types for this Domain. These will have to be computed the first time this function is called, but are then stored for future re-use.

Returns:
the DomainTypes that can be created for this Domain

objectString

protected java.lang.String objectString()

This function returns a String that is the String returned by this Object's toString function. Note that this makes it unique to this Problem.

String a unique String for this Problem


equals

public boolean equals(java.lang.Object obj)

This function tests whether this and the given problem are the same Object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the Object this Problem is compared to
Returns:
whether they are identical

hashCode

public int hashCode()

This function returns a hash value for this problem.

Overrides:
hashCode in class java.lang.Object
Returns:
an integer that can be used for hashing

toString

public java.lang.String toString()

This function creates a String representation for this Problem.

Overrides:
toString in class java.lang.Object
Returns:
the String representing this Problem

read

public static Problem read(java.io.Reader r,
                           inf.compilers.SyntaxAdaptor<Problem> sa)
                    throws inf.compilers.ExpressivenessException,
                           java.text.ParseException,
                           java.io.IOException
Throws:
inf.compilers.ExpressivenessException
java.text.ParseException
java.io.IOException