genopt.algorithm
Class NelderMeadONeill

java.lang.Object
  extended by genopt.algorithm.Optimizer
      extended by genopt.algorithm.NelderMeadONeill

public class NelderMeadONeill
extends Optimizer

Class for minimizing a function using the Simplex algorithm of Nelder and Mead with an extension by O'Neill.
The restart criterion can be modified (optimality condition is then only checked if we have just a partial inside contraction or a total contraction done and if d(i)^T*d(i-1) < 0 holds where d(i) = (x(i)-x(i-1)).

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
protected  double cFactor
          The step size factor for perturbation and reconstruction
protected  int[] con
          The kind of constraints
protected  int dimX
          The dimension of the problem
protected  int dimXP1
          The dimension of the problem plus 1
protected  int konvge
          A flag whether the convergence check is only allowed after 'konvge' main iterations
protected  double[] low
          The lower bounds
protected  boolean modStoCri
          A flag whether the stopping criterion has to be modified or not
protected  double sqEps
          The required accuracy of the variance (eps*eps)
protected  double[] upp
          The upper bounds
protected  Point[] x
          The points
 
Fields inherited from class genopt.algorithm.Optimizer
done, EXCLUDING, FS, INCLUDING, LS, MAINITERATION, ORIGINAL, SUBITERATION, TRANSFORMED
 
Constructor Summary
NelderMeadONeill(GenOpt genOptData)
          Constructor
 
Method Summary
protected  int getBest()
          Gets the number of the best point
protected  int getWorst()
          Gets the number of the worst point
protected  double[] getXCenter(int worst)
          Gets the center point for the reflection
protected  int rank(double f)
          Compares a trial with the other vertices
protected  double[] reflect(double[] xCenter, double[] xWorst)
          Reflects a point
protected  boolean restartCriterion()
          Determines whether a restart with a smaller simplex should be tried or not
 int run(Point x0)
          Runs the optimization process until a termination criteria is satisfied
 
Methods inherited from class genopt.algorithm.Optimizer
algorithmRequiresUsageOfStepNumber, appendToOutputListing, checkMaxIteration, checkObjectiveFunctionValue, ensureOnlyContinuousParameters, ensureOnlyDiscreteParameters, getAbsAccuracyFunction, getDimensionContinuous, getDimensionDiscrete, getDimensionF, getDimensionX, getDiscreteValueDouble0, getDx, getDx0, getF, getF, getIndex0, getIndex0, getInputValueBoolean, getInputValueDouble, getInputValueDouble, getInputValueInteger, getInputValueInteger, getInputValueString, getInputValueString, getKindOfConstraint, getL, getLengthDiscrete, getMainIterationNumber, getMaximumThreadPoolSize, getMaxIterationNumber, getMinimumPoint, getMode, getObjectiveFunctionName, getOutputPath, getPointerToEqualPoints, getRelAccuracyFunction, getSimulationNumber, getStepNumber, getU, getVariableNameContinuous, getVariableNameDiscrete, getX0, getX0, goToEndOfCommandFile, increaseStepNumber, increaseStepNumber, isFeasible, isNextToken, maxIterationReached, mustStopOptimization, print, println, replace, report, reportCurrentLowestPoint, reportMinimum, resetStepNumber, roundCoordinates, run, setInfo, setMode, setNumberOfMatchingResults, setToFeasibleCoordinate, setToFeasibleCoordinate, setWarning, simulate, throwInputError, useStepNumber, writeStepNumber
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

protected Point[] x
The points


low

protected double[] low
The lower bounds


upp

protected double[] upp
The upper bounds


con

protected int[] con
The kind of constraints


dimX

protected int dimX
The dimension of the problem


dimXP1

protected int dimXP1
The dimension of the problem plus 1


sqEps

protected double sqEps
The required accuracy of the variance (eps*eps)


konvge

protected int konvge
A flag whether the convergence check is only allowed after 'konvge' main iterations


cFactor

protected double cFactor
The step size factor for perturbation and reconstruction


modStoCri

protected boolean modStoCri
A flag whether the stopping criterion has to be modified or not

Constructor Detail

NelderMeadONeill

public NelderMeadONeill(GenOpt genOptData)
                 throws OptimizerException,
                        java.io.IOException,
                        java.lang.Exception,
                        InputFormatException
Constructor

Parameters:
genOptData - a reference to the GenOpt object.
Note: the object is used as a reference. Hence, the datas of GenOpt are modified by this Class.
Throws:
OptimizerException - if algorithm is used for problems with less than 2 independent variables
java.lang.Exception - if an exception occurs
java.io.IOException - if an I/O exception occurs
InputFormatException - if an input format is wrong
Method Detail

run

public int run(Point x0)
        throws OptimizerException,
               java.lang.Exception
Runs the optimization process until a termination criteria is satisfied

Specified by:
run in class Optimizer
Parameters:
x0 - initial point
Returns:
-1 if the maximum number of iteration is exceeded
+1 if the required accuracy is reached
Throws:
java.lang.Exception
OptimizerException
InputFormatException - if an InputFormatException occurs
java.lang.NoSuchMethodException - if a method that should be invoked could not be found
java.lang.IllegalAccessException - if an invoked method enforces Java language access control and the underlying method is inaccessible
java.lang.reflect.InvocationTargetException - if an invoked method throws an exception

restartCriterion

protected boolean restartCriterion()
Determines whether a restart with a smaller simplex should be tried or not

Returns:
true if restart can be tried, false otherwise

getWorst

protected int getWorst()
Gets the number of the worst point

Returns:
the index w such that f(x(k,w)) = max(f(x(k,i)), i=0..dimX(x))

getBest

protected int getBest()
Gets the number of the best point

Returns:
the index w such that f(x(k,w)) = min(f(x(k,i)), i=0..dimX(x))

getXCenter

protected double[] getXCenter(int worst)
Gets the center point for the reflection

Parameters:
worst - the index of the worst point
Returns:
the center point for the reflection, such that x = 1 / dimX(x) * sum(x(k,i), i = 0..dimX(x), i != worst)

reflect

protected double[] reflect(double[] xCenter,
                           double[] xWorst)
Reflects a point

Parameters:
xCenter - the center point for normal reflection
xWorst - the point that has to be reflected
Returns:
the new point, such that xNew = 2 * xCenter - xWorst

rank

protected int rank(double f)
Compares a trial with the other vertices

Parameters:
f - the trial to be compared
Returns:
the number of ranking where 0 stands for the best point