edu.brook.ascape.util
Class Function

java.lang.Object
  |
  +--edu.brook.ascape.util.Function

public abstract class Function
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

A one-dimensional function.

Since:
1.0
Version:
1.0
See Also:
Serialized Form

Field Summary
protected static double f2
          The result value for the second measurement.
protected static double f3
          The result value for the third measurement.
protected  double gap1
          The X axis gap between the first and second measurements
protected  double gap2
          The X axis gap between the second and third measurements (after one measurement has been dropped, leaving three total.)
static double resolution
          Desired resolution of maximization.
static double sectLarge
          Large end of golden section.
static double sectSmall
          Small end of golden section.
static double tau
          Tau "magic" number.
protected static double x1
          The first measurement of the current interval.
protected static double x2
          The second measurement of the current interval.
protected static double x3
          The third measurement of the current interval.
protected static double x4
          The fourth measurement of the current interval.
 
Constructor Summary
Function()
           
 
Method Summary
 java.lang.Object clone()
          Clones this function.
 double maximize()
          Maximize the output of this function, assuming function is unimodal, using a golden section search strategy.
 double solveFor(double x)
          Solve this (single-variable) function.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tau

public static final double tau
Tau "magic" number. ~1.61803

sectLarge

public static final double sectLarge
Large end of golden section. ~.61803

sectSmall

public static final double sectSmall
Small end of golden section. ~.38197

resolution

public static final double resolution
Desired resolution of maximization.

x1

protected static double x1
The first measurement of the current interval. For minor performance reasons, this and other measurements are not initialized in the body of the maximization functions. This can easily be changed if desired. Also, please note that this class is _not_ thread safe; in order to make it so, simply initialize the following variables within a contructor (or in the method body), make them non-static, and synchronize the methods as appropriate.

x2

protected static double x2
The second measurement of the current interval.

x3

protected static double x3
The third measurement of the current interval.

x4

protected static double x4
The fourth measurement of the current interval.

f2

protected static double f2
The result value for the second measurement.

f3

protected static double f3
The result value for the third measurement.

gap1

protected double gap1
The X axis gap between the first and second measurements

gap2

protected double gap2
The X axis gap between the second and third measurements (after one measurement has been dropped, leaving three total.)
Constructor Detail

Function

public Function()
Method Detail

maximize

public double maximize()
Maximize the output of this function, assuming function is unimodal, using a golden section search strategy. See Press, Flannery, Teukolsky, Vetterling _Numerical Recipes in *_ 10.1 for general guidelines, but not for specific implementation.
Returns:
the optimal input variable

solveFor

public double solveFor(double x)
Solve this (single-variable) function. Override to define your own function.
Parameters:
x - the variable input parameter
Returns:
the output value

clone

public java.lang.Object clone()
Clones this function.
Overrides:
clone in class java.lang.Object

(c) 1998-2000 The Brookings Insitution
Webpage