public static class CartPoleDomain.CartPoleRewardFunction extends java.lang.Object implements RewardFunction
Constructor and Description |
---|
CartPoleRewardFunction()
Initializes with max pole angle threshold of 12 degrees (about 0.2 radians)
|
CartPoleRewardFunction(double maxAbsoluteAngleInRadians)
Initializes with a max pole angle as specified in radians
|
Modifier and Type | Method and Description |
---|---|
double |
getHalfTrackLength() |
double |
getMaxAbsoluteAngle() |
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 |
setHalfTrackLength(double halfTrackLength) |
void |
setMaxAbsoluteAngle(double maxAbsoluteAngle) |
public CartPoleRewardFunction()
public CartPoleRewardFunction(double maxAbsoluteAngleInRadians)
maxAbsoluteAngleInRadians
- the maximum pole angle that causes task failure.public double getMaxAbsoluteAngle()
public void setMaxAbsoluteAngle(double maxAbsoluteAngle)
public double getHalfTrackLength()
public void setHalfTrackLength(double halfTrackLength)
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