public class LinearStateDiffVF extends java.lang.Object implements DifferentiableVInit
MLIRL
.ValueFunctionInitialization.ConstantValueFunctionInitialization
ParametricFunction.ParametricStateActionFunction, ParametricFunction.ParametricStateFunction
Modifier and Type | Field and Description |
---|---|
protected int |
dim |
protected StateToFeatureVectorGenerator |
fvgen
The state feature vector generator over which the linear function operates
|
protected double[] |
parameters |
Constructor and Description |
---|
LinearStateDiffVF(StateToFeatureVectorGenerator fvgen,
int dim)
Initializes with the state feature vector generator over which the linear function is defined and the dimensionality of it.
|
Modifier and Type | Method and Description |
---|---|
ParametricFunction |
copy()
Returns a copy of this
ParametricFunction . |
double |
getParameter(int i)
Returns the value of the ith parameter value
|
FunctionGradient |
getQGradient(State s,
AbstractGroundedAction ga)
Returns the Q-value function gradient.
|
FunctionGradient |
getVGradient(State s)
Returns the value function gradient.
|
int |
numParameters()
Returns the number of parameters defining this function.
|
double |
qValue(State s,
AbstractGroundedAction a)
Returns the initialization value of the Q-value function for a given state and action pair.
|
void |
resetParameters()
Resets the parameters of this function to default values.
|
void |
setParameter(int i,
double p)
Sets the value of the ith parameter to given value
|
double |
value(State s)
Returns the value function evaluation of the given state.
|
protected StateToFeatureVectorGenerator fvgen
protected int dim
protected double[] parameters
public LinearStateDiffVF(StateToFeatureVectorGenerator fvgen, int dim)
fvgen
- the state feature vector generator over which the linear function is defined.dim
- the dimensionality of the feature vector/parameterspublic int numParameters()
ParametricFunction
numParameters
in interface ParametricFunction
public double getParameter(int i)
ParametricFunction
getParameter
in interface ParametricFunction
i
- the parameter indexpublic void setParameter(int i, double p)
ParametricFunction
setParameter
in interface ParametricFunction
i
- the index of the parameter to setp
- the parameter value to which it should be setpublic void resetParameters()
ParametricFunction
resetParameters
in interface ParametricFunction
public ParametricFunction copy()
ParametricFunction
ParametricFunction
.copy
in interface ParametricFunction
ParametricFunction
.public FunctionGradient getVGradient(State s)
DifferentiableVInit
getVGradient
in interface DifferentiableVInit
s
- the state on which the value function is to be evaluatedpublic FunctionGradient getQGradient(State s, AbstractGroundedAction ga)
DifferentiableVInit
getQGradient
in interface DifferentiableVInit
s
- the state on which the Q-value is to be evaluated.ga
- the action on which the Q-value is to be evaluated.public double value(State s)
ValueFunction
value
in interface ValueFunction
s
- the state to evaluate.public double qValue(State s, AbstractGroundedAction a)
ValueFunctionInitialization
qValue
in interface ValueFunctionInitialization
s
- the state for which to get the initial value of the Q-value function.a
- the action for which to get the initial value of the Q-value function.