gov.sandia.cognition.learning.algorithm.root
Class AbstractRootFinder

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.algorithm.AbstractIterativeAlgorithm
          extended by gov.sandia.cognition.algorithm.AbstractAnytimeAlgorithm<ResultType>
              extended by gov.sandia.cognition.learning.algorithm.AbstractAnytimeBatchLearner<Evaluator<Double,Double>,InputOutputPair<Double,Double>>
                  extended by gov.sandia.cognition.learning.algorithm.root.AbstractRootFinder
All Implemented Interfaces:
AnytimeAlgorithm<InputOutputPair<Double,Double>>, IterativeAlgorithm, MeasurablePerformanceAlgorithm, StoppableAlgorithm, AnytimeBatchLearner<Evaluator<Double,Double>,InputOutputPair<Double,Double>>, BatchLearner<Evaluator<Double,Double>,InputOutputPair<Double,Double>>, RootFinder, CloneableSerializable, Serializable, Cloneable
Direct Known Subclasses:
AbstractBracketedRootFinder, RootFinderNewtonsMethod

public abstract class AbstractRootFinder
extends AbstractAnytimeBatchLearner<Evaluator<Double,Double>,InputOutputPair<Double,Double>>
implements RootFinder, MeasurablePerformanceAlgorithm

Partial implementation of RootFinder.

Since:
3.0
Author:
Kevin R. Dixon
See Also:
Serialized Form

Field Summary
static int DEFAULT_MAX_ITERATIONS
          Default maximum number of iterations, 1000.
static double DEFAULT_TOLERANCE
          Default tolerance of the algorithm, 1.0E-5.
 
Fields inherited from class gov.sandia.cognition.learning.algorithm.AbstractAnytimeBatchLearner
data, keepGoing
 
Fields inherited from class gov.sandia.cognition.algorithm.AbstractAnytimeAlgorithm
maxIterations
 
Fields inherited from class gov.sandia.cognition.algorithm.AbstractIterativeAlgorithm
DEFAULT_ITERATION, iteration
 
Constructor Summary
AbstractRootFinder()
          Creates a new instance of AbstractRootFinder
 
Method Summary
 AbstractRootFinder clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
 double getInitialGuess()
          Returns the initial guess of the root.
 NamedValue<Double> getPerformance()
          Gets the name-value pair that describes the current performance of the algorithm.
 double getTolerance()
          Gets the tolerance of the algorithm.
 void setInitialGuess(double initialGuess)
          Sets the initial guess of the root (zero-crossing), which is supplied as input to the function to find the zero-crossings of.
 void setTolerance(double tolerance)
          Sets the tolerance of the algorithm.
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.AbstractAnytimeBatchLearner
cleanupAlgorithm, getData, getKeepGoing, initializeAlgorithm, learn, setData, setKeepGoing, step, stop
 
Methods inherited from class gov.sandia.cognition.algorithm.AbstractAnytimeAlgorithm
getMaxIterations, isResultValid, setMaxIterations
 
Methods inherited from class gov.sandia.cognition.algorithm.AbstractIterativeAlgorithm
addIterativeAlgorithmListener, fireAlgorithmEnded, fireAlgorithmStarted, fireStepEnded, fireStepStarted, getIteration, getListeners, removeIterativeAlgorithmListener, setIteration, setListeners
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.learning.algorithm.BatchLearner
learn
 
Methods inherited from interface gov.sandia.cognition.algorithm.AnytimeAlgorithm
getMaxIterations, getResult, setMaxIterations
 
Methods inherited from interface gov.sandia.cognition.algorithm.IterativeAlgorithm
addIterativeAlgorithmListener, getIteration, removeIterativeAlgorithmListener
 
Methods inherited from interface gov.sandia.cognition.algorithm.StoppableAlgorithm
isResultValid, stop
 

Field Detail

DEFAULT_TOLERANCE

public static final double DEFAULT_TOLERANCE
Default tolerance of the algorithm, 1.0E-5.

See Also:
Constant Field Values

DEFAULT_MAX_ITERATIONS

public static final int DEFAULT_MAX_ITERATIONS
Default maximum number of iterations, 1000.

See Also:
Constant Field Values
Constructor Detail

AbstractRootFinder

public AbstractRootFinder()
Creates a new instance of AbstractRootFinder

Method Detail

clone

public AbstractRootFinder clone()
Description copied from class: AbstractCloneableSerializable
This makes public the clone method on the Object class and removes the exception that it throws. Its default behavior is to automatically create a clone of the exact type of object that the clone is called on and to copy all primitives but to keep all references, which means it is a shallow copy. Extensions of this class may want to override this method (but call super.clone() to implement a "smart copy". That is, to target the most common use case for creating a copy of the object. Because of the default behavior being a shallow copy, extending classes only need to handle fields that need to have a deeper copy (or those that need to be reset). Some of the methods in ObjectUtil may be helpful in implementing a custom clone method. Note: The contract of this method is that you must use super.clone() as the basis for your implementation.

Specified by:
clone in interface CloneableSerializable
Overrides:
clone in class AbstractAnytimeBatchLearner<Evaluator<Double,Double>,InputOutputPair<Double,Double>>
Returns:
A clone of this object.

getTolerance

public double getTolerance()
Description copied from interface: RootFinder
Gets the tolerance of the algorithm.

Specified by:
getTolerance in interface RootFinder
Returns:
Tolerance, where tolerances closer to zero are more accurate, and larger tolerances are less accurate. In any case, tolerance must be greater than or equal to zero.

setTolerance

public void setTolerance(double tolerance)
Description copied from interface: RootFinder
Sets the tolerance of the algorithm. Smaller tolerances may yield more accurate estimates but spend more computation finding them.

Specified by:
setTolerance in interface RootFinder
Parameters:
tolerance - Tolerance, where tolerances closer to zero are more accurate, and larger tolerances are less accurate. In any case, tolerance must be greater than or equal to zero.

getInitialGuess

public double getInitialGuess()
Returns the initial guess of the root.

Specified by:
getInitialGuess in interface RootFinder
Returns:
Initial guess of the root location.

setInitialGuess

public void setInitialGuess(double initialGuess)
Description copied from interface: RootFinder
Sets the initial guess of the root (zero-crossing), which is supplied as input to the function to find the zero-crossings of.

Specified by:
setInitialGuess in interface RootFinder
Parameters:
initialGuess - Initial guess of the root location.

getPerformance

public NamedValue<Double> getPerformance()
Description copied from interface: MeasurablePerformanceAlgorithm
Gets the name-value pair that describes the current performance of the algorithm. For most algorithms, this is the value that they are attempting to optimize.

Specified by:
getPerformance in interface MeasurablePerformanceAlgorithm
Returns:
The name-value pair that describes the current performance of the algorithm.