MATH-707
Renamed "UnivariateRealOptimizer" -> "UnivariateOptimizer". git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1244787 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a13692080e
commit
2812744c9c
|
@ -25,7 +25,7 @@ package org.apache.commons.math3.optimization;
|
|||
* <li>{@link org.apache.commons.math3.optimization.MultivariateOptimizer}</li>
|
||||
* <li>{@link org.apache.commons.math3.optimization.DifferentiableMultivariateOptimizer}</li>
|
||||
* <li>{@link org.apache.commons.math3.optimization.DifferentiableMultivariateVectorOptimizer}</li>
|
||||
* <li>{@link org.apache.commons.math3.optimization.univariate.UnivariateRealOptimizer}</li>
|
||||
* <li>{@link org.apache.commons.math3.optimization.univariate.UnivariateOptimizer}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param <PAIR> Type of the point/objective pair.
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
* interfaces defining the common behavior of optimizers, one for each supported type of objective
|
||||
* function:
|
||||
* <ul>
|
||||
* <li>{@link org.apache.commons.math3.optimization.univariate.UnivariateRealOptimizer
|
||||
* UnivariateRealOptimizer} for {@link org.apache.commons.math3.analysis.UnivariateFunction
|
||||
* <li>{@link org.apache.commons.math3.optimization.univariate.UnivariateOptimizer
|
||||
* UnivariateOptimizer} for {@link org.apache.commons.math3.analysis.UnivariateFunction
|
||||
* univariate real functions}</li>
|
||||
* <li>{@link org.apache.commons.math3.optimization.MultivariateOptimizer
|
||||
* MultivariateOptimizer} for {@link org.apache.commons.math3.analysis.MultivariateFunction
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.commons.math3.optimization.ConvergenceChecker;
|
|||
* @since 2.0
|
||||
*/
|
||||
public abstract class BaseAbstractUnivariateOptimizer
|
||||
implements UnivariateRealOptimizer {
|
||||
implements UnivariateOptimizer {
|
||||
/** Convergence checker. */
|
||||
private final ConvergenceChecker<UnivariatePointValuePair> checker;
|
||||
/** Evaluations counter. */
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.commons.math3.optimization.GoalType;
|
|||
* Commons-Math. Users of the API are advised to base their code on
|
||||
* the following interfaces:
|
||||
* <ul>
|
||||
* <li>{@link org.apache.commons.math3.optimization.univariate.UnivariateRealOptimizer}</li>
|
||||
* <li>{@link org.apache.commons.math3.optimization.univariate.UnivariateOptimizer}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param <FUNC> Type of the objective function to be optimized.
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.apache.commons.math3.optimization.GoalType;
|
|||
import org.apache.commons.math3.optimization.ConvergenceChecker;
|
||||
|
||||
/**
|
||||
* Special implementation of the {@link UnivariateRealOptimizer} interface
|
||||
* Special implementation of the {@link UnivariateOptimizer} interface
|
||||
* adding multi-start features to an existing optimizer.
|
||||
*
|
||||
* This class wraps a classical optimizer to use it several times in
|
||||
|
|
|
@ -24,5 +24,5 @@ import org.apache.commons.math3.analysis.UnivariateFunction;
|
|||
* @version $Id$
|
||||
* @since 3.0
|
||||
*/
|
||||
public interface UnivariateRealOptimizer
|
||||
public interface UnivariateOptimizer
|
||||
extends BaseUnivariateOptimizer<UnivariateFunction> {}
|
|
@ -34,7 +34,7 @@ public final class BrentOptimizerTest {
|
|||
@Test
|
||||
public void testSinMin() {
|
||||
UnivariateFunction f = new SinFunction();
|
||||
UnivariateRealOptimizer optimizer = new BrentOptimizer(1e-10, 1e-14);
|
||||
UnivariateOptimizer optimizer = new BrentOptimizer(1e-10, 1e-14);
|
||||
Assert.assertEquals(3 * Math.PI / 2, optimizer.optimize(200, f, GoalType.MINIMIZE, 4, 5).getPoint(),1e-8);
|
||||
Assert.assertTrue(optimizer.getEvaluations() <= 50);
|
||||
Assert.assertEquals(200, optimizer.getMaxEvaluations());
|
||||
|
@ -53,7 +53,7 @@ public final class BrentOptimizerTest {
|
|||
public void testQuinticMin() {
|
||||
// The function has local minima at -0.27195613 and 0.82221643.
|
||||
UnivariateFunction f = new QuinticFunction();
|
||||
UnivariateRealOptimizer optimizer = new BrentOptimizer(1e-10, 1e-14);
|
||||
UnivariateOptimizer optimizer = new BrentOptimizer(1e-10, 1e-14);
|
||||
Assert.assertEquals(-0.27195613, optimizer.optimize(200, f, GoalType.MINIMIZE, -0.3, -0.2).getPoint(), 1.0e-8);
|
||||
Assert.assertEquals( 0.82221643, optimizer.optimize(200, f, GoalType.MINIMIZE, 0.3, 0.9).getPoint(), 1.0e-8);
|
||||
Assert.assertTrue(optimizer.getEvaluations() <= 50);
|
||||
|
@ -67,7 +67,7 @@ public final class BrentOptimizerTest {
|
|||
public void testQuinticMinStatistics() {
|
||||
// The function has local minima at -0.27195613 and 0.82221643.
|
||||
UnivariateFunction f = new QuinticFunction();
|
||||
UnivariateRealOptimizer optimizer = new BrentOptimizer(1e-11, 1e-14);
|
||||
UnivariateOptimizer optimizer = new BrentOptimizer(1e-11, 1e-14);
|
||||
|
||||
final DescriptiveStatistics[] stat = new DescriptiveStatistics[2];
|
||||
for (int i = 0; i < stat.length; i++) {
|
||||
|
@ -96,7 +96,7 @@ public final class BrentOptimizerTest {
|
|||
// The quintic function has zeros at 0, +-0.5 and +-1.
|
||||
// The function has a local maximum at 0.27195613.
|
||||
UnivariateFunction f = new QuinticFunction();
|
||||
UnivariateRealOptimizer optimizer = new BrentOptimizer(1e-12, 1e-14);
|
||||
UnivariateOptimizer optimizer = new BrentOptimizer(1e-12, 1e-14);
|
||||
Assert.assertEquals(0.27195613, optimizer.optimize(100, f, GoalType.MAXIMIZE, 0.2, 0.3).getPoint(), 1e-8);
|
||||
try {
|
||||
optimizer.optimize(5, f, GoalType.MAXIMIZE, 0.2, 0.3);
|
||||
|
@ -109,7 +109,7 @@ public final class BrentOptimizerTest {
|
|||
@Test
|
||||
public void testMinEndpoints() {
|
||||
UnivariateFunction f = new SinFunction();
|
||||
UnivariateRealOptimizer optimizer = new BrentOptimizer(1e-8, 1e-14);
|
||||
UnivariateOptimizer optimizer = new BrentOptimizer(1e-8, 1e-14);
|
||||
|
||||
// endpoint is minimum
|
||||
double result = optimizer.optimize(50, f, GoalType.MINIMIZE, 3 * Math.PI / 2, 5).getPoint();
|
||||
|
|
|
@ -32,7 +32,7 @@ public class UnivariateMultiStartOptimizerTest {
|
|||
@Test
|
||||
public void testSinMin() {
|
||||
UnivariateFunction f = new SinFunction();
|
||||
UnivariateRealOptimizer underlying = new BrentOptimizer(1e-10, 1e-14);
|
||||
UnivariateOptimizer underlying = new BrentOptimizer(1e-10, 1e-14);
|
||||
JDKRandomGenerator g = new JDKRandomGenerator();
|
||||
g.setSeed(44428400075l);
|
||||
UnivariateMultiStartOptimizer<UnivariateFunction> optimizer =
|
||||
|
@ -54,7 +54,7 @@ public class UnivariateMultiStartOptimizerTest {
|
|||
// The quintic function has zeros at 0, +-0.5 and +-1.
|
||||
// The function has extrema (first derivative is zero) at 0.27195613 and 0.82221643,
|
||||
UnivariateFunction f = new QuinticFunction();
|
||||
UnivariateRealOptimizer underlying = new BrentOptimizer(1e-9, 1e-14);
|
||||
UnivariateOptimizer underlying = new BrentOptimizer(1e-9, 1e-14);
|
||||
JDKRandomGenerator g = new JDKRandomGenerator();
|
||||
g.setSeed(4312000053L);
|
||||
UnivariateMultiStartOptimizer<UnivariateFunction> optimizer =
|
||||
|
@ -83,7 +83,7 @@ public class UnivariateMultiStartOptimizerTest {
|
|||
return 0;
|
||||
}
|
||||
};
|
||||
UnivariateRealOptimizer underlying = new BrentOptimizer(1e-9, 1e-14);
|
||||
UnivariateOptimizer underlying = new BrentOptimizer(1e-9, 1e-14);
|
||||
JDKRandomGenerator g = new JDKRandomGenerator();
|
||||
g.setSeed(4312000053L);
|
||||
UnivariateMultiStartOptimizer<UnivariateFunction> optimizer =
|
||||
|
|
Loading…
Reference in New Issue