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 public abstract class BaseAbstractMultivariateVectorOptimizer<FUNC extends MultivariateVectorFunction> extends java.lang.Object implements BaseMultivariateVectorOptimizer<FUNC>
Deprecated.As of 3.1 (to be removed in 4.0).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
-
-
Field Summary
Fields Modifier and Type Field Description 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 Modifier Constructor Description protected
BaseAbstractMultivariateVectorOptimizer()
Deprecated.protected
BaseAbstractMultivariateVectorOptimizer(ConvergenceChecker<PointVectorValuePair> checker)
Deprecated.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description 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.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.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 theinput
parsed by this base class.
-
-
-
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
@Deprecated 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.Simple constructor with default settings. The convergence check is set to aSimpleVectorValueChecker
.
-
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 interfaceBaseOptimizer<FUNC extends MultivariateVectorFunction>
- 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 theoptimize
method. It is 0 if the method has not been called yet.- Specified by:
getEvaluations
in interfaceBaseOptimizer<FUNC extends MultivariateVectorFunction>
- Returns:
- the number of evaluations of the objective function.
-
getConvergenceChecker
public ConvergenceChecker<PointVectorValuePair> getConvergenceChecker()
Deprecated.Get the convergence checker.- Specified by:
getConvergenceChecker
in interfaceBaseOptimizer<FUNC extends MultivariateVectorFunction>
- 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 useoptimize(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 interfaceBaseMultivariateVectorOptimizer<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:- 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 useoptimizeInternal(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 isnull
.
-
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:- 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 theinput
parsed by this base class. It will be called after the parsing step performed in theoptimize
method and just beforedoOptimize()
.- 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:
-
checkParameters
private void checkParameters()
Deprecated.Check parameters consistency.- Throws:
DimensionMismatchException
- iftarget
andweightMatrix
have inconsistent dimensions.
-
-