|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectix.iplan.PlanCheckingSimulator
public class PlanCheckingSimulator
A simple plan-execution simulator that complains if any condition is not satisfied when a node-end is executed after obeying all ordering constraints. To ensure that it's an independent check, it doesn't share any interesting code with the planner. It doesn't even use a status-change propagation algorithm to determine the execution order; it just does a topological sort of the node-ends. However, it independently maintains a set of ready-to-execute node-ends in order to check that they wouldn't delete any of the executing node-end's conditions if they'd been chosen to execute instead.
This class is based on parts of O-Plan.
AutoTester
,
PlanTest
Nested Class Summary | |
---|---|
protected class |
PlanCheckingSimulator.CheckingInterpreter
|
protected class |
PlanCheckingSimulator.ExecOrderSorter
Topological sort for node-ends to provide a total order that can be used to simulate execution. |
Field Summary | |
---|---|
protected ComputeInterpreter |
computeInterpreter
|
protected java.util.List |
executionOrder
|
protected static Symbol |
FALSE
|
protected Ip2ModelManager |
modelManager
|
protected java.util.List |
problems
|
protected java.util.Random |
random
|
protected boolean |
randomized
|
protected long |
randomSeed
|
protected boolean |
shuffle
|
protected boolean |
trace
|
protected java.io.PrintStream |
traceOut
|
protected static Symbol |
TRUE
|
protected java.util.Map |
worldState
|
Constructor Summary | |
---|---|
PlanCheckingSimulator(Ip2 ip2)
Creates a simulator for the specified agent's current plan. |
|
PlanCheckingSimulator(Plan plan,
Domain domain)
Creates a simulator for the specified plan and domain. |
Method Summary | |
---|---|
protected void |
checkComputeCondition(Constraint c)
|
protected void |
checkComputeResult(LList p,
java.lang.Object expected,
java.lang.Object actual)
|
protected void |
checkConditions(PNodeEnd ne,
java.util.Set ready)
|
protected void |
checkForDeleters(PNodeEnd ne,
LList p,
java.lang.Object v,
java.util.Set ready)
|
protected void |
checkNodeEndStatusValue(PNodeEnd end)
|
protected void |
checkNodeEndStatusValues()
|
protected void |
checkNodeStatusValues()
|
void |
describeChangedWorldState()
|
void |
describeChangedWorldState(java.io.PrintStream out)
|
void |
describeFinalWorldState()
|
void |
describeFinalWorldState(java.io.PrintStream out)
|
protected void |
describeState(java.io.PrintStream out,
java.lang.String label,
java.util.Map state)
|
protected void |
doEffects(PNodeEnd ne)
|
protected java.util.List |
getConditions(PNodeEnd ne)
|
protected java.util.List |
getEffects(PNodeEnd ne)
|
java.util.List |
getExecutionOrder()
|
java.util.Map |
getInitialWorldStateMap()
|
java.util.List |
getProblems()
|
java.util.Map |
getWorldStateMap()
|
protected java.util.List |
keepIf(Status status,
java.util.List nodeEnds)
|
static void |
main(java.lang.String[] argv)
Standalone main program for testing. |
protected boolean |
matchComputeResult(java.lang.Object expected,
java.lang.Object actual)
|
protected java.util.List |
maybeShuffle(java.util.List list)
|
protected void |
nextExecFringe(java.util.Set ready,
java.util.Set waiting,
java.util.Set complete)
Moves node-ends from waiting to ready. |
protected void |
problem(java.lang.String description)
|
protected void |
processCommandLineArguments()
|
void |
randomize()
Changes this simulator's random number generator to one set up with a seed based on the current time. |
protected java.util.List |
removeIf(Status status,
java.util.List nodeEnds)
|
void |
report()
|
void |
report(java.io.PrintStream out)
|
void |
run()
Simulates execution. |
void |
setShuffle(boolean shuffle)
Controls whether the node-ends are permuted when putting them in order for execution. |
void |
setTrace(boolean trace)
Tells this simulator whether or not it should produce trace output. |
void |
setTraceOutput(java.io.PrintStream ps)
Sets the stream on which trace output appears. |
protected void |
traceln(java.lang.String message)
|
protected void |
traceln(java.lang.String message,
java.lang.Object obj)
|
protected void |
wrongStatusProblem(HasStatus h,
Status correct)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final Symbol TRUE
protected static final Symbol FALSE
protected Ip2ModelManager modelManager
protected ComputeInterpreter computeInterpreter
protected java.util.Map worldState
protected java.util.List problems
protected java.util.List executionOrder
protected java.util.Random random
protected boolean shuffle
protected boolean trace
protected long randomSeed
protected boolean randomized
protected java.io.PrintStream traceOut
Constructor Detail |
---|
public PlanCheckingSimulator(Ip2 ip2)
public PlanCheckingSimulator(Plan plan, Domain domain)
Method Detail |
---|
public void setShuffle(boolean shuffle)
If the argument is false, any current random number generator is discarded, and the simulator will not permute the node-ends.
There is no way to explicitly set the random seed (though
that might change in a subclass). There is a fixed default seed
to allow repeatable simulations; or else a seed based on the
current time can be set by calling randomize()
.
public void randomize()
setShuffle(boolean)
,
because this method calls setShuffle(true)
.
public void setTrace(boolean trace)
setTraceOutput(PrintStream)
public void setTraceOutput(java.io.PrintStream ps)
Debug.out
will be used.
setTrace(boolean)
public void run()
public java.util.List getProblems()
public java.util.Map getInitialWorldStateMap()
public java.util.Map getWorldStateMap()
public java.util.List getExecutionOrder()
public void report()
public void report(java.io.PrintStream out)
public void describeFinalWorldState()
public void describeFinalWorldState(java.io.PrintStream out)
public void describeChangedWorldState()
public void describeChangedWorldState(java.io.PrintStream out)
protected void describeState(java.io.PrintStream out, java.lang.String label, java.util.Map state)
protected java.util.List maybeShuffle(java.util.List list)
protected java.util.List removeIf(Status status, java.util.List nodeEnds)
protected java.util.List keepIf(Status status, java.util.List nodeEnds)
protected void checkNodeStatusValues()
protected void checkNodeEndStatusValues()
protected void checkNodeEndStatusValue(PNodeEnd end)
protected void wrongStatusProblem(HasStatus h, Status correct)
protected void nextExecFringe(java.util.Set ready, java.util.Set waiting, java.util.Set complete)
protected void traceln(java.lang.String message)
protected void traceln(java.lang.String message, java.lang.Object obj)
protected void problem(java.lang.String description)
protected void checkConditions(PNodeEnd ne, java.util.Set ready)
protected void checkForDeleters(PNodeEnd ne, LList p, java.lang.Object v, java.util.Set ready)
protected void checkComputeCondition(Constraint c)
protected void checkComputeResult(LList p, java.lang.Object expected, java.lang.Object actual)
protected boolean matchComputeResult(java.lang.Object expected, java.lang.Object actual)
protected void doEffects(PNodeEnd ne)
protected java.util.List getConditions(PNodeEnd ne)
protected java.util.List getEffects(PNodeEnd ne)
public static void main(java.lang.String[] argv)
-plan=resource name -trace=true or false, default true -shuffle=true or false, default false -randomize=true or false, default false
setTrace(boolean)
,
setShuffle(boolean)
,
randomize()
protected void processCommandLineArguments()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |