genopt.algorithm.util.linesearch
Class IntervalDivider

java.lang.Object
  extended by genopt.algorithm.util.linesearch.IntervalDivider
Direct Known Subclasses:
FibonacciDivision, GoldenRatio

public abstract class IntervalDivider
extends java.lang.Object

Abstract class for doing a line search using an interval division method.

This project was carried out at:

and supported by

GenOpt Copyright (c) 1998-2011, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.

Version:
GenOpt(R) 3.1.0 (December 8, 2011)

Author:
Michael Wetter

Field Summary
private  double dFMin
          The minimal difference between the lowest 3 function values that has to be obtained before the search stops (only used if stoCri=1
protected  int dimF
          The number of function values
protected  int dimX
          The number of independent variables
(package private)  double[] dx
          The maximal width of the interval (dx=xEnd-x0)
private  double fLowBor
          The lower function value of the 2 border (x0 or x3) that limit the interval of uncertainty
protected static java.lang.String LS
          System dependent line separator
protected  int nIntRed
          The counter for number of interval reductions
protected  int nIntRedMax
          The maximum number of interval reductions
protected static int NINTREDMAXDEF
          The default value for number of interval reductions
protected  Optimizer opt
          The reference to the Optimizer object
private  int stoCri
          The stopping criteria 0: number of interval reduction 1: maximum difference of the best 3 function values
protected  Point x0
          The lowest value on abscissa (start of interval)
protected  Point x1
          The 2nd lowest value on abscissa
protected  Point x2
          The 3rd lowest value on abscissa
protected  Point x3
          The highest value on abscissa
protected  Point xLow
          The lower border of the uncertainty interval after stop of algorithm
protected  Point xMin
          The point with the lowest obtained function value
protected  Point xUpp
          The upper border of the uncertainty interval after stop of algorithm
 
Constructor Summary
IntervalDivider(Optimizer o)
          Constructor
 
Method Summary
private  Point getF(Point x)
          Evaluates the objective function and reports the results
private  Point[] getF(Point[] x)
          Evaluates the objective function and reports the results
protected abstract  double getReductionFactor()
          Gets the reduction factor q = I(n+1)/I(n)
 Point getXLower()
          gets the lower bound of the uncertainty interval
 Point getXMin()
          Gets the point with the lowest function value
 Point getXUpper()
          gets the upper bound of the uncertainty interval
private  boolean isDFltdFMin()
          Checks whether the difference between the lower of either f1 or f2 and the lower of either f0 or f3 is smaller than the prescribed dFMin
protected  boolean iterate()
          Checks whether the iteration has to be continued.
 int run(Point xS, Point xE)
          Runs a line search in the interval from xS to xE.
 void setAbsDFMin(double dFMinimal, int nMax)
          Sets the minimal absolut difference between the lowest function values as the stopping criteria
 void setMaxIntRed(int n)
          Sets the maximum number of interval reductions
abstract  void setUncertaintyInterval(double dx)
          Sets the fraction of the desired uncertainty interval (0..1)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LS

protected static final java.lang.String LS
System dependent line separator


NINTREDMAXDEF

protected static final int NINTREDMAXDEF
The default value for number of interval reductions

See Also:
Constant Field Values

opt

protected Optimizer opt
The reference to the Optimizer object


dimX

protected int dimX
The number of independent variables


dimF

protected int dimF
The number of function values


dx

double[] dx
The maximal width of the interval (dx=xEnd-x0)


x0

protected Point x0
The lowest value on abscissa (start of interval)


xMin

protected Point xMin
The point with the lowest obtained function value


x1

protected Point x1
The 2nd lowest value on abscissa


x2

protected Point x2
The 3rd lowest value on abscissa


x3

protected Point x3
The highest value on abscissa


xLow

protected Point xLow
The lower border of the uncertainty interval after stop of algorithm


xUpp

protected Point xUpp
The upper border of the uncertainty interval after stop of algorithm


fLowBor

private double fLowBor
The lower function value of the 2 border (x0 or x3) that limit the interval of uncertainty


nIntRed

protected int nIntRed
The counter for number of interval reductions


nIntRedMax

protected int nIntRedMax
The maximum number of interval reductions


stoCri

private int stoCri
The stopping criteria
      0: number of interval reduction
      1: maximum difference of the best 3 function values


dFMin

private double dFMin
The minimal difference between the lowest 3 function values that has to be obtained before the search stops (only used if stoCri=1

Constructor Detail

IntervalDivider

public IntervalDivider(Optimizer o)
Constructor

Parameters:
o - a reference to the Optimizer object
Method Detail

getXMin

public Point getXMin()
Gets the point with the lowest function value

Returns:
the point with the lowest function value

getReductionFactor

protected abstract double getReductionFactor()
Gets the reduction factor q = I(n+1)/I(n)

Returns:
the reduction factor q = I(n+1)/I(n)

run

public int run(Point xS,
               Point xE)
        throws OptimizerException,
               java.lang.Exception
Runs a line search in the interval from xS to xE.

Parameters:
xS - the start point of the interval
xE - the end point of the interval
Returns:
-2 if the objective function has a null space, and the stopping criteria is not equal to 1
-1 if the maximum number of iteration is exceeded
+1 if the required accuracy is reached
Throws:
OptimizerException
OptimizerException - if an OptimizerException occurs
java.lang.Exception - if an Exception occurs

setUncertaintyInterval

public abstract void setUncertaintyInterval(double dx)
Sets the fraction of the desired uncertainty interval (0..1)

Parameters:
dx - the normalized fraction of the uncertainty interval

setAbsDFMin

public void setAbsDFMin(double dFMinimal,
                        int nMax)
                 throws OptimizerException
Sets the minimal absolut difference between the lowest function values as the stopping criteria

Parameters:
dFMinimal - the minimal difference between the lowest function values that has to be obtained before the search stops
nMax - the maximum number of iteration before the search stops (in case that dFMinimal cannot be obtained within a reasonable number of trials)
Throws:
OptimizerException

setMaxIntRed

public void setMaxIntRed(int n)
Sets the maximum number of interval reductions

Parameters:
n - the maximum number of interval reductions

getXLower

public Point getXLower()
gets the lower bound of the uncertainty interval

Returns:
the lower bound of the uncertainty interval

getXUpper

public Point getXUpper()
gets the upper bound of the uncertainty interval

Returns:
the upper bound of the uncertainty interval

iterate

protected boolean iterate()
Checks whether the iteration has to be continued.

Returns:
true if iteration has to be continued, false if tolerance has been achieved, or the required number of interval reductions has been achieved.

isDFltdFMin

private boolean isDFltdFMin()
Checks whether the difference between the lower of either f1 or f2 and the lower of either f0 or f3 is smaller than the prescribed dFMin

Returns:
true if difference is smaller, false otherwise

getF

private Point getF(Point x)
            throws OptimizerException,
                   java.lang.Exception
Evaluates the objective function and reports the results

Parameters:
x - the point being evaluated
Throws:
OptimizerException - if an OptimizerException occurs
java.lang.Exception - if an Exception occurs

getF

private Point[] getF(Point[] x)
              throws OptimizerException,
                     java.lang.Exception
Evaluates the objective function and reports the results

Parameters:
x - the point being evaluated
Throws:
OptimizerException - if an OptimizerException occurs
java.lang.Exception - if an Exception occurs