|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.jhu.bme.smile.commons.optimize.NewtonMethod1D
public class NewtonMethod1D
This optimizer uses Newton's Method of finding roots to find extrema. The extrema occur where the first derivative is 0. Newton's method takes the 2nd derivative of the original function to find the roots of the first derivative, which in turn gives you the extrema. This method depends heavily on what the derivative looks like. You must start close to the extrema. Otherwise, it might go in the right direction. But for nice functions, it is very fast.
| Constructor Summary | |
|---|---|
NewtonMethod1D()
Default constructor. |
|
NewtonMethod1D(int maxIter)
Constructor to specify optimizer and maximum iterations |
|
| Method Summary | |
|---|---|
double |
getExtrema()
Gets the extrema that was found |
int |
getIterations()
Gets the number of iterations done. |
java.util.ArrayList<double[]> |
getLog()
Gets the logged data |
void |
initialize(Optimizable1DContinuousDifferentiable function)
Initialize the optimizer with the Differentiable 1D function. |
void |
initialize(Optimizable1DContinuousDifferentiable function,
double init)
Initialize the optimizer with the Differentiable 1D function. |
void |
logData(boolean turnOn,
int maxSteps)
Turns on logging for each iteration of the optimization. |
boolean |
optimize(boolean findMinima)
Optimizes the function |
void |
setGamma(double g)
Sets gamma, the coefficient to multiply the step by. |
java.lang.String |
statusMessage()
Gets the status message from the optimizing process |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NewtonMethod1D()
public NewtonMethod1D(int maxIter)
maxIter - maximum number of iterations| Method Detail |
|---|
public void logData(boolean turnOn,
int maxSteps)
turnOn - true if logging, false if notmaxSteps - maximum number of steps to logpublic java.util.ArrayList<double[]> getLog()
public double getExtrema()
getExtrema in interface Optimizer1DContinuousDifferentiablepublic int getIterations()
getIterations in interface Optimizer1DContinuousDifferentiablepublic void setGamma(double g)
g - gammapublic void initialize(Optimizable1DContinuousDifferentiable function)
initialize in interface Optimizer1DContinuousDifferentiablefunction - your Optimizable1DContinuousDifferentiable function
public void initialize(Optimizable1DContinuousDifferentiable function,
double init)
function - your Optimizable1DContinuousDifferentiable functioninit - initial pointpublic boolean optimize(boolean findMinima)
optimize in interface Optimizer1DContinuousDifferentiablefindMinima - true if you want to find the minimum, false if you want to find the maximum
public java.lang.String statusMessage()
statusMessage in interface Optimizer1DContinuousDifferentiable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||