public abstract class Policy
extends java.lang.Object
Modifier and Type  Class and Description 

static class 
Policy.ActionProb
Class for storing an action and probability tuple.

static class 
Policy.PolicyUndefinedException
RuntimeException to be thrown when a Policy is queried for a state in which the policy is undefined.

static class 
Policy.RandomPolicy
A uniform random policy for single agent domains.

Modifier and Type  Field and Description 

protected boolean 
annotateOptionDecomposition 
protected boolean 
evaluateDecomposesOptions 
Constructor and Description 

Policy() 
Modifier and Type  Method and Description 

EpisodeAnalysis 
evaluateBehavior(State s,
RewardFunction rf,
int numSteps)
This method will return the an episode that results from following this policy from state s.

EpisodeAnalysis 
evaluateBehavior(State s,
RewardFunction rf,
TerminalFunction tf)
This method will return the an episode that results from following this policy from state s.

EpisodeAnalysis 
evaluateBehavior(State s,
RewardFunction rf,
TerminalFunction tf,
int maxSteps)
This method will return the an episode that results from following this policy from state s.

void 
evaluateMethodsShouldAnnotateOptionDecomposition(boolean toggle)
Sets whether options that are decomposed into primitives will have the option that produced them and listed.

void 
evaluateMethodsShouldDecomposeOption(boolean toggle)
Sets whether the primitive actions taken during an options will be included as steps in produced EpisodeAnalysis objects.

abstract AbstractGroundedAction 
getAction(State s)
This method will return an action sampled by the policy for the given state.

abstract java.util.List<Policy.ActionProb> 
getActionDistributionForState(State s)
This method will return action probability distribution defined by the policy.

protected java.util.List<Policy.ActionProb> 
getDeterministicPolicy(State s)
A helper method for defining deterministic policies.

double 
getProbOfAction(State s,
AbstractGroundedAction ga)
Will return the probability of this policy taking action ga in state s

static double 
getProbOfActionGivenDistribution(AbstractGroundedAction ga,
java.util.List<Policy.ActionProb> distribution)
Searches the input distribution for the occurrence of the input action and returns its probability.

static double 
getProbOfActionGivenDistribution(State s,
AbstractGroundedAction ga,
java.util.List<Policy.ActionProb> distribution)
Deprecated.

abstract boolean 
isDefinedFor(State s)
Specifies whether this policy is defined for the input state.

abstract boolean 
isStochastic()
Indicates whether the policy is stochastic or deterministic.

protected AbstractGroundedAction 
sampleFromActionDistribution(State s)
This is a helper method for stochastic policies.

protected boolean evaluateDecomposesOptions
protected boolean annotateOptionDecomposition
public abstract AbstractGroundedAction getAction(State s)
s
 the state for which an action should be returnedpublic abstract java.util.List<Policy.ActionProb> getActionDistributionForState(State s)
s
 the state for which an action distribution should be returnedpublic abstract boolean isStochastic()
public abstract boolean isDefinedFor(State s)
s
 the input state to test for whether this policy is definedState
s, false otherwise.public double getProbOfAction(State s, AbstractGroundedAction ga)
s
 the state in which the action would be takenga
 the action being queried@Deprecated public static double getProbOfActionGivenDistribution(State s, AbstractGroundedAction ga, java.util.List<Policy.ActionProb> distribution)
getProbOfActionGivenDistribution(burlap.oomdp.core.AbstractGroundedAction, java.util.List)
.public static double getProbOfActionGivenDistribution(AbstractGroundedAction ga, java.util.List<Policy.ActionProb> distribution)
ga
 the AbstractGroundedAction
for which its probability in specified distribution should be returned.distribution
 the probability distribution over actions.protected java.util.List<Policy.ActionProb> getDeterministicPolicy(State s)
s
 the state for which the action distribution should be returned.protected AbstractGroundedAction sampleFromActionDistribution(State s)
s
 AbstractGroundedAction
to takepublic void evaluateMethodsShouldDecomposeOption(boolean toggle)
toggle
 whether to decompose options into the primitive actions taken by them or not.public void evaluateMethodsShouldAnnotateOptionDecomposition(boolean toggle)
toggle
 whether to annotate the primitive actions of options with the calling option's name.public EpisodeAnalysis evaluateBehavior(State s, RewardFunction rf, TerminalFunction tf)
s
 the state from which to roll out the policyrf
 the reward function used to track rewards accumulated during the episodetf
 the terminal function defining when the policy should stop being followed.public EpisodeAnalysis evaluateBehavior(State s, RewardFunction rf, TerminalFunction tf, int maxSteps)
s
 the state from which to roll out the policyrf
 the reward function used to track rewards accumulated during the episodetf
 the terminal function defining when the policy should stop being followed.maxSteps
 the maximum number of steps to take before terminating the policy rollout.public EpisodeAnalysis evaluateBehavior(State s, RewardFunction rf, int numSteps)
s
 the state from which to roll out the policyrf
 the reward function used to track rewards accumulated during the episodenumSteps
 the number of steps to take before terminating the policy rollout