|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math.ConvergingAlgorithmImpl
org.apache.commons.math.optimization.univariate.AbstractUnivariateRealOptimizer
public abstract class AbstractUnivariateRealOptimizer
Provide a default implementation for several functions useful to generic optimizers.
Field Summary | |
---|---|
protected double |
functionValue
Value of the function at the last computed result. |
protected double |
result
The last computed root. |
protected boolean |
resultComputed
Indicates where a root has been computed. |
Fields inherited from class org.apache.commons.math.ConvergingAlgorithmImpl |
---|
absoluteAccuracy, defaultAbsoluteAccuracy, defaultMaximalIterationCount, defaultRelativeAccuracy, iterationCount, maximalIterationCount, relativeAccuracy |
Constructor Summary | |
---|---|
protected |
AbstractUnivariateRealOptimizer(int defaultMaximalIterationCount,
double defaultAbsoluteAccuracy)
Construct a solver with given iteration count and accuracy. |
Method Summary | |
---|---|
protected void |
checkResultComputed()
Check if a result has been computed. |
protected void |
clearResult()
Convenience function for implementations. |
protected double |
computeObjectiveValue(UnivariateRealFunction f,
double point)
Compute the objective function value. |
int |
getEvaluations()
Get the number of evaluations of the objective function. |
double |
getFunctionValue()
Get the result of the last run of the optimizer. |
int |
getMaxEvaluations()
Get the maximal number of functions evaluations. |
double |
getResult()
Get the result of the last run of the optimizer. |
void |
setMaxEvaluations(int maxEvaluations)
Set the maximal number of functions evaluations. |
protected void |
setResult(double x,
double fx,
int iterationCount)
Convenience function for implementations. |
Methods inherited from class org.apache.commons.math.ConvergingAlgorithmImpl |
---|
getAbsoluteAccuracy, getIterationCount, getMaximalIterationCount, getRelativeAccuracy, resetAbsoluteAccuracy, resetMaximalIterationCount, resetRelativeAccuracy, setAbsoluteAccuracy, setMaximalIterationCount, setRelativeAccuracy |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.commons.math.optimization.UnivariateRealOptimizer |
---|
optimize, optimize |
Methods inherited from interface org.apache.commons.math.ConvergingAlgorithm |
---|
getAbsoluteAccuracy, getIterationCount, getMaximalIterationCount, getRelativeAccuracy, resetAbsoluteAccuracy, resetMaximalIterationCount, resetRelativeAccuracy, setAbsoluteAccuracy, setMaximalIterationCount, setRelativeAccuracy |
Field Detail |
---|
protected boolean resultComputed
protected double result
protected double functionValue
Constructor Detail |
---|
protected AbstractUnivariateRealOptimizer(int defaultMaximalIterationCount, double defaultAbsoluteAccuracy)
defaultAbsoluteAccuracy
- maximum absolute errordefaultMaximalIterationCount
- maximum number of iterations
IllegalArgumentException
- if f is null or the
defaultAbsoluteAccuracy is not validMethod Detail |
---|
protected void checkResultComputed() throws IllegalStateException
IllegalStateException
- if no result has been computedpublic double getResult()
getResult
in interface UnivariateRealOptimizer
public double getFunctionValue()
getFunctionValue
in interface UnivariateRealOptimizer
protected final void setResult(double x, double fx, int iterationCount)
x
- the result to setfx
- the result to setiterationCount
- the iteration count to setprotected final void clearResult()
public void setMaxEvaluations(int maxEvaluations)
setMaxEvaluations
in interface UnivariateRealOptimizer
maxEvaluations
- maximal number of function evaluationspublic int getMaxEvaluations()
getMaxEvaluations
in interface UnivariateRealOptimizer
public int getEvaluations()
The number of evaluations corresponds to the last call to the
optimize
method. It is 0 if the method has not been called yet.
getEvaluations
in interface UnivariateRealOptimizer
protected double computeObjectiveValue(UnivariateRealFunction f, double point) throws FunctionEvaluationException
f
- objective functionpoint
- point at which the objective function must be evaluated
FunctionEvaluationException
- if the function cannot be evaluated
or the maximal number of iterations is exceeded
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |