public class RandomPolicy extends Policy
addAction(burlap.oomdp.singleagent.Action) method
or remove or clear the actions.
Policy.ActionProb, Policy.GroundedAnnotatedAction, Policy.PolicyUndefinedException| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<Action> |
actions
The actions from which selection is performed
|
protected java.util.Random |
rand
The random factory used to randomly select actions.
|
annotateOptionDecomposition, evaluateDecomposesOptions| Constructor and Description |
|---|
RandomPolicy(Domain domain)
Initializes by copying all the primitive actions references defined for the domain into an internal action
list for this policy.
|
RandomPolicy(java.util.List<Action> acitons)
Initializes by copying all the actions references defined in the provided list into an internal action
list for this policy.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAction(Action action)
Adds an aciton to consider in selection.
|
void |
clearActions()
Clears the action list used in action selection.
|
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.
|
java.util.Random |
getRandomGenerator()
Returns the random generator used for action selection.
|
java.util.List<Action> |
getSelectionActions()
Returns of the list of actions that can be randomly selected.
|
boolean |
isDefinedFor(State s)
Specifies whether this policy is defined for the input state.
|
boolean |
isStochastic()
Indicates whether the policy is stochastic or deterministic.
|
void |
removeAction(java.lang.String actionName)
Removes an action from consideration.
|
void |
setRandomGenerator(java.util.Random rand)
Sets the random generator used for action selection.
|
evaluateBehavior, evaluateBehavior, evaluateBehavior, evaluateBehavior, evaluateBehavior, evaluateMethodsShouldAnnotateOptionDecomposition, evaluateMethodsShouldDecomposeOption, followAndRecordPolicy, followAndRecordPolicy, getDeterministicPolicy, getProbOfAction, getProbOfActionGivenDistribution, getProbOfActionGivenDistribution, sampleFromActionDistributionprotected java.util.List<Action> actions
protected java.util.Random rand
public RandomPolicy(Domain domain)
domain - the domain containing all the primitive actions.public RandomPolicy(java.util.List<Action> acitons)
acitons - the actions to select between.public void addAction(Action action)
action - an action to consider in selectionpublic void clearActions()
public void removeAction(java.lang.String actionName)
actionName - the name of the action to remove.public java.util.List<Action> getSelectionActions()
public java.util.Random getRandomGenerator()
public void setRandomGenerator(java.util.Random rand)
rand - the random generator used for action selection.public 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.