public class FactoredModel extends java.lang.Object implements TaskFactoredModel, FullModel
FactoredModel is an implementation of a SampleModel or FullModel that computes transitions
using a SampleStateModel, RewardFunction and TerminalFunction.FullModel.Helper| Modifier and Type | Field and Description |
|---|---|
protected RewardFunction |
rf |
protected SampleStateModel |
stateModel |
protected TerminalFunction |
tf |
| Constructor and Description |
|---|
FactoredModel() |
FactoredModel(SampleStateModel stateModel,
RewardFunction rf,
TerminalFunction tf)
Initializes
|
| Modifier and Type | Method and Description |
|---|---|
RewardFunction |
getRf() |
SampleStateModel |
getStateModel() |
TerminalFunction |
getTf() |
RewardFunction |
rewardFunction()
Returns the
RewardFunction this model uses to compute rewards |
EnvironmentOutcome |
sample(State s,
Action a)
Samples a transition from the transition distribution and returns it.
|
void |
setRf(RewardFunction rf) |
void |
setStateModel(SampleStateModel stateModel) |
void |
setTf(TerminalFunction tf) |
boolean |
terminal(State s)
Indicates whether a state is a terminal state (i.e., no more action occurs and zero reward received from there on out)
|
TerminalFunction |
terminalFunction()
Returns the
TerminalFunction this model uses to determine terminal states |
java.util.List<TransitionProb> |
transitions(State s,
Action a)
|
void |
useRewardFunction(RewardFunction rf)
Tells this model to use the corresponding
RewardFunction |
void |
useTerminalFunction(TerminalFunction tf)
Tells this model to use the corresponding
TerminalFunction |
protected SampleStateModel stateModel
protected RewardFunction rf
protected TerminalFunction tf
public FactoredModel()
public FactoredModel(SampleStateModel stateModel, RewardFunction rf, TerminalFunction tf)
stateModel - the SampleStateModel to userf - the RewardFunction to usetf - the TerminalFunction to usepublic void useRewardFunction(RewardFunction rf)
TaskFactoredModelRewardFunctionuseRewardFunction in interface TaskFactoredModelrf - the RewardFunctionpublic void useTerminalFunction(TerminalFunction tf)
TaskFactoredModelTerminalFunctionuseTerminalFunction in interface TaskFactoredModeltf - the TerminalFunctionpublic RewardFunction rewardFunction()
TaskFactoredModelRewardFunction this model uses to compute rewardsrewardFunction in interface TaskFactoredModelRewardFunction this model uses to compute rewardspublic TerminalFunction terminalFunction()
TaskFactoredModelTerminalFunction this model uses to determine terminal statesterminalFunction in interface TaskFactoredModelTerminalFunction this model uses to determine terminal statespublic EnvironmentOutcome sample(State s, Action a)
SampleModelsample in interface SampleModels - the source statea - the action taken in the source stateEnvironmentOutcome describing the sampled transitionpublic java.util.List<TransitionProb> transitions(State s, Action a)
FullModelAction is applied in State s. The returned
list only needs to include transitions that have non-zero probability of occurring.transitions in interface FullModels - the source Statea - the Action applied in the source statepublic SampleStateModel getStateModel()
public void setStateModel(SampleStateModel stateModel)
public RewardFunction getRf()
public void setRf(RewardFunction rf)
public TerminalFunction getTf()
public void setTf(TerminalFunction tf)
public boolean terminal(State s)
SampleModelterminal in interface SampleModels - the input state to test