public class AStar extends BestFirst
DeterministicPlanner.PlanningFailedException
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<StateHashTuple,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, internalPolicy
actions, containsParameterizedActions, debugCode, domain, gamma, hashingFactory, mapToStateIndex, rf, tf
Constructor and Description |
---|
AStar(Domain domain,
RewardFunction rf,
StateConditionTest gc,
StateHashFactory hashingFactory,
Heuristic heuristic)
Initializes A*.
|
Modifier and Type | Method and Description |
---|---|
double |
computeF(PrioritizedSearchNode parentNode,
GroundedAction generatingAction,
StateHashTuple 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.
|
planFromState
deterministicPlannerInit, encodePlanIntoPolicy, hasCachedPlanForState, planContainsOption, planHasDupilicateStates, querySelectedActionForState, resetPlannerResults
addNonDomainReferencedAction, getActions, getAllGroundedActions, getDebugCode, getDomain, getGamma, getHashingFactory, getRf, getRF, getTf, getTF, plannerInit, setActions, setDebugCode, setDomain, setGamma, setRf, setTf, stateHash, toggleDebugPrinting, translateAction
protected Heuristic heuristic
protected java.util.Map<StateHashTuple,java.lang.Double> cumulatedRewardMap
protected double lastComputedCumR
public AStar(Domain domain, RewardFunction rf, StateConditionTest gc, StateHashFactory 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()
BestFirst
BestFirst.planFromState(State)
method and can be used initialize any special
data structures needed by the subclass. By default it does nothing.prePlanPrep
in class BestFirst
public void postPlanPrep()
BestFirst
BestFirst.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 BestFirst
public void insertIntoOpen(HashIndexedHeap<PrioritizedSearchNode> openQueue, PrioritizedSearchNode psn)
BestFirst
PrioritizedSearchNode
with more information),
it can override it.insertIntoOpen
in class BestFirst
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)
BestFirst
PrioritizedSearchNode
with more information), it can override this method.updateOpen
in class BestFirst
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 double computeF(PrioritizedSearchNode parentNode, GroundedAction generatingAction, StateHashTuple successorState)
BestFirst
computeF
in class BestFirst
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 generated