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

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
                      extended by gov.sandia.cognition.learning.algorithm.root.RootFinderNewtonsMethod
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

@PublicationReference(author="Wikipedia",
                      title="Newton\'s Method",
                      type=WebPage,
                      year=2010,
                      url="http://en.wikipedia.org/wiki/Newton%27s_method")
public class RootFinderNewtonsMethod
extends AbstractRootFinder

Newton's method, sometimes called Newton-Raphson method, uses first-order derivative information to iteratively locate a root. The algorithm is extremely efficient but can be unstable when the derivative approaches zero.

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

Field Summary
 DefaultInputOutputPair<Double,Double> result
          Resulting estimated location of the root.
 
Fields inherited from class gov.sandia.cognition.learning.algorithm.root.AbstractRootFinder
DEFAULT_MAX_ITERATIONS, DEFAULT_TOLERANCE
 
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
RootFinderNewtonsMethod()
          Creates a new instance of RootFinderNewtonsMethod
 
Method Summary
protected  void cleanupAlgorithm()
          Called to clean up the learning algorithm's state after learning has finished.
 RootFinderNewtonsMethod clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
 DefaultInputOutputPair<Double,Double> getResult()
          Gets the current result of the algorithm.
protected  boolean initializeAlgorithm()
          Called to initialize the learning algorithm's state based on the data that is stored in the data field.
protected  boolean step()
          Called to take a single step of the learning algorithm.
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.root.AbstractRootFinder
getInitialGuess, getPerformance, getTolerance, setInitialGuess, setTolerance
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.AbstractAnytimeBatchLearner
getData, getKeepGoing, learn, setData, setKeepGoing, 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, 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

result

public DefaultInputOutputPair<Double,Double> result
Resulting estimated location of the root.

Constructor Detail

RootFinderNewtonsMethod

public RootFinderNewtonsMethod()
Creates a new instance of RootFinderNewtonsMethod

Method Detail

clone

public RootFinderNewtonsMethod 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 AbstractRootFinder
Returns:
A clone of this object.

initializeAlgorithm

protected boolean initializeAlgorithm()
Description copied from class: AbstractAnytimeBatchLearner
Called to initialize the learning algorithm's state based on the data that is stored in the data field. The return value indicates if the algorithm can be run or not based on the initialization.

Specified by:
initializeAlgorithm in class AbstractAnytimeBatchLearner<Evaluator<Double,Double>,InputOutputPair<Double,Double>>
Returns:
True if the learning algorithm can be run and false if it cannot.

step

protected boolean step()
Description copied from class: AbstractAnytimeBatchLearner
Called to take a single step of the learning algorithm.

Specified by:
step in class AbstractAnytimeBatchLearner<Evaluator<Double,Double>,InputOutputPair<Double,Double>>
Returns:
True if another step can be taken and false it the algorithm should halt.

cleanupAlgorithm

protected void cleanupAlgorithm()
Description copied from class: AbstractAnytimeBatchLearner
Called to clean up the learning algorithm's state after learning has finished.

Specified by:
cleanupAlgorithm in class AbstractAnytimeBatchLearner<Evaluator<Double,Double>,InputOutputPair<Double,Double>>

getResult

public DefaultInputOutputPair<Double,Double> getResult()
Description copied from interface: AnytimeAlgorithm
Gets the current result of the algorithm.

Returns:
Current result of the algorithm.