|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectPathPlan.PathPlanner
public class PathPlanner
Class to plan paths in a deterministic MDP with positive costs using Dijkstra's algorithm or A*. Plans "backwards" (ie, processes goals first and works towards start) so that we can handle multiple (disjunctive) goals.
| Constructor Summary | |
|---|---|
PathPlanner()
|
|
| Method Summary | |
|---|---|
void |
addGoal(int node)
Add a goal state. |
void |
addGoal(int node,
double cost)
Add a goal state with a specified cost. |
double |
costOf(int state)
Get the planned cost of a state. |
boolean |
costOK(int state)
Check whether we know the cost-to-go of a state. |
int |
getAction(int state)
Get the next action in our plan. |
boolean |
getActionOK(int state)
Check whether we've planned an action for a given state. |
int[] |
getPath(int state)
Get the path from a state to the nearest goal. |
int[] |
getPath(int state,
int[] path)
Get the path from a state to the nearest goal. |
int[] |
getPolicy()
|
int |
getStart()
Get the start state. |
double[] |
getTotalCosts()
|
boolean[] |
getWorking()
|
void |
init(MDP m)
Get ready to plan paths in a given MDP. |
boolean |
isGoal(int state)
Check whether we're at a goal. |
static void |
main(java.lang.String[] args)
|
double |
plan()
Plan using however many iterations it takes; equivalent to plan(int) with maxiter=0}. |
double |
plan(int maxiters)
Find lowest-cost paths. |
int[] |
prunePath(int[] path)
Delete nodes from a path to try to make it shorter. |
void |
setStart(int start)
Set the start state. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PathPlanner()
| Method Detail |
|---|
public void init(MDP m)
plan(int)) to compute the allowable predecessors for a given
state.
m - The MDP.public void setStart(int start)
start - The desired starting state.public int getStart()
public void addGoal(int node)
init(PathPlan.MDP) and before plan(int), and may be called as many
times as desired during this interval.
node - The goal node to add. The planning problem is over
once we've reached any one of the goal nodes.
public void addGoal(int node,
double cost)
addGoal(int) for restrictions.
node - The goal node to add.cost - The cost of using this node to finish the planning
problem.public double plan(int maxiters)
maxiters - Expand no more than this many nodes. Set to 0
to allow however many expansions it takes to finish planning.public double plan()
plan(int) with maxiter=0}.
public boolean getActionOK(int state)
state - Do we have an action for this state?public boolean isGoal(int state)
state - Is this state a goal?public boolean costOK(int state)
state - Do we know the cost for this state?public int getAction(int state)
state - Get the action for this state.
public int[] getPath(int state,
int[] path)
state - The starting state.path - Preallocated array to hold path, or null. Will be
reallocated if necessary to hold all returned states.
public int[] getPath(int state)
state - The starting state.public int[] prunePath(int[] path)
path - The path to prune.public double costOf(int state)
state - How much does it cost to get to a goal from here?public double[] getTotalCosts()
public boolean[] getWorking()
public int[] getPolicy()
public static void main(java.lang.String[] args)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||