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:
Gilles Sadowski 2012-02-15 23:24:33 +00:00
parent a13692080e
commit 2812744c9c
8 changed files with 15 additions and 15 deletions

View File

@ -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.MultivariateOptimizer}</li>
* <li>{@link org.apache.commons.math3.optimization.DifferentiableMultivariateOptimizer}</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.DifferentiableMultivariateVectorOptimizer}</li>
* <li>{@link org.apache.commons.math3.optimization.univariate.UnivariateRealOptimizer}</li> * <li>{@link org.apache.commons.math3.optimization.univariate.UnivariateOptimizer}</li>
* </ul> * </ul>
* *
* @param <PAIR> Type of the point/objective pair. * @param <PAIR> Type of the point/objective pair.

View File

@ -32,8 +32,8 @@
* interfaces defining the common behavior of optimizers, one for each supported type of objective * interfaces defining the common behavior of optimizers, one for each supported type of objective
* function: * function:
* <ul> * <ul>
* <li>{@link org.apache.commons.math3.optimization.univariate.UnivariateRealOptimizer * <li>{@link org.apache.commons.math3.optimization.univariate.UnivariateOptimizer
* UnivariateRealOptimizer} for {@link org.apache.commons.math3.analysis.UnivariateFunction * UnivariateOptimizer} for {@link org.apache.commons.math3.analysis.UnivariateFunction
* univariate real functions}</li> * univariate real functions}</li>
* <li>{@link org.apache.commons.math3.optimization.MultivariateOptimizer * <li>{@link org.apache.commons.math3.optimization.MultivariateOptimizer
* MultivariateOptimizer} for {@link org.apache.commons.math3.analysis.MultivariateFunction * MultivariateOptimizer} for {@link org.apache.commons.math3.analysis.MultivariateFunction

View File

@ -33,7 +33,7 @@ import org.apache.commons.math3.optimization.ConvergenceChecker;
* @since 2.0 * @since 2.0
*/ */
public abstract class BaseAbstractUnivariateOptimizer public abstract class BaseAbstractUnivariateOptimizer
implements UnivariateRealOptimizer { implements UnivariateOptimizer {
/** Convergence checker. */ /** Convergence checker. */
private final ConvergenceChecker<UnivariatePointValuePair> checker; private final ConvergenceChecker<UnivariatePointValuePair> checker;
/** Evaluations counter. */ /** Evaluations counter. */

View File

@ -26,7 +26,7 @@ import org.apache.commons.math3.optimization.GoalType;
* Commons-Math. Users of the API are advised to base their code on * Commons-Math. Users of the API are advised to base their code on
* the following interfaces: * the following interfaces:
* <ul> * <ul>
* <li>{@link org.apache.commons.math3.optimization.univariate.UnivariateRealOptimizer}</li> * <li>{@link org.apache.commons.math3.optimization.univariate.UnivariateOptimizer}</li>
* </ul> * </ul>
* *
* @param <FUNC> Type of the objective function to be optimized. * @param <FUNC> Type of the objective function to be optimized.

View File

@ -30,7 +30,7 @@ import org.apache.commons.math3.optimization.GoalType;
import org.apache.commons.math3.optimization.ConvergenceChecker; 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. * adding multi-start features to an existing optimizer.
* *
* This class wraps a classical optimizer to use it several times in * This class wraps a classical optimizer to use it several times in

View File

@ -24,5 +24,5 @@ import org.apache.commons.math3.analysis.UnivariateFunction;
* @version $Id$ * @version $Id$
* @since 3.0 * @since 3.0
*/ */
public interface UnivariateRealOptimizer public interface UnivariateOptimizer
extends BaseUnivariateOptimizer<UnivariateFunction> {} extends BaseUnivariateOptimizer<UnivariateFunction> {}

View File

@ -34,7 +34,7 @@ public final class BrentOptimizerTest {
@Test @Test
public void testSinMin() { public void testSinMin() {
UnivariateFunction f = new SinFunction(); 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.assertEquals(3 * Math.PI / 2, optimizer.optimize(200, f, GoalType.MINIMIZE, 4, 5).getPoint(),1e-8);
Assert.assertTrue(optimizer.getEvaluations() <= 50); Assert.assertTrue(optimizer.getEvaluations() <= 50);
Assert.assertEquals(200, optimizer.getMaxEvaluations()); Assert.assertEquals(200, optimizer.getMaxEvaluations());
@ -53,7 +53,7 @@ public final class BrentOptimizerTest {
public void testQuinticMin() { public void testQuinticMin() {
// The function has local minima at -0.27195613 and 0.82221643. // The function has local minima at -0.27195613 and 0.82221643.
UnivariateFunction f = new QuinticFunction(); 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.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.assertEquals( 0.82221643, optimizer.optimize(200, f, GoalType.MINIMIZE, 0.3, 0.9).getPoint(), 1.0e-8);
Assert.assertTrue(optimizer.getEvaluations() <= 50); Assert.assertTrue(optimizer.getEvaluations() <= 50);
@ -67,7 +67,7 @@ public final class BrentOptimizerTest {
public void testQuinticMinStatistics() { public void testQuinticMinStatistics() {
// The function has local minima at -0.27195613 and 0.82221643. // The function has local minima at -0.27195613 and 0.82221643.
UnivariateFunction f = new QuinticFunction(); 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]; final DescriptiveStatistics[] stat = new DescriptiveStatistics[2];
for (int i = 0; i < stat.length; i++) { 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 quintic function has zeros at 0, +-0.5 and +-1.
// The function has a local maximum at 0.27195613. // The function has a local maximum at 0.27195613.
UnivariateFunction f = new QuinticFunction(); 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); Assert.assertEquals(0.27195613, optimizer.optimize(100, f, GoalType.MAXIMIZE, 0.2, 0.3).getPoint(), 1e-8);
try { try {
optimizer.optimize(5, f, GoalType.MAXIMIZE, 0.2, 0.3); optimizer.optimize(5, f, GoalType.MAXIMIZE, 0.2, 0.3);
@ -109,7 +109,7 @@ public final class BrentOptimizerTest {
@Test @Test
public void testMinEndpoints() { public void testMinEndpoints() {
UnivariateFunction f = new SinFunction(); UnivariateFunction f = new SinFunction();
UnivariateRealOptimizer optimizer = new BrentOptimizer(1e-8, 1e-14); UnivariateOptimizer optimizer = new BrentOptimizer(1e-8, 1e-14);
// endpoint is minimum // endpoint is minimum
double result = optimizer.optimize(50, f, GoalType.MINIMIZE, 3 * Math.PI / 2, 5).getPoint(); double result = optimizer.optimize(50, f, GoalType.MINIMIZE, 3 * Math.PI / 2, 5).getPoint();

View File

@ -32,7 +32,7 @@ public class UnivariateMultiStartOptimizerTest {
@Test @Test
public void testSinMin() { public void testSinMin() {
UnivariateFunction f = new SinFunction(); UnivariateFunction f = new SinFunction();
UnivariateRealOptimizer underlying = new BrentOptimizer(1e-10, 1e-14); UnivariateOptimizer underlying = new BrentOptimizer(1e-10, 1e-14);
JDKRandomGenerator g = new JDKRandomGenerator(); JDKRandomGenerator g = new JDKRandomGenerator();
g.setSeed(44428400075l); g.setSeed(44428400075l);
UnivariateMultiStartOptimizer<UnivariateFunction> optimizer = UnivariateMultiStartOptimizer<UnivariateFunction> optimizer =
@ -54,7 +54,7 @@ public class UnivariateMultiStartOptimizerTest {
// The quintic function has zeros at 0, +-0.5 and +-1. // 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, // The function has extrema (first derivative is zero) at 0.27195613 and 0.82221643,
UnivariateFunction f = new QuinticFunction(); UnivariateFunction f = new QuinticFunction();
UnivariateRealOptimizer underlying = new BrentOptimizer(1e-9, 1e-14); UnivariateOptimizer underlying = new BrentOptimizer(1e-9, 1e-14);
JDKRandomGenerator g = new JDKRandomGenerator(); JDKRandomGenerator g = new JDKRandomGenerator();
g.setSeed(4312000053L); g.setSeed(4312000053L);
UnivariateMultiStartOptimizer<UnivariateFunction> optimizer = UnivariateMultiStartOptimizer<UnivariateFunction> optimizer =
@ -83,7 +83,7 @@ public class UnivariateMultiStartOptimizerTest {
return 0; return 0;
} }
}; };
UnivariateRealOptimizer underlying = new BrentOptimizer(1e-9, 1e-14); UnivariateOptimizer underlying = new BrentOptimizer(1e-9, 1e-14);
JDKRandomGenerator g = new JDKRandomGenerator(); JDKRandomGenerator g = new JDKRandomGenerator();
g.setSeed(4312000053L); g.setSeed(4312000053L);
UnivariateMultiStartOptimizer<UnivariateFunction> optimizer = UnivariateMultiStartOptimizer<UnivariateFunction> optimizer =