public class CachedPolicy extends Policy
Policy.ActionProb, Policy.GroundedAnnotatedAction, Policy.PolicyUndefinedException| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<HashableState,java.util.List<Policy.ActionProb>> |
actionSelection
The cached action selection probabilities
|
protected HashableStateFactory |
hashingFactory
The hashing factory to use for indexing states
|
protected Policy |
sourcePolicy
The source policy that gets cached
|
annotateOptionDecomposition, evaluateDecomposesOptions| Constructor and Description |
|---|
CachedPolicy(HashableStateFactory hashingFactory,
Policy sourcePolicy)
Initializes
|
CachedPolicy(HashableStateFactory hashingFactory,
Policy sourcePolicy,
int cacheCapacity)
Initializes
|
| Modifier and Type | Method and Description |
|---|---|
AbstractGroundedAction |
getAction(State s)
This method will return an action sampled by the policy for the given state.
|
java.util.List<Policy.ActionProb> |
getActionDistributionForState(State s)
This method will return action probability distribution defined by the policy.
|
boolean |
isDefinedFor(State s)
Specifies whether this policy is defined for the input state.
|
boolean |
isStochastic()
Indicates whether the policy is stochastic or deterministic.
|
evaluateBehavior, evaluateBehavior, evaluateBehavior, evaluateBehavior, evaluateBehavior, evaluateMethodsShouldAnnotateOptionDecomposition, evaluateMethodsShouldDecomposeOption, followAndRecordPolicy, followAndRecordPolicy, getDeterministicPolicy, getProbOfAction, getProbOfActionGivenDistribution, getProbOfActionGivenDistribution, sampleFromActionDistributionprotected HashableStateFactory hashingFactory
protected java.util.Map<HashableState,java.util.List<Policy.ActionProb>> actionSelection
protected Policy sourcePolicy
public CachedPolicy(HashableStateFactory hashingFactory, Policy sourcePolicy)
hashingFactory - the HashableStateFactory to use for indexing statessourcePolicy - the source policy that will be lazily cached.public CachedPolicy(HashableStateFactory hashingFactory, Policy sourcePolicy, int cacheCapacity)
hashingFactory - the HashableStateFactory to use for indexing statessourcePolicy - the source policy that will be lazily cached.cacheCapacity - the initial memory capacity to be set aside for the policy cachepublic AbstractGroundedAction getAction(State s)
Policypublic java.util.List<Policy.ActionProb> getActionDistributionForState(State s)
PolicygetActionDistributionForState in class Policys - the state for which an action distribution should be returnedpublic boolean isStochastic()
PolicyisStochastic in class Policypublic boolean isDefinedFor(State s)
PolicyisDefinedFor in class Policys - the input state to test for whether this policy is definedState s, false otherwise.