Class AbstractOptimizationProblem<PAIR>
- java.lang.Object
-
- org.apache.commons.math4.legacy.optim.AbstractOptimizationProblem<PAIR>
-
- Type Parameters:
PAIR- Type of the point/value pair returned by the optimization algorithm.
- All Implemented Interfaces:
OptimizationProblem<PAIR>
public abstract class AbstractOptimizationProblem<PAIR> extends Object implements OptimizationProblem<PAIR>
Base class for implementing optimization problems. It contains the boiler-plate code for counting the number of evaluations of the objective function and the number of iterations of the algorithm, and storing the convergence checker.- Since:
- 3.3
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractOptimizationProblem(int maxEvaluations, int maxIterations, ConvergenceChecker<PAIR> checker)Create anAbstractOptimizationProblemfrom the given data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConvergenceChecker<PAIR>getConvergenceChecker()Gets the convergence checker.IntegerSequence.IncrementorgetEvaluationCounter()Get a independent Incrementor that counts up to the maximum number of evaluations and then throws an exception.IntegerSequence.IncrementorgetIterationCounter()Get a independent Incrementor that counts up to the maximum number of iterations and then throws an exception.
-
-
-
Constructor Detail
-
AbstractOptimizationProblem
protected AbstractOptimizationProblem(int maxEvaluations, int maxIterations, ConvergenceChecker<PAIR> checker)
Create anAbstractOptimizationProblemfrom the given data.- Parameters:
maxEvaluations- the number of allowed model function evaluations.maxIterations- the number of allowed iterations.checker- the convergence checker.
-
-
Method Detail
-
getEvaluationCounter
public IntegerSequence.Incrementor getEvaluationCounter()
Get a independent Incrementor that counts up to the maximum number of evaluations and then throws an exception.- Specified by:
getEvaluationCounterin interfaceOptimizationProblem<PAIR>- Returns:
- a counter for the evaluations.
-
getIterationCounter
public IntegerSequence.Incrementor getIterationCounter()
Get a independent Incrementor that counts up to the maximum number of iterations and then throws an exception.- Specified by:
getIterationCounterin interfaceOptimizationProblem<PAIR>- Returns:
- a counter for the evaluations.
-
getConvergenceChecker
public ConvergenceChecker<PAIR> getConvergenceChecker()
Gets the convergence checker.- Specified by:
getConvergenceCheckerin interfaceOptimizationProblem<PAIR>- Returns:
- the object used to check for convergence.
-
-