Class PlanTest

  extended by ix.iplan.PlanTest
All Implemented Interfaces:
Direct Known Subclasses:
BlockStackingTest, ExpandPlanTestGroup, MissionaryTest, PlanTestDefaults, PlanTestGroup, TrainsTest

public class PlanTest
extends java.lang.Object
implements java.io.Serializable

Specifies a planning test.

A test specifies a domain, a task, a number of plans, and whether or not the test is exhaustive. It also gives the number of randomly reordered simulations to try per plan, and a "step limit" that the planner can use as a limit on how much work it should do.

The task can be specified either by an activity pattern in the task field or by a resource name (filename or URL) in the initialPlan field. The activity pattern is given as a string without initial and final parens, for example "test1" or "paint block-1 green". In some cases, it may make sense to specify both an initial plan and a task.

If the test is exhaustive, the auto-tester will expect to find exactly the specified number of plans, and it will consider the test a failure if it doesn't. If you just want to check the first solution and completely ignore the possibility of replanning, use 1 as the number of plans and don't make the test exhaustive. (That is also the default.) If you want to look at the first k solutions when there are more than k, use k as the number of plans and again make it not exhaustive.

For an exhaustive test, the number of solutions (plans) is also the number of replans. An exhaustive test should continue until we run out of alternative plans. So if there are k solutions, we should replan k times (there's the first plan, then k-1 replans to get the k-1 other solutions, then one more replan to get the out-of-alternatives exception). This is a nice coincidence, but may not be exactly what's expected.

Each plan is tested, when found, by running an execution simulator. The plan is first executed in whatever order the simulator naturally selects. That order will always be the same for the same plan. If this PlanTest's randomSimulations field has a value greater than zero, the similator will be used to simulate the plan's execution that many more times in a way that randomly permutes the execution order (subject to any ordering constraints). The simulator does this is a way that always generates the same sequence of permutations for the same plan, so that the simulations are repeatable. By default no random simulations will be done.

When the planner finds it unusually difficult to find a plan (or to determine that it can't find one), this PlanTest's stepLimit field can be set to a value large enough to let the planner do enough work. The required value is necessarily implementational and must be determined empirically.

Note that if certain fields of a PlanTest are not specified, they can default to values from another PlanTest. Defaults can be specified by using a PlanTestDefaults or by expanding a test group. See takeDefaults(PlanTest).

The PlanTest class is very like O-Plan's plan-test class, and parts of this doc comment are based on the one for O-Plan.

See Also:
AutoTester, PlanCheckingSimulator, PlanCheckingSimulator.setShuffle(boolean), Serialized Form

Field Summary
protected  java.lang.String domain
protected  java.lang.String initialPlan
protected  boolean isExhaustive
protected  int plans
protected  int randomSimulations
protected  int stepLimit
protected  java.lang.String task
Constructor Summary
Method Summary
 java.lang.String getDomain()
 java.lang.String getInitialPlan()
 boolean getIsExhaustive()
 int getPlans()
 int getRandomSimulations()
 int getStepLimit()
 java.lang.String getTask()
 AutoTester.TestRunner makeTestRunner(AutoTester auto)
          Factory method that returns a new TestRunner that should be used to run this test.
 void setDomain(java.lang.String domain)
 void setInitialPlan(java.lang.String initialPlan)
 void setIsExhaustive(boolean isExhaustive)
 void setPlans(int plans)
 void setRandomSimulations(int randomSimulations)
 void setStepLimit(int stepLimit)
 void setTask(java.lang.String task)
(package private)  void takeDefaults(PlanTest defaults)
          Takes field values from the specified PlanTest which will usually be an instance of PlanTestDefaults or of ExpandPlanTestGroup.
 java.lang.String taskDescription()
          Returns a short textual description of the task or problem that this test gives to the planner.
 java.lang.String testDescription()
          Returns a short textual description of this test.
 java.lang.String toString()
          Returns "className[...]" wrapped around the result of calling testDescription().
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail


protected java.lang.String domain


protected java.lang.String task


protected java.lang.String initialPlan


protected int plans


protected boolean isExhaustive


protected int randomSimulations


protected int stepLimit
Constructor Detail


public PlanTest()
Method Detail


public java.lang.String getDomain()


public void setDomain(java.lang.String domain)


public java.lang.String getTask()


public void setTask(java.lang.String task)


public java.lang.String getInitialPlan()


public void setInitialPlan(java.lang.String initialPlan)


public int getPlans()


public void setPlans(int plans)


public boolean getIsExhaustive()


public void setIsExhaustive(boolean isExhaustive)


public int getRandomSimulations()


public void setRandomSimulations(int randomSimulations)


public int getStepLimit()


public void setStepLimit(int stepLimit)


void takeDefaults(PlanTest defaults)
Takes field values from the specified PlanTest which will usually be an instance of PlanTestDefaults or of ExpandPlanTestGroup. Only some fields can be defaulted; currently they are domain, initialPlan, randomSimulations, stepLimit, and isExhaustive.


public AutoTester.TestRunner makeTestRunner(AutoTester auto)
Factory method that returns a new TestRunner that should be used to run this test. This allows PlanTest subclasses to vary the way in which tests are processed.


public java.lang.String testDescription()
Returns a short textual description of this test. It should include the domain name and a description of the task or problem. Examples:
   Domain duplicate-effect-test, Task test1
   Domain blocks-pure-htn-1, Problem ca,b-abc

The method defined by the PlanTest class calls getDomain() and taskDescription().

The testDescription() method is called by toString().


public java.lang.String taskDescription()
Returns a short textual description of the task or problem that this test gives to the planner.

The method defined by the PlanTest class returns the result of calling getTask(), if that is not null, and otherwise calls getInitialPlan(). If the initial-plan string begins with this test's domain name, those characters are removed from the description, as are any characters after and including any final ".". For example, if the test has domain "example" and initial-plan "example-init-plan-1.xml", the result will be "-init-plan-1".

See Also:


public java.lang.String toString()
Returns "className[...]" wrapped around the result of calling testDescription().

toString in class java.lang.Object