diff --git a/src/main/java/org/apache/commons/math3/optimization/direct/PowellOptimizer.java b/src/main/java/org/apache/commons/math3/optimization/direct/PowellOptimizer.java index b5e834803..9c3573ba5 100644 --- a/src/main/java/org/apache/commons/math3/optimization/direct/PowellOptimizer.java +++ b/src/main/java/org/apache/commons/math3/optimization/direct/PowellOptimizer.java @@ -42,6 +42,9 @@ import org.apache.commons.math3.optimization.univariate.SimpleUnivariateValueChe * function value between two successive iterations. It is however possible * to define a custom convergence checker that might terminate the algorithm * earlier. + *
+ * The internal line search optimizer is a {@link BrentOptimizer} with a + * convergence checker set to {@link SimpleUnivariateValueChecker}. * * @version $Id$ * @since 2.2 @@ -136,6 +139,23 @@ public class PowellOptimizer this(rel, abs, null); } + /** + * Builds an instance with the default convergence checking procedure. + * + * @param rel Relative threshold. + * @param abs Absolute threshold. + * @param lineRel Relative threshold for the internal line search optimizer. + * @param lineAbs Absolute threshold for the internal line search optimizer. + * @throws NotStrictlyPositiveException if {@code abs <= 0}. + * @throws NumberIsTooSmallException if {@code rel < 2 * Math.ulp(1d)}. + */ + public PowellOptimizer(double rel, + double abs, + double lineRel, + double lineAbs) { + this(rel, abs, lineRel, lineAbs, null); + } + /** {@inheritDoc} */ @Override protected PointValuePair doOptimize() { diff --git a/src/test/java/org/apache/commons/math3/optimization/direct/PowellOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/direct/PowellOptimizerTest.java index c30b9cf0f..f21ebf259 100644 --- a/src/test/java/org/apache/commons/math3/optimization/direct/PowellOptimizerTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/direct/PowellOptimizerTest.java @@ -224,7 +224,7 @@ public class PowellOptimizerTest { double fLineTol, double pointTol) { final MultivariateOptimizer optim = new PowellOptimizer(fTol, Math.ulp(1d), - fLineTol, Math.ulp(1d), null); + fLineTol, Math.ulp(1d)); final PointValuePair result = optim.optimize(1000, func, goal, init); final double[] point = result.getPoint();