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

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.AbstractBracketedRootFinder
                          extended by gov.sandia.cognition.learning.algorithm.root.RootFinderSecantMethod
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="Secant method",
                      type=WebPage,
                      year=2009,
                      url="http://en.wikipedia.org/wiki/Secant_method")
public class RootFinderSecantMethod
extends AbstractBracketedRootFinder

The secant algorithm for root finding. This is a fast method but it is known to fail even in real-world cases, when a function's slope tends to zero the secant method will take near-infinite leaps. This version of the algorithm limits the maximum step size to ameliorate this problem. The algorithm works like a derivative-free approximation to the Newton-Raphson root-finding method. This is one of the fastest root-finding methods, but may fail to find a root on real-world cases. I would suggest using Ridders's method.

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

Field Summary
static double MAX_STEP
          Maximum step size allowed, 1.0
 
Fields inherited from class gov.sandia.cognition.learning.algorithm.root.AbstractBracketedRootFinder
DEFAULT_ROOT_BRACKETER
 
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
RootFinderSecantMethod()
          Creates a new instance of RootFinderSecantMethod
 
Method Summary
 InputOutputPair<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.AbstractBracketedRootFinder
cleanupAlgorithm, getBracketer, getRootBracket, setBracketer, setRootBracket
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.root.AbstractRootFinder
clone, 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

MAX_STEP

public static final double MAX_STEP
Maximum step size allowed, 1.0

See Also:
Constant Field Values
Constructor Detail

RootFinderSecantMethod

public RootFinderSecantMethod()
Creates a new instance of RootFinderSecantMethod

Method Detail

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.

Overrides:
initializeAlgorithm in class AbstractBracketedRootFinder
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.

getResult

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

Specified by:
getResult in interface AnytimeAlgorithm<InputOutputPair<Double,Double>>
Overrides:
getResult in class AbstractBracketedRootFinder
Returns:
Current result of the algorithm.