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

Deprecated.
As of 3.1 (to be removed in 4.0).

    @Deprecated
    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: BaseAbstractMultivariateVectorOptimizer.java 1422230 2012-12-15 12:11:13Z erans $

### Field Summary

Fields
`private ConvergenceChecker<PointVectorValuePair>` `checker` Deprecated. Convergence checker.
`protected Incrementor` `evaluations` Deprecated. Evaluations counter.
`private FUNC` `function` Deprecated. Objective function.
`private double[]` `start` Deprecated. Initial guess.
`private double[]` `target` Deprecated. Target value for the objective functions at optimum.
`private double[]` `weight` Deprecated.
`private RealMatrix` `weightMatrix` Deprecated. Weight matrix.

### Constructor Summary

Constructors
`protected` `BaseAbstractMultivariateVectorOptimizer()` Deprecated. See `SimpleVectorValueChecker.SimpleVectorValueChecker()`
`protected` `BaseAbstractMultivariateVectorOptimizer(ConvergenceChecker<PointVectorValuePair> checker)` Deprecated.

### Method Summary

Methods
`private void` `checkParameters()` Deprecated. Check parameters consistency.
`protected double[]` `computeObjectiveValue(double[] point)` Deprecated. Compute the objective function value.
`protected abstract PointVectorValuePair` `doOptimize()` Deprecated. Perform the bulk of the optimization algorithm.
`ConvergenceChecker<PointVectorValuePair>` `getConvergenceChecker()` Deprecated. Get the convergence checker.
`int` `getEvaluations()` Deprecated. Get the number of evaluations of the objective function.
`int` `getMaxEvaluations()` Deprecated. Get the maximal number of function evaluations.
`protected FUNC` `getObjectiveFunction()` Deprecated. Gets the objective vector function.
`double[]` `getStartPoint()` Deprecated. Gets the initial values of the optimized parameters.
`double[]` `getTarget()` Deprecated. Gets the observed values to be matched by the objective vector function.
`protected double[]` `getTargetRef()` Deprecated. As of 3.1.
`RealMatrix` `getWeight()` Deprecated. Gets the weight matrix of the observations.
`protected double[]` `getWeightRef()` Deprecated. As of 3.1.
`PointVectorValuePair` `optimize(int maxEval, FUNC f, double[] t, double[] w, double[] startPoint)` Deprecated. As of 3.1. Please use `optimize(int,MultivariateVectorFunction,OptimizationData[])` instead.
`protected PointVectorValuePair` `optimize(int maxEval, FUNC f, OptimizationData... optData)` Deprecated. Optimize an objective function.
`protected PointVectorValuePair` `optimizeInternal(int maxEval, FUNC f, double[] t, double[] w, double[] startPoint)` Deprecated. As of 3.1. Please use `optimizeInternal(int,MultivariateVectorFunction,OptimizationData[])` instead.
`protected PointVectorValuePair` `optimizeInternal(int maxEval, FUNC f, OptimizationData... optData)` Deprecated. Optimize an objective function.
`private void` `parseOptimizationData(OptimizationData... optData)` Deprecated. Scans the list of (required and optional) optimization data that characterize the problem.
`protected void` `setUp()` Deprecated. Method which a subclass must override whenever its internal state depend on the `input` parsed by this base class.

### 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

Deprecated.
Evaluations counter.

#### checker

    private ConvergenceChecker<PointVectorValuePair> checker

Deprecated.
Convergence checker.

#### target

    private double[] target

Deprecated.
Target value for the objective functions at optimum.

#### weightMatrix

    private RealMatrix weightMatrix

Deprecated.
Weight matrix.

#### weight

    private double[] weight

Deprecated.
Weight for the least squares cost computation.

#### start

    private double[] start

Deprecated.
Initial guess.

#### function

    private FUNC extends MultivariateVectorFunction function

Deprecated.
Objective function.

### Constructor Detail

#### BaseAbstractMultivariateVectorOptimizer

    @Deprecated
    protected BaseAbstractMultivariateVectorOptimizer()

Deprecated. See `SimpleVectorValueChecker.SimpleVectorValueChecker()`
Simple constructor with default settings. The convergence check is set to a `SimpleVectorValueChecker`.

#### BaseAbstractMultivariateVectorOptimizer

    protected BaseAbstractMultivariateVectorOptimizer(ConvergenceChecker<PointVectorValuePair> checker)

Deprecated.

Parameters:
  `checker` - Convergence checker.

### Method Detail

#### getMaxEvaluations

    public int getMaxEvaluations()

Deprecated.
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()

Deprecated.
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()

Deprecated.
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)

Deprecated.
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

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

Deprecated. As of 3.1. Please use `optimize(int,MultivariateVectorFunction,OptimizationData[])` instead.
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.

#### optimize

    protected PointVectorValuePair optimize(int maxEval,
                                FUNC f,
                                OptimizationData... optData)
                                     throws TooManyEvaluationsException,
                                            DimensionMismatchException

Deprecated.
Optimize an objective function.

Parameters:
  `maxEval` - Allowed number of evaluations of the objective function.
  `f` - Objective function.
  `optData` - Optimization data. The following data will be looked for:
  - `Target`
  - `Weight`
  - `InitialGuess`
Returns:
  the point/value pair giving the optimal value of the objective function.
Throws:
  `TooManyEvaluationsException` - if the maximal number of evaluations is exceeded.
  `DimensionMismatchException` - if the initial guess, target, and weight arguments have inconsistent dimensions.
Since:
  3.1

#### optimizeInternal

    @Deprecated
    protected PointVectorValuePair optimizeInternal(int maxEval,
                                                   FUNC f,
                                                   double[] t,
                                                   double[] w,
                                                   double[] startPoint)

Deprecated. As of 3.1. Please use `optimizeInternal(int,MultivariateVectorFunction,OptimizationData[])` instead.
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`

Parameters:
  `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.
  `maxEval` - Maximum number of function evaluations.
Returns:
  the point/value pair giving the optimal value for objective function.
Throws:
  `DimensionMismatchException` - if the start point dimension is wrong.
  `TooManyEvaluationsException` - if the maximal number of evaluations is exceeded.
  `NullArgumentException` - if any argument is `null`.

#### optimizeInternal

    protected PointVectorValuePair optimizeInternal(int maxEval,
                                        FUNC f,
                                        OptimizationData... optData)
                                             throws TooManyEvaluationsException,
                                                    DimensionMismatchException

Deprecated.
Optimize an objective function.

Parameters:
  `maxEval` - Allowed number of evaluations of the objective function.
  `f` - Objective function.
  `optData` - Optimization data. The following data will be looked for:
  - `Target`
  - `Weight`
  - `InitialGuess`
Returns:
  the point/value pair giving the optimal value of the objective function.
Throws:
  `TooManyEvaluationsException` - if the maximal number of evaluations is exceeded.
  `DimensionMismatchException` - if the initial guess, target, and weight arguments have inconsistent dimensions.
Since:
  3.1

#### getStartPoint

    public double[] getStartPoint()

Deprecated.
Gets the initial values of the optimized parameters.

Returns:
  the initial guess.

#### getWeight

    public RealMatrix getWeight()

Deprecated.
Gets the weight matrix of the observations.

Returns:
  the weight matrix.
Since:
  3.1

#### getTarget

    public double[] getTarget()

Deprecated.
Gets the observed values to be matched by the objective vector function.

Returns:
  the target values.
Since:
  3.1

#### getObjectiveFunction

    protected FUNC getObjectiveFunction()

Deprecated.
Gets the objective vector function. Note that this access bypasses the evaluation counter.

Returns:
  the objective vector function.
Since:
  3.1

#### doOptimize

    protected abstract PointVectorValuePair doOptimize()

Deprecated.
Perform the bulk of the optimization algorithm.

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

#### getTargetRef

    @Deprecated
    protected double[] getTargetRef()

Deprecated. As of 3.1.

Returns:
  a reference to the `array`.

#### getWeightRef

    @Deprecated
    protected double[] getWeightRef()

Deprecated. As of 3.1.

Returns:
  a reference to the `array`.

#### setUp

    protected void setUp()

Deprecated.
Method which a subclass must override whenever its internal state depend on the `input` parsed by this base class. It will be called after the parsing step performed in the `optimize` method and just before `doOptimize()`.

Since:
  3.1

#### parseOptimizationData

    private void parseOptimizationData(OptimizationData... optData)

Deprecated.
Scans the list of (required and optional) optimization data that characterize the problem.

Parameters:
  `optData` - Optimization data. The following data will be looked for:
  - `Target`
  - `Weight`
  - `InitialGuess`

#### checkParameters

    private void checkParameters()

Deprecated.
Check parameters consistency.

Throws:
  `DimensionMismatchException` - if `target` and `weightMatrix` have inconsistent dimensions.