public class LinearVFA extends java.lang.Object implements DifferentiableStateValue, DifferentiableStateActionValue
ParametricFunction.ParametricStateActionFunction, ParametricFunction.ParametricStateFunction| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<StateFeature> |
currentFeatures |
protected FunctionGradient |
currentGradient |
protected double |
currentValue |
protected double |
defaultWeight
A default weight for the functions
|
protected FeatureDatabase |
featureDatabase
A feature database for which a unique function weight will be associated
|
protected AbstractGroundedAction |
lastAction |
protected State |
lastState |
protected java.util.Map<java.lang.Integer,java.lang.Double> |
weights
A map from feature identifiers to function weights
|
| Constructor and Description |
|---|
LinearVFA(FeatureDatabase featureDatabase)
Initializes with a feature database; the default weight value will be zero
|
LinearVFA(FeatureDatabase featureDatabase,
double defaultWeight)
Initializes
|
| Modifier and Type | Method and Description |
|---|---|
LinearVFA |
copy()
Returns a copy of this
ParametricFunction. |
double |
evaluate(State s)
Sets the input of this function to the given
State and returns
the value of it. |
double |
evaluate(State s,
AbstractGroundedAction a)
Sets the input of this function to the given
State and
AbstractGroundedAction and returns the value of it. |
double |
getParameter(int i)
Returns the value of the ith parameter value
|
protected double |
getWeight(int weightId) |
FunctionGradient |
gradient(State s)
Returns the gradient of this function
|
FunctionGradient |
gradient(State s,
AbstractGroundedAction a)
Returns the gradient of this function.
|
int |
numParameters()
Returns the number of parameters defining this function.
|
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
|
protected FeatureDatabase featureDatabase
protected java.util.Map<java.lang.Integer,java.lang.Double> weights
protected double defaultWeight
protected java.util.List<StateFeature> currentFeatures
protected double currentValue
protected FunctionGradient currentGradient
protected State lastState
protected AbstractGroundedAction lastAction
public LinearVFA(FeatureDatabase featureDatabase)
featureDatabase - the feature database to usepublic LinearVFA(FeatureDatabase featureDatabase, double defaultWeight)
featureDatabase - the feature database to usedefaultWeight - the default feature weight to initialize feature weights topublic double evaluate(State s, AbstractGroundedAction a)
ParametricFunction.ParametricStateActionFunctionState and
AbstractGroundedAction and returns the value of it.evaluate in interface ParametricFunction.ParametricStateActionFunctions - the input Statea - the input actionState and AbstractGroundedActionpublic double evaluate(State s)
ParametricFunction.ParametricStateFunctionState and returns
the value of it.evaluate in interface ParametricFunction.ParametricStateFunctions - the State to input to the functionStatepublic FunctionGradient gradient(State s)
DifferentiableStateValuegradient in interface DifferentiableStateValues - the input statepublic FunctionGradient gradient(State s, AbstractGroundedAction a)
DifferentiableStateActionValuegradient in interface DifferentiableStateActionValues - the input Statea - the input AbstractGroundedActionFunctionGradient of this function at the inputpublic int numParameters()
ParametricFunctionnumParameters in interface ParametricFunctionpublic double getParameter(int i)
ParametricFunctiongetParameter in interface ParametricFunctioni - the parameter indexpublic void setParameter(int i,
double p)
ParametricFunctionsetParameter in interface ParametricFunctioni - the index of the parameter to setp - the parameter value to which it should be setprotected double getWeight(int weightId)
public void resetParameters()
ParametricFunctionresetParameters in interface ParametricFunctionpublic LinearVFA copy()
ParametricFunctionParametricFunction.copy in interface ParametricFunctionParametricFunction.