public class DynamicWeightedAStar extends AStar
DeterministicPlanner.PlanningFailedException| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<StateHashTuple,java.lang.Integer> |
depthMap
Data structure for storing the depth of explored states
|
protected double |
epsilon
parameter > 1 indicating the maximum amount of greediness; the larger the more greedy.
|
protected int |
expectedDepth
The expected depth required for a plan
|
protected int |
lastComputedDepth
maintains the depth of the last explored node
|
cumulatedRewardMap, heuristic, lastComputedCumRgc, internalPolicyactions, containsParameterizedActions, debugCode, domain, gamma, hashingFactory, mapToStateIndex, rf, tf| Constructor and Description |
|---|
DynamicWeightedAStar(Domain domain,
RewardFunction rf,
StateConditionTest gc,
StateHashFactory hashingFactory,
Heuristic heuristic,
double epsilon,
int expectedDepth)
Initializes the planner.
|
| 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.
|
protected double |
epsilonWeight(int depth)
Returns the weighted epsilon value at the given search depth
|
void |
insertIntoOpen(HashIndexedHeap<PrioritizedSearchNode> openQueue,
PrioritizedSearchNode psn)
This method is used to insert a prioritized search node into the openQueue.
|
void |
planFromState(State initialState)
This method is being overridden because to avoid reopening closed states that are not actually better due to the dynamic
h weight, the reopen check needs to be based on the g score, note the f score
|
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.
|
deterministicPlannerInit, encodePlanIntoPolicy, hasCachedPlanForState, planContainsOption, planHasDupilicateStates, querySelectedActionForState, resetPlannerResultsaddNonDomainReferencedAction, getActions, getAllGroundedActions, getDebugCode, getDomain, getGamma, getHashingFactory, getRf, getRF, getTf, getTF, plannerInit, setActions, setDebugCode, setDomain, setGamma, setRf, setTf, stateHash, toggleDebugPrinting, translateActionprotected double epsilon
protected int expectedDepth
protected java.util.Map<StateHashTuple,java.lang.Integer> depthMap
protected int lastComputedDepth
public DynamicWeightedAStar(Domain domain, RewardFunction rf, StateConditionTest gc, StateHashFactory hashingFactory, Heuristic heuristic, double epsilon, int expectedDepth)
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.epsilon - parameter > 1 indicating greediness; the larger the value the more greedy.expectedDepth - the expected depth of the planpublic 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 AStarpublic 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 AStarpublic void insertIntoOpen(HashIndexedHeap<PrioritizedSearchNode> openQueue, PrioritizedSearchNode psn)
BestFirstPrioritizedSearchNode with more information),
it can override it.insertIntoOpen in class AStaropenQueue - 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 AStaropenQueue - 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 void planFromState(State initialState)
planFromState in class BestFirstinitialState - the initial state of the planning problempublic double computeF(PrioritizedSearchNode parentNode, GroundedAction generatingAction, StateHashTuple successorState)
BestFirstcomputeF in class AStarparentNode - 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 generatedprotected double epsilonWeight(int depth)
depth - the search depth