Top Description Fields Constructors Methods
org.apache.commons.math3.optimization

public Class BaseMultivariateVectorMultiStartOptimizer<FUNC extends MultivariateVectorFunction>

extends Object
implements BaseMultivariateVectorOptimizer<FUNC extends MultivariateVectorFunction>
Class Inheritance
All Implemented Interfaces
org.apache.commons.math3.optimization.BaseMultivariateVectorOptimizer, org.apache.commons.math3.optimization.BaseOptimizer
Known Direct Subclasses
org.apache.commons.math3.optimization.DifferentiableMultivariateVectorMultiStartOptimizer, org.apache.commons.math3.optimization.MultivariateDifferentiableVectorMultiStartOptimizer
Annotations
@Deprecated
Type Parameters
<FUNC>
Type of the objective function to be optimized.
Imports
java.util.Arrays, .Comparator, org.apache.commons.math3.analysis.MultivariateVectorFunction, org.apache.commons.math3.exception.ConvergenceException, .MathIllegalStateException, .NotStrictlyPositiveException, .NullArgumentException, org.apache.commons.math3.exception.util.LocalizedFormats, org.apache.commons.math3.random.RandomVectorGenerator

Deprecated

As of 3.1 (to be removed in 4.0).

Base class for all implementations of a multi-start optimizer. This interface is mainly intended to enforce the internal coherence of Commons-Math. Users of the API are advised to base their code on DifferentiableMultivariateVectorMultiStartOptimizer.
Since
3.0

Field Summary

Modifier and TypeField and Description
private RandomVectorGenerator
generator

Random generator for multi-start.

private int
maxEvaluations

Maximal number of evaluations allowed.

private PointVectorValuePair[]
optima

Deprecated as a consequence of PointVectorValuePair being deprecated.
Found optima.
private final BaseMultivariateVectorOptimizer<FUNC>
optimizer

Deprecated as a consequence of BaseMultivariateVectorOptimizer being deprecated.
Underlying classical optimizer.
private int
starts

Number of starts to go.

private int
totalEvaluations

Number of evaluations already performed for all starts.

Constructor Summary

AccessConstructor and Description
protected
BaseMultivariateVectorMultiStartOptimizer(final BaseMultivariateVectorOptimizer<FUNC>
Single-start optimizer to wrap.
optimizer
,
final int
Number of starts to perform. If starts == 1, the optimize will return the same solution as optimizer would.
starts
,
final RandomVectorGenerator
Random vector generator to use for restarts.
generator
)
Deprecated as a consequence of BaseMultivariateVectorOptimizer being deprecated.

Create a multi-start optimizer from a single-start optimizer.

Method Summary

Modifier and TypeMethod and Description
public ConvergenceChecker<PointVectorValuePair>
getConvergenceChecker()

Implements org.apache.commons.math3.optimization.BaseOptimizer.getConvergenceChecker.

Deprecated as a consequence of ConvergenceChecker being deprecated.

Get the convergence checker.

public int
getEvaluations()

Implements org.apache.commons.math3.optimization.BaseOptimizer.getEvaluations.

Get the number of evaluations of the objective function.

public int
getMaxEvaluations()

Implements org.apache.commons.math3.optimization.BaseOptimizer.getMaxEvaluations.

Get the maximal number of function evaluations.

public PointVectorValuePair[]

Returns:

array containing the optima
getOptima
()
Deprecated as a consequence of PointVectorValuePair being deprecated.

Get all the optima found during the last call to optimize.

public PointVectorValuePair
optimize(int
Maximum number of function evaluations.
maxEval
,
final FUNC
Objective function.
f
,
double[]
Target value for the objective functions at optimum.
target
,
double[]
Weights for the least squares cost computation.
weights
,
double[]
Start point for optimization.
startPoint
)

Implements org.apache.commons.math3.optimization.BaseMultivariateVectorOptimizer.optimize.

Deprecated as a consequence of PointVectorValuePair being deprecated.

Optimize an objective function.

private void
sortPairs(final double[]
Target value for the objective functions at optimum.
target
,
final double[]
Weights for the least-squares cost computation.
weights
)

Sort the optima from best to worst, followed by null elements.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

generatorback to summary
private RandomVectorGenerator generator

Random generator for multi-start.

maxEvaluationsback to summary
private int maxEvaluations

Maximal number of evaluations allowed.

optimaback to summary
private PointVectorValuePair[] optima

Deprecated

as a consequence of PointVectorValuePair being deprecated. See corresponding docs for further information.

Found optima.

optimizerback to summary
private final BaseMultivariateVectorOptimizer<FUNC> optimizer

Deprecated

as a consequence of BaseMultivariateVectorOptimizer being deprecated. See corresponding docs for further information.

Underlying classical optimizer.

startsback to summary
private int starts

Number of starts to go.

totalEvaluationsback to summary
private int totalEvaluations

Number of evaluations already performed for all starts.

Constructor Detail

BaseMultivariateVectorMultiStartOptimizerback to summary
protected BaseMultivariateVectorMultiStartOptimizer(final BaseMultivariateVectorOptimizer<FUNC> optimizer, final int starts, final RandomVectorGenerator generator)

Deprecated

as a consequence of BaseMultivariateVectorOptimizer being deprecated. See corresponding docs for further information.

Create a multi-start optimizer from a single-start optimizer.

Parameters
optimizer:BaseMultivariateVectorOptimizer<FUNC>

Single-start optimizer to wrap.

starts:int

Number of starts to perform. If starts == 1, the optimize will return the same solution as optimizer would.

generator:RandomVectorGenerator

Random vector generator to use for restarts.

Exceptions
NullArgumentException:
if optimizer or generator is null.
NotStrictlyPositiveException:
if starts < 1.

Method Detail

getConvergenceCheckerback to summary
public ConvergenceChecker<PointVectorValuePair> getConvergenceChecker()

Implements org.apache.commons.math3.optimization.BaseOptimizer.getConvergenceChecker.

Doc from org.apache.commons.math3.optimization.BaseOptimizer.getConvergenceChecker.

Deprecated

as a consequence of ConvergenceChecker being deprecated. See corresponding docs for further information.

Get the convergence checker.

Returns:ConvergenceChecker<PointVectorValuePair>

the object used to check for convergence.

getEvaluationsback to summary
public int getEvaluations()

Implements org.apache.commons.math3.optimization.BaseOptimizer.getEvaluations.

Doc from org.apache.commons.math3.optimization.BaseOptimizer.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.

Returns:int

the number of evaluations of the objective function.

getMaxEvaluationsback to summary
public int getMaxEvaluations()

Implements org.apache.commons.math3.optimization.BaseOptimizer.getMaxEvaluations.

Doc from org.apache.commons.math3.optimization.BaseOptimizer.getMaxEvaluations.

Get the maximal number of function evaluations.

Returns:int

the maximal number of function evaluations.

getOptimaback to summary
public PointVectorValuePair[] getOptima()

Deprecated

as a consequence of PointVectorValuePair being deprecated. See corresponding docs for further information.

Get all the optima found during the last call to optimize. The optimizer stores all the optima found during a set of restarts. The optimize method returns the best point only. This method returns all the points found at the end of each starts, including the best one already returned by the optimize method.
The returned array as one element for each start as specified in the constructor. It is ordered with the results from the runs that did converge first, sorted from best to worst objective value (i.e. in ascending order if minimizing and in descending order if maximizing), followed by and null elements corresponding to the runs that did not converge. This means all elements will be null if the optimize method did throw a ConvergenceException). This also means that if the first element is not null, it is the best point found across all starts.

Returns:PointVectorValuePair[]

array containing the optima

Exceptions
MathIllegalStateException:
if optimize has not been called.
optimizeback to summary
public PointVectorValuePair optimize(int maxEval, final FUNC f, double[] target, double[] weights, double[] startPoint)

Implements org.apache.commons.math3.optimization.BaseMultivariateVectorOptimizer.optimize.

Doc from org.apache.commons.math3.optimization.BaseMultivariateVectorOptimizer.optimize.

Deprecated

as a consequence of PointVectorValuePair being deprecated. See corresponding docs for further information.

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
maxEval:int

Maximum number of function evaluations.

f:FUNC

Objective function.

target:double[]

Target value for the objective functions at optimum.

weights:double[]

Weights for the least squares cost computation.

startPoint:double[]

Start point for optimization.

Returns:PointVectorValuePair

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

sortPairsback to summary
private void sortPairs(final double[] target, final double[] weights)

Sort the optima from best to worst, followed by null elements.

Parameters
target:double[]

Target value for the objective functions at optimum.

weights:double[]

Weights for the least-squares cost computation.