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)
TaskFactoredModel
RewardFunction
useRewardFunction
in interface TaskFactoredModel
rf
- the RewardFunction
public void useTerminalFunction(TerminalFunction tf)
TaskFactoredModel
TerminalFunction
useTerminalFunction
in interface TaskFactoredModel
tf
- the TerminalFunction
public RewardFunction rewardFunction()
TaskFactoredModel
RewardFunction
this model uses to compute rewardsrewardFunction
in interface TaskFactoredModel
RewardFunction
this model uses to compute rewardspublic TerminalFunction terminalFunction()
TaskFactoredModel
TerminalFunction
this model uses to determine terminal statesterminalFunction
in interface TaskFactoredModel
TerminalFunction
this model uses to determine terminal statespublic EnvironmentOutcome sample(State s, Action a)
SampleModel
sample
in interface SampleModel
s
- the source statea
- the action taken in the source stateEnvironmentOutcome
describing the sampled transitionpublic java.util.List<TransitionProb> transitions(State s, Action a)
FullModel
Action
is applied in State
s. The returned
list only needs to include transitions that have non-zero probability of occurring.transitions
in interface FullModel
s
- the source State
a
- 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)
SampleModel
terminal
in interface SampleModel
s
- the input state to test