public class Plan extends Object implements Cloneable, Comparable<Plan>
Contact: Don Brutzman (web.nps.navy.mil/~brutzman) brutzman@nps.navy.mil
Constructor and Description |
---|
Plan()
Creates a new instance of Plan
|
Plan(WorldState state)
Creates a new instance of Plan that includes the ending world state
|
Plan(WorldState state,
WorldState goal)
Creates a new instance of Plan that includes the ending world state
|
Modifier and Type | Method and Description |
---|---|
void |
addStep(PlanStep newStep)
Adds a step to the end of the plan
|
void |
addStep(PlanStep newStep,
int index)
Adds a step to the plan at the position specified by the index.
|
void |
clearSteps()
Deletes all steps from the plan
|
Object |
clone()
Returns a deep copy of the route, implements Cloneable
|
int |
compareTo(Plan plan2)
Implements Comparable--Compares routes based on their total distance
|
double |
cost()
Determines the "cost" to execute all steps in the plan
|
double |
distanceEstimate(WorldState goalState)
Computes the distance of the world state following completion
of the plan steps and an arbitrary goal state
|
double |
evaluate(WorldState goal)
Evaluates this plan relative to the goal (cost so far plus estimated remaining cost)
|
double |
getEvaluation()
Returns the plan's A* evaluation (cost + expected remaining cost)
|
PlanStep |
getStep(int index)
Returns the plan step specified by the index.
|
Plan |
increment(PlanStep step)
Creates a new plan consisting of this one plus one more step
|
boolean |
match(WorldState testState)
Compares the world state following execution of this plan against a
candidate to see if they match (e.g., the goal state has been achieved
|
int |
numSteps()
Returns the number of steps contained in the plan
|
List<SearchPlanStep> |
possibleSteps()
Returns an ArrayList containing all potential successor steps
|
PlanStep |
removeStep(int index)
Returns the plan step specified by the index and removes it from the plan.
|
void |
setEndState(WorldState state)
Sets the plan's end state
|
String |
toString()
Formats the route for text output
|
public Plan()
public Plan(WorldState state)
state
- world state upon the completion of all steps in the planpublic Plan(WorldState state, WorldState goal)
state
- world state upon the completion of all steps in the plangoal
- desired world state upon completion of the planpublic void setEndState(WorldState state)
state
- world state upon the completion of all steps in the planpublic List<SearchPlanStep> possibleSteps()
public Plan increment(PlanStep step)
step
- PlanStep objectpublic double cost()
public boolean match(WorldState testState)
testState
- world state to which the state at the end of this plan is being comparedWorldState
matches the testStatepublic double distanceEstimate(WorldState goalState)
goalState
- WorldState object.WorldState
with the goalState to measure how different they are.public final double evaluate(WorldState goal)
goal
- desired world state upon plan completion.public double getEvaluation()
public int numSteps()
public void addStep(PlanStep newStep)
newStep
- PlanStep object.public void addStep(PlanStep newStep, int index)
newStep
- plan step to be added to the planindex
- the plan position.public PlanStep getStep(int index)
index
- the plan position.public void clearSteps()
public PlanStep removeStep(int index)
index
- the plan position.public Object clone()
public int compareTo(Plan plan2)
compareTo
in interface Comparable<Plan>
plan2
- Object; can be the instance of Plan object.