PAIR
- Type of the point/value pair returned by the optimization
algorithm.public abstract class BaseOptimizer<PAIR>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
BaseOptimizer.MaxEvalCallback
Defines the action to perform when reaching the maximum number
of evaluations.
|
private static class |
BaseOptimizer.MaxIterCallback
Defines the action to perform when reaching the maximum number
of evaluations.
|
Modifier and Type | Field and Description |
---|---|
private ConvergenceChecker<PAIR> |
checker
Convergence checker.
|
protected Incrementor |
evaluations
Evaluations counter.
|
protected Incrementor |
iterations
Iterations counter.
|
Modifier | Constructor and Description |
---|---|
protected |
BaseOptimizer(ConvergenceChecker<PAIR> checker) |
Modifier and Type | Method and Description |
---|---|
protected abstract PAIR |
doOptimize()
Performs the bulk of the optimization algorithm.
|
ConvergenceChecker<PAIR> |
getConvergenceChecker()
Gets the convergence checker.
|
int |
getEvaluations()
Gets the number of evaluations of the objective function.
|
int |
getIterations()
Gets the number of iterations performed by the algorithm.
|
int |
getMaxEvaluations()
Gets the maximal number of function evaluations.
|
int |
getMaxIterations()
Gets the maximal number of iterations.
|
protected void |
incrementEvaluationCount()
Increment the evaluation count.
|
protected void |
incrementIterationCount()
Increment the iteration count.
|
PAIR |
optimize(OptimizationData... optData)
Stores data and performs the optimization.
|
protected void |
parseOptimizationData(OptimizationData... optData)
Scans the list of (required and optional) optimization data that
characterize the problem.
|
protected final Incrementor evaluations
protected final Incrementor iterations
private ConvergenceChecker<PAIR> checker
protected BaseOptimizer(ConvergenceChecker<PAIR> checker)
checker
- Convergence checker.public int getMaxEvaluations()
public int getEvaluations()
optimize
method. It is 0 if the method has not been
called yet.public int getMaxIterations()
public int getIterations()
optimize
method. It is 0 if the method has not been
called yet.public ConvergenceChecker<PAIR> getConvergenceChecker()
public PAIR optimize(OptimizationData... optData) throws TooManyEvaluationsException, TooManyIterationsException
parseOptimizationData(OptimizationData[])
if they need to register
their own options; but then, they must also call
super.parseOptimizationData(optData)
within that method.optData
- Optimization data.
This method will register the following data:
TooManyEvaluationsException
- if the maximal number of
evaluations is exceeded.TooManyIterationsException
- if the maximal number of
iterations is exceeded.protected abstract PAIR doOptimize()
protected void incrementEvaluationCount() throws TooManyEvaluationsException
TooManyEvaluationsException
- if the allowed evaluations
have been exhausted.protected void incrementIterationCount() throws TooManyIterationsException
TooManyIterationsException
- if the allowed iterations
have been exhausted.protected void parseOptimizationData(OptimizationData... optData)
Copyright (c) 2003-2013 Apache Software Foundation