public class EvaluationRmsChecker extends java.lang.Object implements ConvergenceChecker<LeastSquaresProblem.Evaluation>
Modifier and Type | Field and Description |
---|---|
private double |
absTol
absolute tolerance for comparisons.
|
private double |
relTol
relative tolerance for comparisons.
|
Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
boolean |
converged(int iteration,
LeastSquaresProblem.Evaluation previous,
LeastSquaresProblem.Evaluation current)
Check if the optimization algorithm has converged.
|
private final double relTol
private final double absTol
public EvaluationRmsChecker(double tol)
Convenience constructor for when the relative and absolute tolerances are the
same. Same as new EvaluationRmsChecker(tol, tol)
.
tol
- the relative and absolute tolerance.EvaluationRmsChecker(double, double)
public EvaluationRmsChecker(double relTol, double absTol)
The optimization has converged when the RMS of consecutive evaluations are equal to within the given relative tolerance or absolute tolerance.
relTol
- the relative tolerance.absTol
- the absolute tolerance.Precision.equals(double, double, double)
,
Precision.equalsWithRelativeTolerance(double, double, double)
public boolean converged(int iteration, LeastSquaresProblem.Evaluation previous, LeastSquaresProblem.Evaluation current)
converged
in interface ConvergenceChecker<LeastSquaresProblem.Evaluation>
iteration
- Current iteration.previous
- Best point in the previous iteration.current
- Best point in the current iteration.true
if the algorithm is considered to have converged.