|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.stanford.multiagent.gamer.ParameterizedObject | +--edu.stanford.multiagent.gamer.functions.Function | +--edu.stanford.multiagent.gamer.functions.PolyFunction
Class implements a polynomial function of a single argument
Field Summary | |
protected double[] |
coefs
|
protected static double |
EPSILON
|
protected static int |
MAX_ITER
|
protected static int |
N_RESTARTS
|
protected static Parameters.ParamInfo[] |
pfParam
|
Fields inherited from class edu.stanford.multiagent.gamer.functions.Function |
dMax, dMin |
Fields inherited from class edu.stanford.multiagent.gamer.ParameterizedObject |
parameters |
Constructor Summary | |
PolyFunction()
|
|
PolyFunction(double[] coefs,
double dMin,
double dMax)
|
Method Summary | |
protected void |
checkParameters()
Checks if Parameter values are consistent. |
void |
doGenerate()
The only thing involved in generating the polynomial is storing the coefficients in a more easily accessable variable. |
double |
eval(double x)
Evaluate the polynomial |
edu.stanford.multiagent.gamer.functions.PolyFunction |
getDerivative()
Returns a derivative polynomial. |
protected java.lang.String |
getFunctionHelp()
Returns a help string describing the function and the parameters taken by the function |
void |
getMinima(double a,
double b,
edu.stanford.multiagent.gamer.functions.PolyFunction deriv,
java.util.Vector v)
Appends all local minima in the specified interval to v. |
double |
getMinimum()
Finds the minimum value of the function. |
double |
getMinimum(double a,
double b,
edu.stanford.multiagent.gamer.functions.PolyFunction deriv)
Does gradient descent to get a local minimum in an interval a,b. |
void |
initialize()
Calls initialize in the super class ParemeterizedObject which checks parameters |
edu.stanford.multiagent.gamer.functions.PolyFunction |
integrate()
Integrates a polynomial and adds random constant term. |
static void |
main(java.lang.String[] args)
Used only for testing. |
void |
randomizeParameters()
Randomize things |
Methods inherited from class edu.stanford.multiagent.gamer.functions.Function |
getDMax, getDMin, getHelp, setDomain |
Methods inherited from class edu.stanford.multiagent.gamer.ParameterizedObject |
getBooleanParameter, getDescription, getDoubleParameter, getLongParameter, getParamDescription, getParameter, getParameters, getStringParameter, setParameter, setParameter, setParameters, setParameters |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final double EPSILON
protected static final int MAX_ITER
protected static final int N_RESTARTS
protected static Parameters.ParamInfo[] pfParam
protected double[] coefs
Constructor Detail |
public PolyFunction() throws java.lang.Exception
public PolyFunction(double[] coefs, double dMin, double dMax) throws java.lang.Exception
Method Detail |
protected java.lang.String getFunctionHelp()
Function
getFunctionHelp
in class Function
public void initialize() throws java.lang.Exception
Function
initialize
in class Function
java.lang.Exception
- if there is a problem with the parametersprotected void checkParameters() throws java.lang.Exception
ParameterizedObject
checkParameters
in class ParameterizedObject
java.lang.Exception
- if anything is wrong with the parameter
valuespublic void doGenerate()
doGenerate
in class ParameterizedObject
public double eval(double x)
eval
in class Function
x
- the point at which to evaluate the functionpublic void randomizeParameters()
randomizeParameters
in class ParameterizedObject
public double getMinimum()
public void getMinima(double a, double b, edu.stanford.multiagent.gamer.functions.PolyFunction deriv, java.util.Vector v)
public double getMinimum(double a, double b, edu.stanford.multiagent.gamer.functions.PolyFunction deriv)
public edu.stanford.multiagent.gamer.functions.PolyFunction getDerivative() throws java.lang.Exception
java.lang.Exception
public edu.stanford.multiagent.gamer.functions.PolyFunction integrate() throws java.lang.Exception
java.lang.Exception
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |