nTransits = function.getNTransits();
System.out.printf("Number of effective transits: %4d\n", nTransits);
// Optimizer set-up
LevenbergMarquardtOptimizer optimizer = new LevenbergMarquardtOptimizer();
optimizer.setMaxIterations( MAX_ITERATIONS );
optimizer.setCostRelativeTolerance( CONVERGENCE );
optimizer.setParRelativeTolerance( CONVERGENCE );
optimizer.setOrthoTolerance( CONVERGENCE );
// BamFunction optimization
VectorialPointValuePair optimum = optimizer.optimize(function, target, weight, FIRST_GUESS);
// Covariances and errors
double[] fitErrors = optimizer.guessParametersErrors();
double[][] fitCovariance = optimizer.getCovariances();
// Output values
FitResults fitResults = new FitResults(
optimum.getValue(), optimum.getPoint(), fitErrors, fitCovariance);