public class AStar extends BestFirst
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, internalPolicyactions, debugCode, domain, gamma, hashingFactory, mapToStateIndex, rf, tf| Constructor and Description |
|---|
AStar(Domain domain,
RewardFunction rf,
StateConditionTest gc,
HashableStateFactory hashingFactory,
Heuristic heuristic)
Initializes A*.
|
| Modifier and Type | Method and Description |
|---|---|
double |
computeF(PrioritizedSearchNode parentNode,
GroundedAction generatingAction,
HashableState successorState)
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, resetSolveraddNonDomainReferencedAction, getActions, getAllGroundedActions, getDebugCode, getDomain, getGamma, getHashingFactory, getRf, getRF, getTf, getTF, setActions, setDebugCode, setDomain, setGamma, setHashingFactory, setRf, setTf, solverInit, stateHash, toggleDebugPrinting, translateActionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddNonDomainReferencedAction, getActions, getDebugCode, getDomain, getGamma, getHashingFactory, getRf, getRF, getTf, getTF, setActions, setDebugCode, setDomain, setGamma, setHashingFactory, setRf, setTf, solverInit, toggleDebugPrintingprotected Heuristic heuristic
protected java.util.Map<HashableState,java.lang.Double> cumulatedRewardMap
protected double lastComputedCumR
public AStar(Domain domain, RewardFunction rf, StateConditionTest gc, HashableStateFactory hashingFactory, Heuristic heuristic)
domain - the domain in which to planrf - the reward function that represents costs as negative rewardgc - 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, GroundedAction generatingAction, HashableState successorState)
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 generated