Class name change:
  "AbstractUnivariateRealOptimizer" -> "BaseAbstractUnivariateOptimizer"
  "MultiStartUnivariateRealOptimizer" -> "UnivariateMultiStartOptimizer"
  "BaseUnivariateRealOptimizer" -> "BaseUnivariateOptimizer"


git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1212385 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gilles Sadowski 2011-12-09 13:00:11 +00:00
parent e71093b8df
commit a51152cc9e
6 changed files with 16 additions and 16 deletions

View File

@ -32,7 +32,7 @@ import org.apache.commons.math.optimization.ConvergenceChecker;
* @version $Id$ * @version $Id$
* @since 2.0 * @since 2.0
*/ */
public abstract class AbstractUnivariateRealOptimizer public abstract class BaseAbstractUnivariateOptimizer
implements UnivariateRealOptimizer { implements UnivariateRealOptimizer {
/** Convergence checker. */ /** Convergence checker. */
private final ConvergenceChecker<UnivariateRealPointValuePair> checker; private final ConvergenceChecker<UnivariateRealPointValuePair> checker;
@ -52,7 +52,7 @@ public abstract class AbstractUnivariateRealOptimizer
/** /**
* @param checker Convergence checking procedure. * @param checker Convergence checking procedure.
*/ */
protected AbstractUnivariateRealOptimizer(ConvergenceChecker<UnivariateRealPointValuePair> checker) { protected BaseAbstractUnivariateOptimizer(ConvergenceChecker<UnivariateRealPointValuePair> checker) {
this.checker = checker; this.checker = checker;
} }

View File

@ -34,7 +34,7 @@ import org.apache.commons.math.optimization.GoalType;
* @version $Id$ * @version $Id$
* @since 3.0 * @since 3.0
*/ */
public interface BaseUnivariateRealOptimizer<FUNC extends UnivariateFunction> public interface BaseUnivariateOptimizer<FUNC extends UnivariateFunction>
extends BaseOptimizer<UnivariateRealPointValuePair> { extends BaseOptimizer<UnivariateRealPointValuePair> {
/** /**
* Find an optimum in the given interval. * Find an optimum in the given interval.

View File

@ -35,7 +35,7 @@ import org.apache.commons.math.optimization.GoalType;
* @version $Id$ * @version $Id$
* @since 2.0 * @since 2.0
*/ */
public class BrentOptimizer extends AbstractUnivariateRealOptimizer { public class BrentOptimizer extends BaseAbstractUnivariateOptimizer {
/** /**
* Golden section. * Golden section.
*/ */

View File

@ -42,10 +42,10 @@ import org.apache.commons.math.optimization.ConvergenceChecker;
* @version $Id$ * @version $Id$
* @since 3.0 * @since 3.0
*/ */
public class MultiStartUnivariateRealOptimizer<FUNC extends UnivariateFunction> public class UnivariateMultiStartOptimizer<FUNC extends UnivariateFunction>
implements BaseUnivariateRealOptimizer<FUNC> { implements BaseUnivariateOptimizer<FUNC> {
/** Underlying classical optimizer. */ /** Underlying classical optimizer. */
private final BaseUnivariateRealOptimizer<FUNC> optimizer; private final BaseUnivariateOptimizer<FUNC> optimizer;
/** Maximal number of evaluations allowed. */ /** Maximal number of evaluations allowed. */
private int maxEvaluations; private int maxEvaluations;
/** Number of evaluations already performed for all starts. */ /** Number of evaluations already performed for all starts. */
@ -69,7 +69,7 @@ public class MultiStartUnivariateRealOptimizer<FUNC extends UnivariateFunction>
* is {@code null}. * is {@code null}.
* @throws NotStrictlyPositiveException if {@code starts < 1}. * @throws NotStrictlyPositiveException if {@code starts < 1}.
*/ */
public MultiStartUnivariateRealOptimizer(final BaseUnivariateRealOptimizer<FUNC> optimizer, public UnivariateMultiStartOptimizer(final BaseUnivariateOptimizer<FUNC> optimizer,
final int starts, final int starts,
final RandomGenerator generator) { final RandomGenerator generator) {
if (optimizer == null || if (optimizer == null ||

View File

@ -25,4 +25,4 @@ import org.apache.commons.math.analysis.UnivariateFunction;
* @since 3.0 * @since 3.0
*/ */
public interface UnivariateRealOptimizer public interface UnivariateRealOptimizer
extends BaseUnivariateRealOptimizer<UnivariateFunction> {} extends BaseUnivariateOptimizer<UnivariateFunction> {}

View File

@ -27,7 +27,7 @@ import org.apache.commons.math.util.FastMath;
import org.junit.Test; import org.junit.Test;
import org.junit.Assert; import org.junit.Assert;
public class MultiStartUnivariateRealOptimizerTest { public class UnivariateMultiStartOptimizerTest {
@Test @Test
public void testSinMin() { public void testSinMin() {
@ -35,8 +35,8 @@ public class MultiStartUnivariateRealOptimizerTest {
UnivariateRealOptimizer underlying = new BrentOptimizer(1e-10, 1e-14); UnivariateRealOptimizer underlying = new BrentOptimizer(1e-10, 1e-14);
JDKRandomGenerator g = new JDKRandomGenerator(); JDKRandomGenerator g = new JDKRandomGenerator();
g.setSeed(44428400075l); g.setSeed(44428400075l);
MultiStartUnivariateRealOptimizer<UnivariateFunction> optimizer = UnivariateMultiStartOptimizer<UnivariateFunction> optimizer =
new MultiStartUnivariateRealOptimizer<UnivariateFunction>(underlying, 10, g); new UnivariateMultiStartOptimizer<UnivariateFunction>(underlying, 10, g);
optimizer.optimize(300, f, GoalType.MINIMIZE, -100.0, 100.0); optimizer.optimize(300, f, GoalType.MINIMIZE, -100.0, 100.0);
UnivariateRealPointValuePair[] optima = optimizer.getOptima(); UnivariateRealPointValuePair[] optima = optimizer.getOptima();
for (int i = 1; i < optima.length; ++i) { for (int i = 1; i < optima.length; ++i) {
@ -57,8 +57,8 @@ public class MultiStartUnivariateRealOptimizerTest {
UnivariateRealOptimizer underlying = new BrentOptimizer(1e-9, 1e-14); UnivariateRealOptimizer underlying = new BrentOptimizer(1e-9, 1e-14);
JDKRandomGenerator g = new JDKRandomGenerator(); JDKRandomGenerator g = new JDKRandomGenerator();
g.setSeed(4312000053L); g.setSeed(4312000053L);
MultiStartUnivariateRealOptimizer<UnivariateFunction> optimizer = UnivariateMultiStartOptimizer<UnivariateFunction> optimizer =
new MultiStartUnivariateRealOptimizer<UnivariateFunction>(underlying, 5, g); new UnivariateMultiStartOptimizer<UnivariateFunction>(underlying, 5, g);
UnivariateRealPointValuePair optimum UnivariateRealPointValuePair optimum
= optimizer.optimize(300, f, GoalType.MINIMIZE, -0.3, -0.2); = optimizer.optimize(300, f, GoalType.MINIMIZE, -0.3, -0.2);
@ -86,8 +86,8 @@ public class MultiStartUnivariateRealOptimizerTest {
UnivariateRealOptimizer underlying = new BrentOptimizer(1e-9, 1e-14); UnivariateRealOptimizer underlying = new BrentOptimizer(1e-9, 1e-14);
JDKRandomGenerator g = new JDKRandomGenerator(); JDKRandomGenerator g = new JDKRandomGenerator();
g.setSeed(4312000053L); g.setSeed(4312000053L);
MultiStartUnivariateRealOptimizer<UnivariateFunction> optimizer = UnivariateMultiStartOptimizer<UnivariateFunction> optimizer =
new MultiStartUnivariateRealOptimizer<UnivariateFunction>(underlying, 5, g); new UnivariateMultiStartOptimizer<UnivariateFunction>(underlying, 5, g);
try { try {
optimizer.optimize(300, f, GoalType.MINIMIZE, -0.3, -0.2); optimizer.optimize(300, f, GoalType.MINIMIZE, -0.3, -0.2);