## org.apache.commons.math
Interface ConvergingAlgorithm

All Known Subinterfaces:
  UnivariateRealIntegrator, UnivariateRealOptimizer, UnivariateRealSolver

All Known Implementing Classes:
  AbstractUnivariateRealOptimizer, BisectionSolver, BrentOptimizer, BrentSolver, ConvergingAlgorithmImpl, LaguerreSolver, LegendreGaussIntegrator, MullerSolver, MultiStartUnivariateRealOptimizer, NewtonSolver, RiddersSolver, RombergIntegrator, SecantSolver, SimpsonIntegrator, TrapezoidIntegrator, UnivariateRealIntegratorImpl, UnivariateRealSolverImpl

    public interface ConvergingAlgorithm

Interface for algorithms handling convergence settings.

This interface only deals with convergence parameters setting, not execution of the algorithms per se.

Since:
  2.0
Version:
  $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $
See Also:
  `ConvergenceException`

Method Summary
`double` `getAbsoluteAccuracy()` Get the actual absolute accuracy.
`int` `getIterationCount()` Get the number of iterations in the last run of the algorithm.
`int` `getMaximalIterationCount()` Get the upper limit for the number of iterations.
`double` `getRelativeAccuracy()` Get the actual relative accuracy.
`void` `resetAbsoluteAccuracy()` Reset the absolute accuracy to the default.
`void` `resetMaximalIterationCount()` Reset the upper limit for the number of iterations to the default.
`void` `resetRelativeAccuracy()` Reset the relative accuracy to the default.
`void` `setAbsoluteAccuracy(double accuracy)` Set the absolute accuracy.
`void` `setMaximalIterationCount(int count)` Set the upper limit for the number of iterations.
`void` `setRelativeAccuracy(double accuracy)` Set the relative accuracy.

Method Detail

### setMaximalIterationCount

    void setMaximalIterationCount(int count)

  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 `ConvergenceException` will be thrown if this number is exceeded.

  Parameters:
    `count` - maximum number of iterations

### getMaximalIterationCount

    int getMaximalIterationCount()

  Get the upper limit for the number of iterations.

  Returns:
    the actual upper limit

### resetMaximalIterationCount

    void resetMaximalIterationCount()

  Reset the upper limit for the number of iterations to the default.

  The default value is supplied by the algorithm implementation.

  See Also:
    `setMaximalIterationCount(int)`

### setAbsoluteAccuracy

    void setAbsoluteAccuracy(double accuracy)

  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.

  Parameters:
    `accuracy` - the accuracy.
  Throws:
    `java.lang.IllegalArgumentException` - if the accuracy can't be achieved by the solver or is otherwise deemed unreasonable.

### getAbsoluteAccuracy

    double getAbsoluteAccuracy()

  Get the actual absolute accuracy.

  Returns:
    the accuracy

### resetAbsoluteAccuracy

    void resetAbsoluteAccuracy()

  Reset the absolute accuracy to the default.

  The default value is provided by the algorithm implementation.

### setRelativeAccuracy

    void setRelativeAccuracy(double accuracy)

  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`.

  Parameters:
    `accuracy` - the relative accuracy.
  Throws:
    `java.lang.IllegalArgumentException` - if the accuracy can't be achieved by the algorithm or is otherwise deemed unreasonable.

### getRelativeAccuracy

    double getRelativeAccuracy()

  Get the actual relative accuracy.

  Returns:
    the accuracy

### resetRelativeAccuracy

    void resetRelativeAccuracy()

  Reset the relative accuracy to the default. The default value is provided by the algorithm implementation.

### getIterationCount

    int getIterationCount()

  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.

  Returns:
    the last iteration count.
  Throws:
    `java.lang.IllegalStateException` - if there is no result available, either because no result was yet computed or the last attempt failed.

Copyright (c) 2003-2011 Apache Software Foundation