/** {@inheritDoc} */ public VectorialConvergenceChecker getConvergenceChecker() { return optimizer.getConvergenceChecker(); }
/** {@inheritDoc} */ public void setConvergenceChecker(VectorialConvergenceChecker checker) { optimizer.setConvergenceChecker(checker); }
optimizer.setMaxIterations(maxIterations - totalIterations); optimizer.setMaxEvaluations(maxEvaluations - totalEvaluations); optima[i] = optimizer.optimize(f, target, weights, (i == 0) ? startPoint : generator.nextVector()); } catch (FunctionEvaluationException fee) { totalIterations += optimizer.getIterations(); totalEvaluations += optimizer.getEvaluations(); totalJacobianEvaluations += optimizer.getJacobianEvaluations();
optimizer.optimize(new TheoreticalValuesFunction(f), target, weights, initialGuess);
optimizer.setMaxIterations(maxIterations - totalIterations); optimizer.setMaxEvaluations(maxEvaluations - totalEvaluations); optima[i] = optimizer.optimize(f, target, weights, (i == 0) ? startPoint : generator.nextVector()); } catch (FunctionEvaluationException fee) { totalIterations += optimizer.getIterations(); totalEvaluations += optimizer.getEvaluations(); totalJacobianEvaluations += optimizer.getJacobianEvaluations();
/** Fit a curve. * <p>This method compute the coefficients of the curve that best * fit the sample of observed points previously given through calls * to the {@link #addObservedPoint(WeightedObservedPoint) * addObservedPoint} method.</p> * @param f parametric function to fit * @param initialGuess first guess of the function parameters * @return fitted parameters * @exception FunctionEvaluationException if the objective function throws one during the search * @exception OptimizationException if the algorithm failed to converge * @exception IllegalArgumentException if the start point dimension is wrong */ public double[] fit(final ParametricRealFunction f, final double[] initialGuess) throws FunctionEvaluationException, OptimizationException, IllegalArgumentException { // prepare least squares problem double[] target = new double[observations.size()]; double[] weights = new double[observations.size()]; int i = 0; for (WeightedObservedPoint point : observations) { target[i] = point.getY(); weights[i] = point.getWeight(); ++i; } // perform the fit VectorialPointValuePair optimum = optimizer.optimize(new TheoreticalValuesFunction(f), target, weights, initialGuess); // extract the coefficients return optimum.getPointRef(); }
/** {@inheritDoc} */ public void setConvergenceChecker(VectorialConvergenceChecker checker) { optimizer.setConvergenceChecker(checker); }
/** {@inheritDoc} */ public VectorialConvergenceChecker getConvergenceChecker() { return optimizer.getConvergenceChecker(); }