public class GoalBasedRF extends java.lang.Object implements RewardFunction
StateConditionTest
object
or a TerminalFunction
.
When the agent transition to a state marked as a goal state, it returns a goal reward. Otherwise a default reward is returned.Modifier and Type | Field and Description |
---|---|
protected double |
defaultReward |
protected StateConditionTest |
gc |
protected double |
goalReward |
Constructor and Description |
---|
GoalBasedRF(StateConditionTest gc)
Initializes with transitions to goal states returning a reward of 1 and all others returning 0
|
GoalBasedRF(StateConditionTest gc,
double goalReward)
Initializes with transitions to goal states returning the given reward and all others returning 0.
|
GoalBasedRF(StateConditionTest gc,
double goalReward,
double defaultReward)
Initializes with transitions to goal states returning the given reward and all others returning 0.
|
GoalBasedRF(TerminalFunction tf)
Initializes with transitions to goal states, indicated by the terminal function, returning a reward of 1 and all others returning 0
|
GoalBasedRF(TerminalFunction tf,
double goalReward)
Initializes with transitions to goal states, indicated by the terminal function, returning the given reward and all others returning 0.
|
GoalBasedRF(TerminalFunction tf,
double goalReward,
double defaultReward)
Initializes with transitions to goal states, indicated by the terminal function, returning the given reward and all others returning 0.
|
Modifier and Type | Method and Description |
---|---|
double |
getDefaultReward() |
StateConditionTest |
getGoalCondition()
Returns the goal condition for this reward function.
|
double |
getGoalReward() |
double |
reward(State s,
Action a,
State sprime)
Returns the reward received when action a is executed in state s and the agent transitions to state sprime.
|
void |
setDefaultReward(double defaultReward) |
void |
setGoalReward(double goalReward) |
protected StateConditionTest gc
protected double goalReward
protected double defaultReward
public GoalBasedRF(StateConditionTest gc)
gc
- StateConditionTest
object that specifies goal states.public GoalBasedRF(StateConditionTest gc, double goalReward)
gc
- StateConditionTest
object that specifies goal states.goalReward
- the reward returned for transitions to goal states.public GoalBasedRF(StateConditionTest gc, double goalReward, double defaultReward)
gc
- StateConditionTest
object that specifies goal states.goalReward
- the reward returned for transitions to goal states.defaultReward
- the default reward returned for all non-goal state transitions.public GoalBasedRF(TerminalFunction tf)
tf
- TerminalFunction
object that specifies goal states.public GoalBasedRF(TerminalFunction tf, double goalReward)
tf
- TerminalFunction
object that specifies goal states.goalReward
- the reward returned for transitions to goal states.public GoalBasedRF(TerminalFunction tf, double goalReward, double defaultReward)
tf
- TerminalFunction
object that specifies goal states.goalReward
- the reward returned for transitions to goal states.defaultReward
- the default reward returned for all non-goal state transitions.public StateConditionTest getGoalCondition()
public double getGoalReward()
public void setGoalReward(double goalReward)
public double getDefaultReward()
public void setDefaultReward(double defaultReward)
public double reward(State s, Action a, State sprime)
RewardFunction
reward
in interface RewardFunction
s
- the state in which the action was executeda
- the action executedsprime
- the state to which the agent transitioned