org.ascape.util
Class Function

java.lang.Object
  extended by org.ascape.util.Function
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

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
Author:
Miles Parker
See Also:
Serialized Form

Field Summary
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.
 
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.

See Also:
Constant Field Values
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


Copyright © 1998-2008 The Brookings Institution, NuTech Solutions, Metascape, LLC All Rights Reserved.