## org.apache.commons.math3.optimization.direct
Class BaseAbstractMultivariateVectorOptimizer<FUNC extends MultivariateVectorFunction>

    java.lang.Object
      org.apache.commons.math3.optimization.direct.BaseAbstractMultivariateVectorOptimizer<FUNC>

Type Parameters:
  `FUNC` - the type of the objective function to be optimized

All Implemented Interfaces:
  BaseMultivariateVectorOptimizer<FUNC>, BaseOptimizer<PointVectorValuePair>

Direct Known Subclasses:
  AbstractLeastSquaresOptimizer

    public abstract class BaseAbstractMultivariateVectorOptimizer<FUNC extends MultivariateVectorFunction>

extends Object
implements BaseMultivariateVectorOptimizer<FUNC>

Base class for implementing optimizers for multivariate scalar functions. This base class handles the boiler-plate methods associated to thresholds settings, iterations and evaluations counting.

Since:
  3.0
Version:
  $Id$

Field Summary
`private ConvergenceChecker<PointVectorValuePair>` `checker` Convergence checker.
`protected Incrementor` `evaluations` Evaluations counter.
`private MultivariateVectorFunction` `function` Objective function.
`private double[]` `start` Initial guess.
`private double[]` `target` Target value for the objective functions at optimum.
`private double[]` `weight` Weight for the least squares cost computation.

Constructor Summary
`protected` `BaseAbstractMultivariateVectorOptimizer()` Simple constructor with default settings.
`protected` `BaseAbstractMultivariateVectorOptimizer(ConvergenceChecker<PointVectorValuePair> checker)`

Method Summary
`protected double[]` `computeObjectiveValue(double[] point)` Compute the objective function value.
`protected abstract PointVectorValuePair` `doOptimize()` Perform the bulk of the optimization algorithm.
`ConvergenceChecker<PointVectorValuePair>` `getConvergenceChecker()` Get the convergence checker.
`int` `getEvaluations()` Get the number of evaluations of the objective function.
`int` `getMaxEvaluations()` Get the maximal number of function evaluations.
`double[]` `getStartPoint()`
`protected double[]` `getTargetRef()`
`protected double[]` `getWeightRef()`
`PointVectorValuePair` `optimize(int maxEval, FUNC f, double[] t, double[] w, double[] startPoint)` Optimize an objective function.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### evaluations

    protected final Incrementor evaluations

  Evaluations counter.

### checker

    private ConvergenceChecker<PointVectorValuePair> checker

  Convergence checker.

### target

    private double[] target

  Target value for the objective functions at optimum.

### weight

    private double[] weight

  Weight for the least squares cost computation.

### start

    private double[] start

  Initial guess.

### function

    private MultivariateVectorFunction function

  Objective function.

Constructor Detail

### BaseAbstractMultivariateVectorOptimizer

    protected BaseAbstractMultivariateVectorOptimizer()

  Simple constructor with default settings. The convergence check is set to a `SimpleVectorValueChecker` and the allowed number of evaluations is set to `Integer.MAX_VALUE`.

### BaseAbstractMultivariateVectorOptimizer

    protected BaseAbstractMultivariateVectorOptimizer(ConvergenceChecker<PointVectorValuePair> checker)

Parameters:
  `checker` - Convergence checker.

Method Detail

### getMaxEvaluations

    public int getMaxEvaluations()

  Get the maximal number of function evaluations.

  Specified by:
    `getMaxEvaluations` in interface `BaseOptimizer<PointVectorValuePair>`
  Returns:
    the maximal number of function evaluations.

### getEvaluations

    public int getEvaluations()

  Get the number of evaluations of the objective function. The number of evaluations corresponds to the last call to the `optimize` method. It is 0 if the method has not been called yet.

  Specified by:
    `getEvaluations` in interface `BaseOptimizer<PointVectorValuePair>`
  Returns:
    the number of evaluations of the objective function.

### getConvergenceChecker

    public ConvergenceChecker<PointVectorValuePair> getConvergenceChecker()

  Get the convergence checker.

  Specified by:
    `getConvergenceChecker` in interface `BaseOptimizer<PointVectorValuePair>`
  Returns:
    the object used to check for convergence.

### computeObjectiveValue

    protected double[] computeObjectiveValue(double[] point)

  Compute the objective function value.

  Parameters:
    `point` - Point at which the objective function must be evaluated.
  Returns:
    the objective function value at the specified point.
  Throws:
    `TooManyEvaluationsException` - if the maximal number of evaluations is exceeded.

### optimize

    public PointVectorValuePair optimize(int maxEval,
                                         FUNC f,
                                         double[] t,
                                         double[] w,
                                         double[] startPoint)

  Optimize an objective function. Optimization is considered to be a weighted least-squares minimization. The cost function to be minimized is `∑weighti(objectivei - targeti)2`

  Specified by:
    `optimize` in interface `BaseMultivariateVectorOptimizer<FUNC extends MultivariateVectorFunction>`
  Parameters:
    `maxEval` - Maximum number of function evaluations.
    `f` - Objective function.
    `t` - Target value for the objective functions at optimum.
    `w` - Weights for the least squares cost computation.
    `startPoint` - Start point for optimization.
  Returns:
    the point/value pair giving the optimal value for objective function.

### getStartPoint

    public double[] getStartPoint()

  Returns:
    the initial guess.

### doOptimize

    protected abstract PointVectorValuePair doOptimize()

  Perform the bulk of the optimization algorithm.

  Returns:
    the point/value pair giving the optimal value for the objective function.

### getTargetRef

    protected double[] getTargetRef()

  Returns:
    a reference to the `array`.

### getWeightRef

    protected double[] getWeightRef()

  Returns:
    a reference to the `array`.

Copyright (c) 2003-2013 Apache Software Foundation