org.apache.commons.math3.optim

## Class AbstractOptimizationProblem<PAIR>

- java.lang.Object
- - org.apache.commons.math3.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
  Version:
    $Id: AbstractOptimizationProblem.java 1571015 2014-02-23 14:00:48Z luc $

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractOptimizationProblem(int maxEvaluations, int maxIterations, ConvergenceChecker<PAIR> checker)` Create an `AbstractOptimizationProblem` from the given data.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ConvergenceChecker<PAIR>` | `getConvergenceChecker()` Gets the convergence checker.
    `Incrementor` | `getEvaluationCounter()` Get a independent Incrementor that counts up to the maximum number of evaluations and then throws an exception.
    `Incrementor` | `getIterationCounter()` Get a independent Incrementor that counts up to the maximum number of iterations and then throws an exception.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AbstractOptimizationProblem

          protected AbstractOptimizationProblem(int maxEvaluations,
                                     int maxIterations,
                                     ConvergenceChecker<PAIR> checker)

      Create an `AbstractOptimizationProblem` from 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 Incrementor getEvaluationCounter()

      Get a independent Incrementor that counts up to the maximum number of evaluations and then throws an exception.
      Specified by:
        `getEvaluationCounter` in interface `OptimizationProblem<PAIR>`
      Returns:
        a counter for the evaluations.

    - #### getIterationCounter

          public Incrementor getIterationCounter()

      Get a independent Incrementor that counts up to the maximum number of iterations and then throws an exception.
      Specified by:
        `getIterationCounter` in interface `OptimizationProblem<PAIR>`
      Returns:
        a counter for the evaluations.

    - #### getConvergenceChecker

          public ConvergenceChecker<PAIR> getConvergenceChecker()

      Gets the convergence checker.
      Specified by:
        `getConvergenceChecker` in interface `OptimizationProblem<PAIR>`
      Returns:
        the object used to check for convergence.

Copyright © 2003–2014 The Apache Software Foundation. All rights reserved.