public abstract class BestFirst extends DeterministicPlanner
If a terminal function is provided to subclasses of BestFirst, then the BestFirst search algorithm will not expand any nodes that are terminal states, as if there were no actions that could be executed from that state. Note that terminal states are not necessarily the same as goal states, since there could be a fail condition from which the agent cannot act, but that is not explicitly represented in the transition dynamics.
DeterministicPlanner.PlanningFailedException
gc, internalPolicy
actionTypes, debugCode, domain, gamma, hashingFactory, model, usingOptionModel
Constructor and Description |
---|
BestFirst() |
Modifier and Type | Method and Description |
---|---|
abstract double |
computeF(PrioritizedSearchNode parentNode,
Action generatingAction,
HashableState successorState,
double r)
This method returns the f-score for a state given the parent search node, the generating action, the state that was produced.
|
void |
insertIntoOpen(HashIndexedHeap<PrioritizedSearchNode> openQueue,
PrioritizedSearchNode psn)
This method is used to insert a prioritized search node into the openQueue.
|
SDPlannerPolicy |
planFromState(State initialState)
Plans and returns a
SDPlannerPolicy . |
void |
postPlanPrep()
This method is called at the end of the
planFromState(State) method and can be used clean up any special
data structures needed by the subclass. |
void |
prePlanPrep()
This method is called at the start of the
planFromState(State) method and can be used initialize any special
data structures needed by the subclass. |
void |
updateOpen(HashIndexedHeap<PrioritizedSearchNode> openQueue,
PrioritizedSearchNode openPSN,
PrioritizedSearchNode npsn)
This method is called whenever a search node already in the openQueue needs to have its information or priority updated to reflect a new search node.
|
deterministicPlannerInit, encodePlanIntoPolicy, hasCachedPlanForState, planContainsOption, planHasDupilicateStates, querySelectedActionForState, resetSolver
addActionType, applicableActions, getActionTypes, getDebugCode, getDomain, getGamma, getHashingFactory, getModel, setActionTypes, setDebugCode, setDomain, setGamma, setHashingFactory, setModel, solverInit, stateHash, toggleDebugPrinting
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addActionType, getActionTypes, getDebugCode, getDomain, getGamma, getHashingFactory, getModel, setActionTypes, setDebugCode, setDomain, setGamma, setHashingFactory, setModel, solverInit, toggleDebugPrinting
public abstract double computeF(PrioritizedSearchNode parentNode, Action generatingAction, HashableState successorState, double r)
parentNode
- the parent search node (and its priority) that from which the next state was generated.generatingAction
- the action that was used to generate the next state.successorState
- the next state that was generatedr
- the reward received for the transitionpublic void prePlanPrep()
planFromState(State)
method and can be used initialize any special
data structures needed by the subclass. By default it does nothing.public void postPlanPrep()
planFromState(State)
method and can be used clean up any special
data structures needed by the subclass. By default it does nothing.public void insertIntoOpen(HashIndexedHeap<PrioritizedSearchNode> openQueue, PrioritizedSearchNode psn)
PrioritizedSearchNode
with more information),
it can override it.openQueue
- the open queue in which the search node will be inserted.psn
- the search node to insert.public void updateOpen(HashIndexedHeap<PrioritizedSearchNode> openQueue, PrioritizedSearchNode openPSN, PrioritizedSearchNode npsn)
PrioritizedSearchNode
with more information), it can override this method.openQueue
- the open queue in which the search node exists.openPSN
- the search node indexed in the open queue that will be updated.npsn
- the new search node that contains the updated information.public SDPlannerPolicy planFromState(State initialState)
SDPlannerPolicy
. If
a State
is not in the solution path of this planner, then
the SDPlannerPolicy
will throw
a runtime exception. If you want a policy that will dynamically replan for unknown states,
you should create your own DDPlannerPolicy
.initialState
- the initial state of the planning problemSDPlannerPolicy
.