public class PrioritizedSweeping extends ValueIteration
Modifier and Type | Class and Description |
---|---|
protected class |
PrioritizedSweeping.BPTR
A back pointer and its max action probability of transition.
|
protected class |
PrioritizedSweeping.BPTRNode
A node for state thar contains a list of its back pointers, their max probability of transition to this state, and the priority of this nodes state.
|
protected static class |
PrioritizedSweeping.BPTRNodeComparator
Comparator for the the priority of BPTRNodes
|
QProvider.Helper
Modifier and Type | Field and Description |
---|---|
protected int |
maxBackups
THe maximum number Bellman backups permitted
|
protected HashIndexedHeap<PrioritizedSweeping.BPTRNode> |
priorityNodes
The priority queue of states
|
foundReachableStates, hasRunVI, maxDelta, maxIterations, stopReachabilityFromTerminalStates
operator, valueFunction, valueInitializer
actionTypes, debugCode, domain, gamma, hashingFactory, model, usingOptionModel
Constructor and Description |
---|
PrioritizedSweeping(SADomain domain,
double gamma,
HashableStateFactory hashingFactory,
double maxDelta,
int maxBackups)
Initializes
|
Modifier and Type | Method and Description |
---|---|
protected PrioritizedSweeping.BPTRNode |
getNodeFor(HashableState sh)
Returns or creates, stores, and returns a priority back pointer node for the given hased state
|
boolean |
performReachabilityFrom(State si)
This method will find all reachable states that will be used by the
ValueIteration.runVI() method and will cache all the transition dynamics. |
void |
runVI()
Runs VI until the specified termination conditions are met.
|
planFromState, recomputeReachableStates, resetSolver, toggleReachabiltiyTerminalStatePruning
computeQ, DPPInit, getAllStates, getCopyOfValueFunction, getDefaultValue, getModel, getOperator, getValueFunctionInitialization, hasComputedValueFor, loadValueTable, performBellmanUpdateOn, performBellmanUpdateOn, performFixedPolicyBellmanUpdateOn, performFixedPolicyBellmanUpdateOn, qValue, qValues, setOperator, setValueFunctionInitialization, value, value, writeValueTable
addActionType, applicableActions, getActionTypes, getDebugCode, getDomain, getGamma, getHashingFactory, 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
protected HashIndexedHeap<PrioritizedSweeping.BPTRNode> priorityNodes
protected int maxBackups
public PrioritizedSweeping(SADomain domain, double gamma, HashableStateFactory hashingFactory, double maxDelta, int maxBackups)
domain
- the domain in which to plangamma
- the discount factorhashingFactory
- the state hashing factor to usemaxDelta
- when the maximum change in the value function is smaller than this value, VI will terminate.maxBackups
- the maximum number of Bellman backups. If set to -1, then there is no hard limit.public void runVI()
ValueIteration
ValueIteration.planFromState(State)
method.
The ValueIteration.performReachabilityFrom(State)
must have been performed at least once
in the past or a runtime exception will be thrown. The ValueIteration.planFromState(State)
method will automatically call the ValueIteration.performReachabilityFrom(State)
method first and then this if it hasn't been run.runVI
in class ValueIteration
public boolean performReachabilityFrom(State si)
ValueIteration
ValueIteration.runVI()
method and will cache all the transition dynamics.
This method will not do anything if all reachable states from the input state have been discovered from previous calls to this method.performReachabilityFrom
in class ValueIteration
si
- the source state from which all reachable states will be foundprotected PrioritizedSweeping.BPTRNode getNodeFor(HashableState sh)
sh
- the hashed state for which its node should be returned.