org.apache.commons.math3.optimization
Class AbstractConvergenceChecker<PAIR>

java.lang.Object
  extended by org.apache.commons.math3.optimization.AbstractConvergenceChecker<PAIR>
Type Parameters:
PAIR - Type of (point, value) pair.
All Implemented Interfaces:
ConvergenceChecker<PAIR>
Direct Known Subclasses:
SimplePointChecker, SimpleValueChecker, SimpleVectorValueChecker

public abstract class AbstractConvergenceChecker<PAIR>
extends Object
implements ConvergenceChecker<PAIR>

Base class for all convergence checker implementations.

Since:
3.0
Version:
$Id$

Field Summary
private  double absoluteThreshold
          Absolute tolerance threshold.
private static double DEFAULT_ABSOLUTE_THRESHOLD
          Default absolute threshold.
private static double DEFAULT_RELATIVE_THRESHOLD
          Default relative threshold.
private  double relativeThreshold
          Relative tolerance threshold.
 
Constructor Summary
AbstractConvergenceChecker()
          Build an instance with default thresholds.
AbstractConvergenceChecker(double relativeThreshold, double absoluteThreshold)
          Build an instance with a specified thresholds.
 
Method Summary
abstract  boolean converged(int iteration, PAIR previous, PAIR current)
          Check if the optimization algorithm has converged.
 double getAbsoluteThreshold()
           
 double getRelativeThreshold()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_RELATIVE_THRESHOLD

private static final double DEFAULT_RELATIVE_THRESHOLD
Default relative threshold.

See Also:
Constant Field Values

DEFAULT_ABSOLUTE_THRESHOLD

private static final double DEFAULT_ABSOLUTE_THRESHOLD
Default absolute threshold.

See Also:
Constant Field Values

relativeThreshold

private final double relativeThreshold
Relative tolerance threshold.


absoluteThreshold

private final double absoluteThreshold
Absolute tolerance threshold.

Constructor Detail

AbstractConvergenceChecker

public AbstractConvergenceChecker()
Build an instance with default thresholds.


AbstractConvergenceChecker

public AbstractConvergenceChecker(double relativeThreshold,
                                  double absoluteThreshold)
Build an instance with a specified thresholds.

Parameters:
relativeThreshold - relative tolerance threshold
absoluteThreshold - absolute tolerance threshold
Method Detail

getRelativeThreshold

public double getRelativeThreshold()
Returns:
the relative threshold.

getAbsoluteThreshold

public double getAbsoluteThreshold()
Returns:
the absolute threshold.

converged

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

Specified by:
converged in interface ConvergenceChecker<PAIR>
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.


Copyright (c) 2003-2013 Apache Software Foundation