Package org.apache.commons.math3.fitting.leastsquares

# Class EvaluationRmsChecker

java.lang.Object
org.apache.commons.math3.fitting.leastsquares.EvaluationRmsChecker

All Implemented Interfaces:
  `ConvergenceChecker<LeastSquaresProblem.Evaluation>`

public class EvaluationRmsChecker extends Object implements ConvergenceChecker<LeastSquaresProblem.Evaluation>
Check if an optimization has converged based on the change in computed RMS.

Since:
  3.4

## Constructor Summary

Constructors
Constructor
Description
`EvaluationRmsChecker(double tol)`
Create a convergence checker for the RMS with the same relative and absolute tolerance.
`EvaluationRmsChecker(double relTol, double absTol)`
Create a convergence checker for the RMS with a relative and absolute tolerance.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`converged(int iteration, LeastSquaresProblem.Evaluation previous, LeastSquaresProblem.Evaluation current)`
Check if the optimization algorithm has converged.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### EvaluationRmsChecker

public EvaluationRmsChecker(double tol)
Create a convergence checker for the RMS with the same relative and absolute tolerance.

Convenience constructor for when the relative and absolute tolerances are the same. Same as `new EvaluationRmsChecker(tol, tol)`.

Parameters:
  `tol` - the relative and absolute tolerance.
See Also:
  - `EvaluationRmsChecker(double, double)`

### EvaluationRmsChecker

public EvaluationRmsChecker(double relTol, double absTol)
Create a convergence checker for the RMS with a relative and absolute tolerance.

The optimization has converged when the RMS of consecutive evaluations are equal to within the given relative tolerance or absolute tolerance.

Parameters:
  `relTol` - the relative tolerance.
  `absTol` - the absolute tolerance.
See Also:
  - `Precision.equals(double, double, double)`
  - `Precision.equalsWithRelativeTolerance(double, double, double)`

## Method Details

### converged

public boolean converged(int iteration, LeastSquaresProblem.Evaluation previous, LeastSquaresProblem.Evaluation current)
Check if the optimization algorithm has converged.

Specified by:
  `converged` in interface `ConvergenceChecker<LeastSquaresProblem.Evaluation>`
Parameters:
  `iteration` - Current iteration.
  `previous` - Best point in the previous iteration.
  `current` - Best point in the current iteration.
Returns:
  `true` if the algorithm is considered to have converged.