public class DeterminisitcTerminationOption extends Option
PolicyDefinedSubgoalOption
when the client needs more control over in which states the option can be initiated and in which states it terminates.
One other advantage of this option is that it can be passed a planner from which its policy will be created. The planner
will be called from each initiation state provided to the option constructor.cachedExpectations, cachedExpectedRewards, cumulativeDiscount, discountFactor, expectationSearchCutoffProb, expectationStateHashingFactory, externalTerminalFunction, keepTrackOfReward, lastCumulativeReward, lastNumSteps, lastOptionExecutionResults, rand, rf, shouldAnnotateExecution, shouldRecordResults, stateMapping, terminateMapper
actionObservers, domain, name, parameterClasses, parameterOrderGroup
Constructor and Description |
---|
DeterminisitcTerminationOption(java.lang.String name,
Policy p,
StateConditionTest init,
StateConditionTest terminationStates)
Initializes.
|
DeterminisitcTerminationOption(java.lang.String name,
StateConditionTestIterable init,
StateConditionTest terminaitonStates,
OOMDPPlanner planner,
PlannerDerivedPolicy p)
Initializes the option by creating the policy uses some provided option.
|
DeterminisitcTerminationOption(java.lang.String name,
StateConditionTest init,
StateConditionTest terminationStates,
java.util.List<State> seedStatesForPlanning,
OOMDPPlanner planner,
PlannerDerivedPolicy p)
Initializes the option by creating the policy uses some provided option.
|
Modifier and Type | Method and Description |
---|---|
boolean |
applicableInState(State st,
java.lang.String[] params)
Returns true if this action can be applied in this specified state with the specified parameters.
|
boolean |
enumerable()
Returns true if the initiation states and termination states of this option are iterable; false if either of them are not.
|
java.util.List<Policy.ActionProb> |
getActionDistributionForState(State s,
java.lang.String[] params)
Returns the option's policy distribution for a given state.
|
StateConditionTest |
getInitiationTest()
Returns the object defining the initiation states.
|
StateConditionTest |
getTerminiationStates()
Returns the object defining the termination states.
|
void |
initiateInStateHelper(State s,
java.lang.String[] params)
This method is always called when an option is initated 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.
|
GroundedAction |
oneStepActionSelection(State s,
java.lang.String[] params)
This method causes the option to take a single step in the given state, when the option was initiated with the provided parameters.
|
double |
probabilityOfTermination(State s,
java.lang.String[] params)
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, init, initiateInState, isAnnotatingExecutionResults, isPrimitive, isRecordingExecutionResults, iterateExpectationScan, keepTrackOfRewardWith, map, oneStep, performActionHelper, setExernalTermination, setExpectationCalculationProbabilityCutoff, setExpectationHashingFactory, setStateMapping, setTerminateMapper, toggleShouldAnnotateResults, toggleShouldRecordResults
addActionObserver, applicableInState, clearAllActionsObservers, deterministicTransition, equals, getAllApplicableGroundedActions, getAllApplicableGroundedActionsFromActionList, getDomain, getName, getParameterClasses, getParameterOrderGroups, getTransitions, hashCode, parametersAreObjects, performAction, performAction
public DeterminisitcTerminationOption(java.lang.String name, Policy p, StateConditionTest init, StateConditionTest terminationStates)
name
- the name of the optionp
- the option's policyinit
- the initiation states of the optionterminationStates
- the deterministic termination states of the option.public DeterminisitcTerminationOption(java.lang.String name, StateConditionTestIterable init, StateConditionTest terminaitonStates, OOMDPPlanner planner, PlannerDerivedPolicy p)
StateConditionTestIterable
) and then
sets this options policy to the planner derived policy that is provided.name
- the name of the optioninit
- the iterable initiation statesterminaitonStates
- the termination states of the optionplanner
- the planner to be used to create the policy for this optionp
- the planner derived policy to use after planning from each initial state is performed.public DeterminisitcTerminationOption(java.lang.String name, StateConditionTest init, StateConditionTest terminationStates, java.util.List<State> seedStatesForPlanning, OOMDPPlanner planner, PlannerDerivedPolicy p)
seedStatesForPlanning
and then
sets this options policy to the planner derived policy that is provided.name
- the name of the optioninit
- the initiation conditions of the optionterminationStates
- the termination states of the optionseedStatesForPlanning
- the states that should be used as initial states for the plannerplanner
- the planner that is used to create the policy for this optionp
- the planner derived policy to use after planning from each initial state is performed.public StateConditionTest getInitiationTest()
public StateConditionTest getTerminiationStates()
public boolean enumerable()
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, java.lang.String[] params)
Option
probabilityOfTermination
in class Option
s
- the state to test for terminationparams
- any parameters that were applied to this option when it was initiatedpublic boolean applicableInState(State st, java.lang.String[] params)
Action
applicableInState
in class Action
st
- the state to perform the action onparams
- a String array specifying the action object parameterspublic void initiateInStateHelper(State s, java.lang.String[] params)
Option
Option.performActionHelper(State, String [])
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 initiatedparams
- the parameters that were passed to the option for executionpublic GroundedAction oneStepActionSelection(State s, java.lang.String[] params)
Option
Option.performActionHelper(State, String [])
method until it is determined that the option terminates.oneStepActionSelection
in class Option
s
- the state in which an action should be selected.params
- the parameters that were passed to the option when it was initiateds
public java.util.List<Policy.ActionProb> getActionDistributionForState(State s, java.lang.String[] params)
Option
getActionDistributionForState
in class Option
s
- the state for which this option's policy distribution should be returnedparams
- the parameters that were passed to the option when it was initiated