public abstract class ModelGPS extends Optimizer
This project was carried out at:
and supported byGenOpt Copyright (c) 1998-2021, 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.
Modifier and Type | Field and Description |
---|---|
private double |
Alpha
Exponent used for the control of the mesh size if adaptive precision function evaluations are used
|
double[][] |
basDirMat
The base direction matrix.
|
private Point[] |
BesPoi
Points for the multi-start algorithms.
|
protected boolean |
checkObjFun
A flag whether the cost function value has to be checked for previous
matching results.
|
private double |
Delta
The mesh size factor
|
private int |
dimF
The number of function values
|
private int |
dimX
The number of independent variables
|
static Point[] |
EMPTY_SEARCH_SET
Array of points with zero elements.
|
protected static java.lang.String |
FAIMOV |
private double |
fNor
The cost function value that will be used in the normalization of the sufficient decrease condition
|
private int |
iniMesSizExp
The initial mesh size exponent 's_k'
|
private int |
k
The iteration number (counting only the main loop)
|
private int |
mesSizDiv
The mesh size divider 'r'
|
private int |
mesSizExpInc
The increment of the mesh size exponent 't_k' (fixed for all k)
|
protected static java.lang.String |
NEGDIR |
protected int |
nMaxSteRed
The maximal number of step reduction before the algorithm terminates
|
private int |
nSteRed
The number of step reduction done up to now
|
private int |
NumIniPoi
Number of intial point of the multi-start algorithm
|
private FunctionEvaluator |
PhiFun
Function evaluator for the sufficient decrease condition and the mesh size control, i.e., the function phi
|
protected static java.lang.String |
POSDIR |
private java.util.Random |
RanGen
Random number generator (used for multistart algorithm)
|
private boolean |
RepMin
Flag that determines whether the minimum will be reported or not
|
protected static java.lang.String |
SUCMOV |
private Point[] |
x
The sequence of iterates
|
private double |
Zeta
Factor that will be multiplied with the function
PhiFun
for sufficient decrease in cost |
done, EXCLUDING, FS, INCLUDING, LS, MAINITERATION, ORIGINAL, SUBITERATION, TRANSFORMED
Constructor and Description |
---|
ModelGPS(GenOpt genOptData)
Constructor used to run it as a single algorithm.
|
ModelGPS(int meshSizeDivider,
int initialMeshSizeExponent)
Constructor used to run the algorithm in a hybrid algorithm for the
last iterations.
|
Modifier and Type | Method and Description |
---|---|
private double |
_getFunctionValue(FunctionEvaluator f,
Point x) |
private FunctionEvaluator |
_getPrecisionControlFunction(java.lang.String funNam,
int include)
Makes an instance of the function that is used for a sufficient decrease condition.
|
private int |
_run(Point xIni)
Runs the optimization process until a termination criteria
is satisfied
|
protected Point[] |
add(Point[] x0,
Point[] x1)
Adds two vectors of points
|
void |
checkObjectiveFunctionValue(Point x)
Checks whether the cost function value has already been
obtained previously.
|
static double[] |
getClosestEuclideanMeshPoint(double[] x,
double[] xMes,
double[] delta)
Gets the mesh point, on a rectangular mesh, that is closest to the argument.
|
protected double |
getDelta()
Gets the current mesh size factor
|
Point |
getF(Point x)
Gets the cost function value and registers it into
the data base
|
protected static int |
getIndexLowestFunctionValue(Point[] x) |
protected double |
getInitialDelta()
Gets the initial mesh size divider
|
protected int |
getIterationNumber()
Gets the iteration number
|
protected int |
getMaximumNumberOfStepReduction()
Gets the maximum number of step reductions.
|
Point |
getMinimumPoint()
Gets the minimum point.
|
protected int |
getNumberOfStepReduction()
Gets the number of step reductions done up to now.
|
private Point[] |
getRandomPoints(int numPoi)
Initializes the iterates for the multi-start algorithm.
|
protected abstract Point[] |
globalSearch(Point[] x,
double delta)
Abstract method for the global search.
|
protected boolean |
haveSufficientDecrease(Point xNew,
Point xBestOld) |
private static Point[] |
increaseSize(Point[] x) |
protected abstract double[][] |
initializeBaseDirectionMatrix()
Method that initializes the base direction matrix.
|
protected abstract Point[] |
localSearch(Point[] x,
double delta)
Abstract method for the local search.
|
private void |
parseCommandFile(int meshSizeDivider,
int initialMeshSizeExponent)
Parses the command file.
|
void |
report(Point x,
boolean MainIteration)
Reports the new trial
|
protected void |
reportMinimum()
Reports the minimum point depending on the flag set by
protected void reportMinimum(boolean) . |
protected void |
reportMinimum(boolean doReport)
Sets a flag that determines whether the minimum will be reported or not.
|
int |
run(Point x0)
Runs the optimization process until a termination criteria
is satisfied
|
protected void |
setMaximumNumberOfStepReduction(int maxNumberOfStepReductions)
Sets the maximum number of step reductions.
|
algorithmRequiresUsageOfStepNumber, appendToOutputListing, checkMaxIteration, ensureOnlyContinuousParameters, ensureOnlyDiscreteParameters, getAbsAccuracyFunction, getDimensionContinuous, getDimensionDiscrete, getDimensionF, getDimensionX, getDiscreteValueDouble0, getDx, getDx0, getF, getIndex0, getIndex0, getInputValueBoolean, getInputValueDouble, getInputValueDouble, getInputValueInteger, getInputValueInteger, getInputValueString, getInputValueString, getKindOfConstraint, getL, getLengthDiscrete, getMainIterationNumber, getMaximumThreadPoolSize, getMaxIterationNumber, getMode, getObjectiveFunctionName, getOutputPath, getPointerToEqualPoints, getRelAccuracyFunction, getSimulationNumber, getStepNumber, getU, getVariableNameContinuous, getVariableNameDiscrete, getX0, getX0, goToEndOfCommandFile, increaseStepNumber, increaseStepNumber, isFeasible, isNextToken, maxIterationReached, mustStopOptimization, print, println, replace, reportCurrentLowestPoint, resetStepNumber, roundCoordinates, run, setInfo, setMode, setNumberOfMatchingResults, setToFeasibleCoordinate, setToFeasibleCoordinate, setWarning, simulate, throwInputError, useStepNumber, writeStepNumber
public static final Point[] EMPTY_SEARCH_SET
private int dimX
private int dimF
private double Zeta
PhiFun
for sufficient decrease in costprivate FunctionEvaluator PhiFun
private double Alpha
public double[][] basDirMat
private int mesSizDiv
private int iniMesSizExp
private int mesSizExpInc
protected int nMaxSteRed
private int nSteRed
private Point[] x
private double fNor
private int k
private double Delta
protected boolean checkObjFun
private int NumIniPoi
private Point[] BesPoi
private boolean RepMin
private java.util.Random RanGen
protected static java.lang.String SUCMOV
protected static java.lang.String FAIMOV
protected static final java.lang.String POSDIR
protected static final java.lang.String NEGDIR
public ModelGPS(GenOpt genOptData) throws OptimizerException, java.io.IOException, java.lang.Exception, InputFormatException
genOptData
- a reference to the GenOpt object.OptimizerException
java.lang.Exception
java.io.IOException
- if an I/O exception occursInputFormatException
public ModelGPS(int meshSizeDivider, int initialMeshSizeExponent) throws OptimizerException, java.io.IOException, java.lang.Exception, InputFormatException
meshSizeDivider
- the mesh size divider.
If set to Integer.MAX_VALUE
, then
the value will be read from the command fileinitialMeshSizeExponent
- the initial mesh size exponent.
If set to Integer.MAX_VALUE
, then
the value will be read from the command fileOptimizerException
java.lang.Exception
java.io.IOException
- if an I/O exception occursInputFormatException
private void parseCommandFile(int meshSizeDivider, int initialMeshSizeExponent) throws OptimizerException, java.io.IOException, java.lang.Exception, InputFormatException
meshSizeDivider
- the mesh size divider.
If set to Integer.MAX_VALUE
, then
the value will be read from the command fileinitialMeshSizeExponent
- the initial mesh size exponent.
If set to Integer.MAX_VALUE
, then
the value will be read from the command fileOptimizerException
java.lang.Exception
java.io.IOException
- if an I/O exception occursInputFormatException
private final FunctionEvaluator _getPrecisionControlFunction(java.lang.String funNam, int include) throws OptimizerException, java.io.IOException, java.lang.Exception, InputFormatException
funNam
- the keyword of the functioninclude
- flag that specifies if zero is includes as a function value or notOptimizerException
java.lang.Exception
java.io.IOException
InputFormatException
protected abstract double[][] initializeBaseDirectionMatrix()
Each column vector is a direction, and the set of column vectors must be a positive span for the domain of independent parameters.
private Point[] getRandomPoints(int numPoi)
numPoi
- number of initial pointspublic int run(Point x0) throws SimulationInputException, OptimizerException, java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.Exception
run
in class Optimizer
x0
- Initial iterate-1
if the maximum number of iteration
is exceeded
+1
if the required accuracy is reachedOptimizerException
- if an OptimizerException occurs or
if the user required to stop GenOptSimulationInputException
- if an error in writing the
simulation input file occursjava.lang.NoSuchMethodException
- if a method that should be invoked could not be foundjava.lang.IllegalAccessException
- if an invoked method enforces Java language access
control and the underlying method is inaccessiblejava.lang.reflect.InvocationTargetException
- if an invoked method throws an exceptionjava.lang.Exception
- if an I/O error in the simulation input file occursprivate int _run(Point xIni) throws SimulationInputException, OptimizerException, java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.Exception
-1
if the maximum number of iteration
is exceeded
+1
if the required accuracy is reachedOptimizerException
- if an OptimizerException occurs or
if the user required to stop GenOptSimulationInputException
- if an error in writing the
simulation input file occursjava.lang.NoSuchMethodException
- if a method that should be invoked could not be foundjava.lang.IllegalAccessException
- if an invoked method enforces Java language access
control and the underlying method is inaccessiblejava.lang.reflect.InvocationTargetException
- if an invoked method throws an exceptionjava.lang.Exception
- if an I/O error in the simulation input file occursprivate final double _getFunctionValue(FunctionEvaluator f, Point x) throws OptimizerException, java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
OptimizerException
java.lang.NoSuchMethodException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
protected final boolean haveSufficientDecrease(Point xNew, Point xBestOld) throws OptimizerException, java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
OptimizerException
java.lang.NoSuchMethodException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
protected final Point[] add(Point[] x0, Point[] x1)
x0
- first vector of pointsx1
- second vector of pointsprotected final double getInitialDelta()
protected final double getDelta()
protected final int getIterationNumber()
protected static int getIndexLowestFunctionValue(Point[] x)
protected void reportMinimum(boolean doReport)
doReport
- protected void reportMinimum() throws java.io.IOException
protected void reportMinimum(boolean)
.reportMinimum
in class Optimizer
java.io.IOException
- if an I/O error in the optimization output files
occurspublic Point getMinimumPoint()
getMinimumPoint
in class Optimizer
protected abstract Point[] globalSearch(Point[] x, double delta) throws SimulationInputException, OptimizerException, java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.Exception
x
- Sequence of previous iteratesdelta
- current mesh sizeEMPTY_SEARCH_SET
.OptimizerException
- if an OptimizerException occurs or
if the user required to stop GenOptSimulationInputException
- if an error in writing the
simulation input file occursjava.lang.NoSuchMethodException
- if a method that should be invoked could not be foundjava.lang.IllegalAccessException
- if an invoked method enforces Java language access
control and the underlying method is inaccessiblejava.lang.reflect.InvocationTargetException
- if an invoked method throws an exceptionjava.lang.Exception
- if an I/O error in the simulation input file occursprotected abstract Point[] localSearch(Point[] x, double delta) throws SimulationInputException, OptimizerException, java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.Exception
x
- Sequence of previous iteratesdelta
- current mesh sizeOptimizerException
- if an OptimizerException occurs or
if the user required to stop GenOptSimulationInputException
- if an error in writing the
simulation input file occursjava.lang.NoSuchMethodException
- if a method that should be invoked could not be foundjava.lang.IllegalAccessException
- if an invoked method enforces Java language access
control and the underlying method is inaccessiblejava.lang.reflect.InvocationTargetException
- if an invoked method throws an exceptionjava.lang.Exception
- if an I/O error in the simulation input file occurspublic void checkObjectiveFunctionValue(Point x) throws OptimizerException
checkObjectiveFunctionValue
in class Optimizer
x
- the point to be checkedOptimizerException
- thrown if the maximum number of matching
function value is obtainedpublic void report(Point x, boolean MainIteration) throws java.io.IOException
public Point getF(Point x) throws SimulationInputException, OptimizerException, java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.Exception
getF
in class Optimizer
x
- the point being evaluatedOptimizerException
- if an OptimizerException occurs or
if the user required to stop GenOptSimulationInputException
- if an error in writing the
simulation input file occursjava.lang.NoSuchMethodException
- if a method that should be invoked could not be foundjava.lang.IllegalAccessException
- if an invoked method enforces Java language access
control and the underlying method is inaccessiblejava.lang.reflect.InvocationTargetException
- if an invoked method throws an exceptionjava.lang.Exception
- if an I/O error in the simulation input file occursprotected int getNumberOfStepReduction()
protected int getMaximumNumberOfStepReduction()
protected void setMaximumNumberOfStepReduction(int maxNumberOfStepReductions)
maxNumberOfStepReductions
- the maximum number of step reductionspublic static double[] getClosestEuclideanMeshPoint(double[] x, double[] xMes, double[] delta)
x
- independent parameterxMes
- any point on the meshdelta
- mesh size factor times the step size of the variablex
in the Euclidean norm.