Search in sources :

Example 11 with BOBYQAOptimizer

use of org.apache.commons.math3.optim.nonlinear.scalar.noderiv.BOBYQAOptimizer in project engineblock by engineblock.

the class BobyqaOptimizerInstance method optimize.

public MVResult optimize() {
    initialGuess = initialGuess == null ? computeInitialGuess() : initialGuess;
    bounds = bounds == null ? computeBounds() : bounds;
    interpolations = interpolations == 0 ? getMinInterpolations() : interpolations;
    BOBYQAOptimizer mo = new BOBYQAOptimizer(this.interpolations, this.initialTrustRegionRadius, this.stoppingTrustRegionRadius);
    this.mvLogger = new MVLogger(this.objectiveScriptObject);
    ObjectiveFunction objective = new ObjectiveFunction(this.mvLogger);
    List<OptimizationData> od = List.of(objective, GoalType.MAXIMIZE, this.initialGuess, new MaxEval(this.maxEval), this.bounds);
    this.result = mo.optimize(od.toArray(new OptimizationData[0]));
    return new MVResult(this.result.getPoint(), this.params, this.mvLogger.getLogArray());
}
Also used : BOBYQAOptimizer(org.apache.commons.math3.optim.nonlinear.scalar.noderiv.BOBYQAOptimizer) ObjectiveFunction(org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunction)

Aggregations

ObjectiveFunction (org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunction)8 PointValuePair (org.apache.commons.math3.optim.PointValuePair)7 SimpleBounds (org.apache.commons.math3.optim.SimpleBounds)6 InitialGuess (org.apache.commons.math3.optim.InitialGuess)5 MaxEval (org.apache.commons.math3.optim.MaxEval)5 ConvergenceException (org.apache.commons.math3.exception.ConvergenceException)4 TooManyEvaluationsException (org.apache.commons.math3.exception.TooManyEvaluationsException)4 TooManyIterationsException (org.apache.commons.math3.exception.TooManyIterationsException)4 MaxIter (org.apache.commons.math3.optim.MaxIter)4 OptimizationData (org.apache.commons.math3.optim.OptimizationData)4 SimpleValueChecker (org.apache.commons.math3.optim.SimpleValueChecker)4 BOBYQAOptimizer (org.apache.commons.math3.optim.nonlinear.scalar.noderiv.BOBYQAOptimizer)4 CMAESOptimizer (org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer)4 RandomGenerator (org.apache.commons.math3.random.RandomGenerator)4 LeastSquaresBuilder (org.apache.commons.math3.fitting.leastsquares.LeastSquaresBuilder)2 Optimum (org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer.Optimum)2 LeastSquaresProblem (org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem)2 LevenbergMarquardtOptimizer (org.apache.commons.math3.fitting.leastsquares.LevenbergMarquardtOptimizer)2 DiagonalMatrix (org.apache.commons.math3.linear.DiagonalMatrix)2 BaseOptimizer (org.apache.commons.math3.optim.BaseOptimizer)2