Class ConvergingAlgorithmImpl
- java.lang.Object
-
- org.apache.commons.math.ConvergingAlgorithmImpl
-
- All Implemented Interfaces:
ConvergingAlgorithm
- Direct Known Subclasses:
AbstractUnivariateRealOptimizer,UnivariateRealIntegratorImpl,UnivariateRealSolverImpl
public abstract class ConvergingAlgorithmImpl extends java.lang.Object implements ConvergingAlgorithm
Deprecated.in 2.2 (to be removed in 3.0).Provide a default implementation for several functions useful to generic converging algorithms.- Since:
- 2.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description doublegetAbsoluteAccuracy()Deprecated.Get the actual absolute accuracy.intgetIterationCount()Deprecated.Get the number of iterations in the last run of the algorithm.intgetMaximalIterationCount()Deprecated.Get the upper limit for the number of iterations.doublegetRelativeAccuracy()Deprecated.Get the actual relative accuracy.voidresetAbsoluteAccuracy()Deprecated.Reset the absolute accuracy to the default.voidresetMaximalIterationCount()Deprecated.Reset the upper limit for the number of iterations to the default.voidresetRelativeAccuracy()Deprecated.Reset the relative accuracy to the default.voidsetAbsoluteAccuracy(double accuracy)Deprecated.Set the absolute accuracy.voidsetMaximalIterationCount(int count)Deprecated.Set the upper limit for the number of iterations.voidsetRelativeAccuracy(double accuracy)Deprecated.Set the relative accuracy.
-
-
-
Method Detail
-
getIterationCount
public int getIterationCount()
Deprecated.Get the number of iterations in the last run of the algorithm.This is mainly meant for testing purposes. It may occasionally help track down performance problems: if the iteration count is notoriously high, check whether the problem is evaluated properly, and whether another algorithm is more amenable to the problem.
- Specified by:
getIterationCountin interfaceConvergingAlgorithm- Returns:
- the last iteration count.
-
setAbsoluteAccuracy
public void setAbsoluteAccuracy(double accuracy)
Deprecated.Set the absolute accuracy.The default is usually chosen so that results in the interval -10..-0.1 and +0.1..+10 can be found with a reasonable accuracy. If the expected absolute value of your results is of much smaller magnitude, set this to a smaller value.
Algorithms are advised to do a plausibility check with the relative accuracy, but clients should not rely on this.
- Specified by:
setAbsoluteAccuracyin interfaceConvergingAlgorithm- Parameters:
accuracy- the accuracy.
-
getAbsoluteAccuracy
public double getAbsoluteAccuracy()
Deprecated.Get the actual absolute accuracy.- Specified by:
getAbsoluteAccuracyin interfaceConvergingAlgorithm- Returns:
- the accuracy
-
resetAbsoluteAccuracy
public void resetAbsoluteAccuracy()
Deprecated.Reset the absolute accuracy to the default.The default value is provided by the algorithm implementation.
- Specified by:
resetAbsoluteAccuracyin interfaceConvergingAlgorithm
-
setMaximalIterationCount
public void setMaximalIterationCount(int count)
Deprecated.Set the upper limit for the number of iterations.Usually a high iteration count indicates convergence problems. However, the "reasonable value" varies widely for different algorithms. Users are advised to use the default value supplied by the algorithm.
A
ConvergenceExceptionwill be thrown if this number is exceeded.- Specified by:
setMaximalIterationCountin interfaceConvergingAlgorithm- Parameters:
count- maximum number of iterations
-
getMaximalIterationCount
public int getMaximalIterationCount()
Deprecated.Get the upper limit for the number of iterations.- Specified by:
getMaximalIterationCountin interfaceConvergingAlgorithm- Returns:
- the actual upper limit
-
resetMaximalIterationCount
public void resetMaximalIterationCount()
Deprecated.Reset the upper limit for the number of iterations to the default.The default value is supplied by the algorithm implementation.
- Specified by:
resetMaximalIterationCountin interfaceConvergingAlgorithm- See Also:
ConvergingAlgorithm.setMaximalIterationCount(int)
-
setRelativeAccuracy
public void setRelativeAccuracy(double accuracy)
Deprecated.Set the relative accuracy.This is used to stop iterations if the absolute accuracy can't be achieved due to large values or short mantissa length.
If this should be the primary criterion for convergence rather then a safety measure, set the absolute accuracy to a ridiculously small value, like
MathUtils.SAFE_MIN.- Specified by:
setRelativeAccuracyin interfaceConvergingAlgorithm- Parameters:
accuracy- the relative accuracy.
-
getRelativeAccuracy
public double getRelativeAccuracy()
Deprecated.Get the actual relative accuracy.- Specified by:
getRelativeAccuracyin interfaceConvergingAlgorithm- Returns:
- the accuracy
-
resetRelativeAccuracy
public void resetRelativeAccuracy()
Deprecated.Reset the relative accuracy to the default. The default value is provided by the algorithm implementation.- Specified by:
resetRelativeAccuracyin interfaceConvergingAlgorithm
-
-