mit.ai.techniques
Class PlanningProblem

java.lang.Object
  |
  +--mit.ai.techniques.PlanningProblem

public class PlanningProblem
extends java.lang.Object

This class represents the planning problem.


Field Summary
private  Conjunction goalConditions
           
private  Conjunction initialConditions
          Stop searching after this size.
static int maxPlanDepth
           
private  java.util.Vector operators
           
private  java.util.Hashtable symbolTable
           
 
Constructor Summary
PlanningProblem(java.lang.String path)
          Make a planning problem from a file.
 
Method Summary
 void addMaintenanceOperators(java.util.Vector operators)
          For each literal in the symbol table, make a new maintenance operator and add it to the vector of operators.
private  void assertString(java.io.StreamTokenizer st)
          Throw an exception if the current token isn't a string.
private  void eatLineFeeds(java.io.StreamTokenizer st)
          Be sure the next token is a line feed and eat it and any following line feeds.
 java.util.Vector getOperators()
          Return the operators.
 java.util.Hashtable getSymbolTable()
          Return the symbol table.
private  void makeSymbolTable(java.io.StreamTokenizer st)
          The first line of the input file is a list of all the propositions.
private  Conjunction readConjunction(java.io.StreamTokenizer st)
          Read a conjunction from the current line of the input file.
private  Operator readOperator(java.io.StreamTokenizer st)
          An operator has a name on one line, then the next line represents a conjunction of preconditions and the next line represents a conjunction of effects.
private  java.util.Vector readOperators(java.io.StreamTokenizer st)
          Read in operators until we hit the end of the file.
 java.lang.String toString()
          Create a string representing the problem.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

maxPlanDepth

public static int maxPlanDepth

initialConditions

private Conjunction initialConditions
Stop searching after this size.

goalConditions

private Conjunction goalConditions

operators

private java.util.Vector operators

symbolTable

private java.util.Hashtable symbolTable
Constructor Detail

PlanningProblem

public PlanningProblem(java.lang.String path)
Make a planning problem from a file. Format is this: First, on a single line, delimited by spaces, all of the proposition names are listed. Then, on a single line, the initial state is listed. Negated propositions are represented by !name. On the next line, the goal is listed. The remainder of the file holds the operators. Each one takes three lines: name, preconds, effects.
Method Detail

makeSymbolTable

private void makeSymbolTable(java.io.StreamTokenizer st)
                      throws java.io.IOException
The first line of the input file is a list of all the propositions. For each proposition, make a positive and a negative literal. The symbolTable will map the name "p" into the positive literal and the string "!p" into the negative literal. Consume trailing line feeds.

readConjunction

private Conjunction readConjunction(java.io.StreamTokenizer st)
                             throws java.io.IOException
Read a conjunction from the current line of the input file. Assume the first token is waiting for us. Consume the final line feeds.

readOperators

private java.util.Vector readOperators(java.io.StreamTokenizer st)
                                throws java.io.IOException
Read in operators until we hit the end of the file. Assume the first token is waiting for us.

readOperator

private Operator readOperator(java.io.StreamTokenizer st)
                       throws java.io.IOException
An operator has a name on one line, then the next line represents a conjunction of preconditions and the next line represents a conjunction of effects. Assume that the first token has been read. Leaves first token of next thing in ttype.

eatLineFeeds

private void eatLineFeeds(java.io.StreamTokenizer st)
                   throws java.io.IOException
Be sure the next token is a line feed and eat it and any following line feeds.

assertString

private void assertString(java.io.StreamTokenizer st)
Throw an exception if the current token isn't a string.

addMaintenanceOperators

public void addMaintenanceOperators(java.util.Vector operators)
For each literal in the symbol table, make a new maintenance operator and add it to the vector of operators.

getOperators

public java.util.Vector getOperators()
Return the operators.

getSymbolTable

public java.util.Hashtable getSymbolTable()
Return the symbol table.

toString

public java.lang.String toString()
Create a string representing the problem.
Overrides:
toString in class java.lang.Object