Documentation of 'net.finmath.optimizer.GoldenSectionSearch' Java class
GoldenSectionSearch
net.finmath.optimizer

Class GoldenSectionSearch



  • public class GoldenSectionSearch
    extends java.lang.Object
    This class implements a Golden Section search algorithm, i.e., a minimization, implemented as a question-and-answer search algorithm. Example:
     
     		GoldenSectionSearch search = new GoldenSectionSearch(-1.0, 5.0);		
     		while(search.getAccuracy() > 1E-11 && !search.isDone()) {
     			double x = search.getNextPoint();
     			
     			double y = (x - 0.656) * (x - 0.656);
     			
     			search.setValue(y);
     		}
     
     
    For an example on how to use this class see also its main method.
    • Constructor Detail

      • GoldenSectionSearch

        public GoldenSectionSearch(double leftPoint,
                                   double rightPoint)
        Parameters:
        leftPoint - left point of search interval
        rightPoint - right point of search interval
    • Method Detail

      • main

        public static void main(java.lang.String[] args)
      • getBestPoint

        public double getBestPoint()
        Returns:
        Returns the best point obtained so far.
      • getNextPoint

        public double getNextPoint()
        Returns the next point for which a valuation is requested.
        Returns:
        Returns the next point for which a value should be set using setValue.
      • setValue

        public void setValue(double value)
        Set the value corresponding to the point returned by a previous call of getNextPoint(). If setValue is called without prior call to getNextPoint(), e.g., when called twice, a RuntimeException is thrown.
        Parameters:
        value - Value corresponding to point returned by previous getNextPoint() call.
      • optimize

        public void optimize()
      • value

        public double value(double parameter)
      • getNumberOfIterations

        public int getNumberOfIterations()
        Returns:
        Returns the number of iterations needed so far.
      • getAccuracy

        public double getAccuracy()
        Returns:
        Returns the accuracy obtained so far.
      • isDone

        public boolean isDone()
        Returns:
        Returns true if the solver is unable to improve further. This may be either due to reached accuracy or due to no solution existing.

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.