public abstract class DifferentiableRF extends java.lang.Object implements RewardFunction
Modifier and Type | Field and Description |
---|---|
protected int |
dim
The parameter dimensionality
|
protected double[] |
parameters
The parameters of the reward functions.
|
Constructor and Description |
---|
DifferentiableRF() |
Modifier and Type | Method and Description |
---|---|
DifferentiableRF |
copy()
Creates a copy of this reward function.
|
protected abstract DifferentiableRF |
copyHelper()
A helper method for making a copy of this reward function.
|
abstract double[] |
getGradient(State s,
GroundedAction ga,
State sp)
Returns the gradient of the reward function for the given state transition.
|
int |
getParameterDimension()
Returns the parameter dimensionality
|
double[] |
getParameters()
Returns the parameters of this reward function.
|
void |
randomizeParameters(double lowerVal,
double upperVal,
java.util.Random rand)
Randomizes the parameter values using the given random number generator.
|
void |
setParameter(int i,
double p)
Sets the value of a given parameter.
|
void |
setParameters(double[] parameters) |
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
reward
protected double[] parameters
protected int dim
public abstract double[] getGradient(State s, GroundedAction ga, State sp)
s
- the source statega
- the action taken in the source statesp
- the resulting state from the actionpublic void setParameters(double[] parameters)
public void setParameter(int i, double p)
i
- which parameter to setp
- the value of the parameterpublic int getParameterDimension()
public double[] getParameters()
public void randomizeParameters(double lowerVal, double upperVal, java.util.Random rand)
lowerVal
- the lower parameter range valueupperVal
- the upper parameter range valuerand
- the random number generator to useprotected abstract DifferentiableRF copyHelper()
copy()
method.public DifferentiableRF copy()
public java.lang.String toString()
toString
in class java.lang.Object