edu.jhu.bme.smile.commons.optimize
Class GoldenSectionSearch1D

java.lang.Object
  extended by edu.jhu.bme.smile.commons.optimize.GoldenSectionSearch1D
All Implemented Interfaces:
Optimizer1DContinuous

public class GoldenSectionSearch1D
extends java.lang.Object
implements Optimizer1DContinuous

Class GoldenSectionSearch1D Uses the gold section search algorithm to find the minima of a 1D function

Author:
Yufeng Guo

Constructor Summary
GoldenSectionSearch1D()
          Default constructor Sets iterations to 1000
GoldenSectionSearch1D(int maxIter)
          Constructor that allows setting the maximum number of iterations.
 
Method Summary
 double getExtrema()
          Gets the extrema that was found
 int getIterations()
          Gets the number of iterations done.
 java.util.ArrayList<double[]> getLog()
          Gets the logged data
 void initialize(Optimizable1DContinuous function)
          Sets up the optimization.
 void logData(boolean turnOn, int maxSteps)
          Turns on logging for each iteration of the optimization.
 boolean optimize(boolean findMinima)
          Optimizes the function
 java.lang.String statusMessage()
          Gets the status message from the optimizing process
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GoldenSectionSearch1D

public GoldenSectionSearch1D()
Default constructor Sets iterations to 1000


GoldenSectionSearch1D

public GoldenSectionSearch1D(int maxIter)
Constructor that allows setting the maximum number of iterations.

Parameters:
max - iterations desired
Method Detail

logData

public void logData(boolean turnOn,
                    int maxSteps)
Turns on logging for each iteration of the optimization.

Parameters:
turnOn - true if logging, false if not
maxSteps - maximum number of steps to log

getLog

public java.util.ArrayList<double[]> getLog()
Gets the logged data

Returns:
array of logged data

getExtrema

public double getExtrema()
Gets the extrema that was found

Specified by:
getExtrema in interface Optimizer1DContinuous
Returns:
the extrema array of where the extrema is

getIterations

public int getIterations()
Gets the number of iterations done.

Specified by:
getIterations in interface Optimizer1DContinuous
Returns:
number of iterations

initialize

public void initialize(Optimizable1DContinuous function)
Sets up the optimization.

Specified by:
initialize in interface Optimizer1DContinuous
Parameters:
function - to be optimized

optimize

public boolean optimize(boolean findMinima)
Optimizes the function

Specified by:
optimize in interface Optimizer1DContinuous
Parameters:
findMinima - true if looking for minimum, false for maximum
Returns:
true only if minimum is found

statusMessage

public java.lang.String statusMessage()
Gets the status message from the optimizing process

Specified by:
statusMessage in interface Optimizer1DContinuous
Returns:
string of the status message