public class GoalBasedRF extends java.lang.Object implements RewardFunction
StateConditionTest
object.
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 |
---|---|
StateConditionTest |
getGoalCondition()
Returns the goal condition for this reward function.
|
double |
reward(State s,
GroundedAction a,
State sprime)
Returns the reward received when action a is executed in state s and the agent transitions to state sprime.
|
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 reward(State s, GroundedAction 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