public class MacroAction extends Option
FullActionModel.FullActionModelHelper
Modifier and Type | Field and Description |
---|---|
protected java.util.List<GroundedAction> |
actionSequence
The list of actions that will be executed in order when this macro-action is called.
|
protected int |
curIndex
the current execution index of the macro-action sequence.
|
cachedExpectations, cachedExpectedRewards, cumulativeDiscount, discountFactor, expectationSearchCutoffProb, expectationStateHashingFactory, externalTerminalFunction, keepTrackOfReward, lastCumulativeReward, lastNumSteps, lastOptionExecutionResults, rand, rf, shouldAnnotateExecution, shouldRecordResults, stateMapping, terminateMapper
actionObservers, domain, name
Constructor and Description |
---|
MacroAction(java.lang.String name,
java.util.List<GroundedAction> actionSequence)
Instantiates a macro action with a given name and action sequence.
|
Modifier and Type | Method and Description |
---|---|
boolean |
applicableInState(State s,
GroundedAction groundedAction)
Returns true if this action can be applied in this specified state with the parameters
specified by the provided
GroundedAction
Default behavior is that an action can be applied in any state,
but this will need be overridden if that is not the case. |
java.util.List<Policy.ActionProb> |
getActionDistributionForState(State s,
GroundedAction groundedAction)
Returns the option's policy distribution for a given state.
|
java.util.List<GroundedAction> |
getAllApplicableGroundedActions(State s)
Returns all possible groundings of this action that can be applied in the provided
State . |
GroundedAction |
getAssociatedGroundedAction()
Returns a
GroundedAction instance that points to this Action ,
but does not have any parameters--if any--set. |
void |
initiateInStateHelper(State s,
GroundedAction groundedAction)
This method is always called when an option is initiated and begins execution.
|
boolean |
isMarkov()
Returns whether this option is Markov or not; that is, whether action selection and termination only depends on the current state.
|
boolean |
isParameterized()
Returns true if this action is parameterized; false otherwise.
|
GroundedAction |
oneStepActionSelection(State s,
GroundedAction groundedAction)
This method causes the option to select a single step in the given state, when the option was initiated with the provided parameters.
|
double |
probabilityOfTermination(State s,
GroundedAction groundedAction)
Returns the probability that this option (executed with the given parameters) will terminate in the given state
|
boolean |
usesDeterministicPolicy()
Returns whether this option's policy is deterministic or stochastic
|
boolean |
usesDeterministicTermination()
Returns whether this option's termination conditions are deterministic or stochastic
|
accumulateDiscountedProb, continueFromState, getDeterministicPolicy, getExpectedRewards, getLastCumulativeReward, getLastExecutionResults, getLastNumSteps, getTransitions, initiateInState, isAnnotatingExecutionResults, isPrimitive, isRecordingExecutionResults, iterateExpectationScan, keepTrackOfRewardWith, map, oneStep, oneStep, performActionHelper, performInEnvironment, setExernalTermination, setExpectationCalculationProbabilityCutoff, setExpectationHashingFactory, setStateMapping, setTerminateMapper, toggleShouldAnnotateResults, toggleShouldRecordResults
addActionObserver, clearAllActionsObservers, deterministicTransition, equals, getAllApplicableGroundedActionsFromActionList, getDomain, getGroundedAction, getName, hashCode, performAction
protected java.util.List<GroundedAction> actionSequence
protected int curIndex
public MacroAction(java.lang.String name, java.util.List<GroundedAction> actionSequence)
name
- the name of the macro action.actionSequence
- the sequence of actions the macro action will execute.public boolean applicableInState(State s, GroundedAction groundedAction)
Action
GroundedAction
Default behavior is that an action can be applied in any state,
but this will need be overridden if that is not the case.applicableInState
in class Action
s
- the state to perform the action ongroundedAction
- the GroundedAction
specifying the parameters to usepublic boolean isParameterized()
Action
isParameterized
in class Action
Action
is parameterized; false if it is not.public GroundedAction getAssociatedGroundedAction()
Action
GroundedAction
instance that points to this Action
,
but does not have any parameters--if any--set.getAssociatedGroundedAction
in class Action
GroundedAction
instance.public java.util.List<GroundedAction> getAllApplicableGroundedActions(State s)
Action
State
. To check if a grounded
action is applicable in the state, the Action.applicableInState(State, burlap.oomdp.singleagent.GroundedAction)
method is checked.
The default behavior of this method is to treat the parameters as possible object bindings, finding all bindings
that satisfy the object class typing specified and then checking them against the Action.applicableInState(State, burlap.oomdp.singleagent.GroundedAction)
method. However, this class can also be overridden to provide custom
grounding behavior or non-object based parametrization.getAllApplicableGroundedActions
in class Action
s
- the State
in which all applicable grounded actions of this Action
object should be returned.GroundedAction
s of this Action
object in in the given State
public boolean isMarkov()
Option
public boolean usesDeterministicTermination()
Option
usesDeterministicTermination
in class Option
public boolean usesDeterministicPolicy()
Option
usesDeterministicPolicy
in class Option
public double probabilityOfTermination(State s, GroundedAction groundedAction)
Option
probabilityOfTermination
in class Option
s
- the state to test for terminationgroundedAction
- the parameters in which this option was initiatedpublic void initiateInStateHelper(State s, GroundedAction groundedAction)
Option
Option.performActionHelper(burlap.oomdp.core.states.State, burlap.oomdp.singleagent.GroundedAction)
For Markov options, this method probably does not need to do anything, but for non-Markov options, like Macro actions, it may need
to initialize some structures for determining termination and action selection.initiateInStateHelper
in class Option
s
- the state in which the option was initiatedgroundedAction
- the parameters in which this option will be initiatedpublic GroundedAction oneStepActionSelection(State s, GroundedAction groundedAction)
Option
Option.performActionHelper(burlap.oomdp.core.states.State, burlap.oomdp.singleagent.GroundedAction)
method until it is determined that the option terminates.oneStepActionSelection
in class Option
s
- the state in which an action should be selected.groundedAction
- the parameters in which this option was initiateds
public java.util.List<Policy.ActionProb> getActionDistributionForState(State s, GroundedAction groundedAction)
Option
getActionDistributionForState
in class Option
s
- the state for which this option's policy distribution should be returnedgroundedAction
- the parameters in which this option was initiated