Example usage for org.apache.commons.math3.optimization.direct BaseAbstractMultivariateOptimizer optimize

List of usage examples for org.apache.commons.math3.optimization.direct BaseAbstractMultivariateOptimizer optimize

Introduction

In this page you can find the example usage for org.apache.commons.math3.optimization.direct BaseAbstractMultivariateOptimizer optimize.

Prototype

public PointValuePair optimize(int maxEval, FUNC f, GoalType goalType, OptimizationData... optData) 

Source Link

Document

Optimize an objective function.

Usage

From source file:gamlss.algorithm.GlobalOptimGAMLSS.java

/**
 * optimises the objective function/*from w w  w .  j a v a 2  s.c  om*/
 * @param optim the optimizer such as CMAESOptimizer or BOBYQAOptimizer
 * @param startValues the starting values of the optimisation 
 * @return the point/value pair giving the optimal value for objective function. 
 */
public PointValuePair optimazer(BaseAbstractMultivariateOptimizer<MultivariateFunctionMappingAdapter> optim,
        double[] startValues) {
    PointValuePair results = null;
    try {
        results = optim.optimize(100000, this.objFunction, GoalType.MINIMIZE, startValues);
    } catch (MaxCountExceededException e) {
        System.err.println("more optimisation steps are needed - best results so far are returned");
    }
    return results;
}