public class AStar extends BestFirst
If a terminal function is provided via the setter method defined for OO-MDPs, then the 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| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<HashableState,java.lang.Double> |
cumulatedRewardMap
Data structure for maintaining g(n): the cost so far to node n
|
protected Heuristic |
heuristic
The heuristic function.
|
protected double |
lastComputedCumR
Store the most recent cumulative reward received to some node.
|
gc, internalPolicyactionTypes, debugCode, domain, gamma, hashingFactory, model, usingOptionModel| Constructor and Description |
|---|
AStar(SADomain domain,
StateConditionTest gc,
HashableStateFactory hashingFactory,
Heuristic heuristic)
Initializes A*.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
void |
postPlanPrep()
This method is called at the end of the
BestFirst.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
BestFirst.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.
|
planFromStatedeterministicPlannerInit, encodePlanIntoPolicy, hasCachedPlanForState, planContainsOption, planHasDupilicateStates, querySelectedActionForState, resetSolveraddActionType, applicableActions, getActionTypes, getDebugCode, getDomain, getGamma, getHashingFactory, getModel, setActionTypes, setDebugCode, setDomain, setGamma, setHashingFactory, setModel, solverInit, stateHash, toggleDebugPrintingclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddActionType, getActionTypes, getDebugCode, getDomain, getGamma, getHashingFactory, getModel, setActionTypes, setDebugCode, setDomain, setGamma, setHashingFactory, setModel, solverInit, toggleDebugPrintingprotected Heuristic heuristic
protected java.util.Map<HashableState,java.lang.Double> cumulatedRewardMap
protected double lastComputedCumR
public AStar(SADomain domain, StateConditionTest gc, HashableStateFactory hashingFactory, Heuristic heuristic)
domain - the domain in which to plangc - should evaluate to true for goal states; false otherwisehashingFactory - the state hashing factory to useheuristic - the planning heuristic. Should return non-positive values.public void prePlanPrep()
BestFirstBestFirst.planFromState(State) method and can be used initialize any special
data structures needed by the subclass. By default it does nothing.prePlanPrep in class BestFirstpublic void postPlanPrep()
BestFirstBestFirst.planFromState(State) method and can be used clean up any special
data structures needed by the subclass. By default it does nothing.postPlanPrep in class BestFirstpublic void insertIntoOpen(HashIndexedHeap<PrioritizedSearchNode> openQueue, PrioritizedSearchNode psn)
BestFirstPrioritizedSearchNode with more information),
it can override it.insertIntoOpen in class BestFirstopenQueue - 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)
BestFirstPrioritizedSearchNode with more information), it can override this method.updateOpen in class BestFirstopenQueue - 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 double computeF(PrioritizedSearchNode parentNode, Action generatingAction, HashableState successorState, double r)
BestFirstcomputeF in class BestFirstparentNode - 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 transition