MATH-707
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:
parent
e71093b8df
commit
a51152cc9e
|
@ -32,7 +32,7 @@ import org.apache.commons.math.optimization.ConvergenceChecker;
|
|||
* @version $Id$
|
||||
* @since 2.0
|
||||
*/
|
||||
public abstract class AbstractUnivariateRealOptimizer
|
||||
public abstract class BaseAbstractUnivariateOptimizer
|
||||
implements UnivariateRealOptimizer {
|
||||
/** Convergence checker. */
|
||||
private final ConvergenceChecker<UnivariateRealPointValuePair> checker;
|
||||
|
@ -52,7 +52,7 @@ public abstract class AbstractUnivariateRealOptimizer
|
|||
/**
|
||||
* @param checker Convergence checking procedure.
|
||||
*/
|
||||
protected AbstractUnivariateRealOptimizer(ConvergenceChecker<UnivariateRealPointValuePair> checker) {
|
||||
protected BaseAbstractUnivariateOptimizer(ConvergenceChecker<UnivariateRealPointValuePair> checker) {
|
||||
this.checker = checker;
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ import org.apache.commons.math.optimization.GoalType;
|
|||
* @version $Id$
|
||||
* @since 3.0
|
||||
*/
|
||||
public interface BaseUnivariateRealOptimizer<FUNC extends UnivariateFunction>
|
||||
public interface BaseUnivariateOptimizer<FUNC extends UnivariateFunction>
|
||||
extends BaseOptimizer<UnivariateRealPointValuePair> {
|
||||
/**
|
||||
* Find an optimum in the given interval.
|
|
@ -35,7 +35,7 @@ import org.apache.commons.math.optimization.GoalType;
|
|||
* @version $Id$
|
||||
* @since 2.0
|
||||
*/
|
||||
public class BrentOptimizer extends AbstractUnivariateRealOptimizer {
|
||||
public class BrentOptimizer extends BaseAbstractUnivariateOptimizer {
|
||||
/**
|
||||
* Golden section.
|
||||
*/
|
||||
|
|
|
@ -42,10 +42,10 @@ import org.apache.commons.math.optimization.ConvergenceChecker;
|
|||
* @version $Id$
|
||||
* @since 3.0
|
||||
*/
|
||||
public class MultiStartUnivariateRealOptimizer<FUNC extends UnivariateFunction>
|
||||
implements BaseUnivariateRealOptimizer<FUNC> {
|
||||
public class UnivariateMultiStartOptimizer<FUNC extends UnivariateFunction>
|
||||
implements BaseUnivariateOptimizer<FUNC> {
|
||||
/** Underlying classical optimizer. */
|
||||
private final BaseUnivariateRealOptimizer<FUNC> optimizer;
|
||||
private final BaseUnivariateOptimizer<FUNC> optimizer;
|
||||
/** Maximal number of evaluations allowed. */
|
||||
private int maxEvaluations;
|
||||
/** Number of evaluations already performed for all starts. */
|
||||
|
@ -69,7 +69,7 @@ public class MultiStartUnivariateRealOptimizer<FUNC extends UnivariateFunction>
|
|||
* is {@code null}.
|
||||
* @throws NotStrictlyPositiveException if {@code starts < 1}.
|
||||
*/
|
||||
public MultiStartUnivariateRealOptimizer(final BaseUnivariateRealOptimizer<FUNC> optimizer,
|
||||
public UnivariateMultiStartOptimizer(final BaseUnivariateOptimizer<FUNC> optimizer,
|
||||
final int starts,
|
||||
final RandomGenerator generator) {
|
||||
if (optimizer == null ||
|
|
@ -25,4 +25,4 @@ import org.apache.commons.math.analysis.UnivariateFunction;
|
|||
* @since 3.0
|
||||
*/
|
||||
public interface UnivariateRealOptimizer
|
||||
extends BaseUnivariateRealOptimizer<UnivariateFunction> {}
|
||||
extends BaseUnivariateOptimizer<UnivariateFunction> {}
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.apache.commons.math.util.FastMath;
|
|||
import org.junit.Test;
|
||||
import org.junit.Assert;
|
||||
|
||||
public class MultiStartUnivariateRealOptimizerTest {
|
||||
public class UnivariateMultiStartOptimizerTest {
|
||||
|
||||
@Test
|
||||
public void testSinMin() {
|
||||
|
@ -35,8 +35,8 @@ public class MultiStartUnivariateRealOptimizerTest {
|
|||
UnivariateRealOptimizer underlying = new BrentOptimizer(1e-10, 1e-14);
|
||||
JDKRandomGenerator g = new JDKRandomGenerator();
|
||||
g.setSeed(44428400075l);
|
||||
MultiStartUnivariateRealOptimizer<UnivariateFunction> optimizer =
|
||||
new MultiStartUnivariateRealOptimizer<UnivariateFunction>(underlying, 10, g);
|
||||
UnivariateMultiStartOptimizer<UnivariateFunction> optimizer =
|
||||
new UnivariateMultiStartOptimizer<UnivariateFunction>(underlying, 10, g);
|
||||
optimizer.optimize(300, f, GoalType.MINIMIZE, -100.0, 100.0);
|
||||
UnivariateRealPointValuePair[] optima = optimizer.getOptima();
|
||||
for (int i = 1; i < optima.length; ++i) {
|
||||
|
@ -57,8 +57,8 @@ public class MultiStartUnivariateRealOptimizerTest {
|
|||
UnivariateRealOptimizer underlying = new BrentOptimizer(1e-9, 1e-14);
|
||||
JDKRandomGenerator g = new JDKRandomGenerator();
|
||||
g.setSeed(4312000053L);
|
||||
MultiStartUnivariateRealOptimizer<UnivariateFunction> optimizer =
|
||||
new MultiStartUnivariateRealOptimizer<UnivariateFunction>(underlying, 5, g);
|
||||
UnivariateMultiStartOptimizer<UnivariateFunction> optimizer =
|
||||
new UnivariateMultiStartOptimizer<UnivariateFunction>(underlying, 5, g);
|
||||
|
||||
UnivariateRealPointValuePair optimum
|
||||
= 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);
|
||||
JDKRandomGenerator g = new JDKRandomGenerator();
|
||||
g.setSeed(4312000053L);
|
||||
MultiStartUnivariateRealOptimizer<UnivariateFunction> optimizer =
|
||||
new MultiStartUnivariateRealOptimizer<UnivariateFunction>(underlying, 5, g);
|
||||
UnivariateMultiStartOptimizer<UnivariateFunction> optimizer =
|
||||
new UnivariateMultiStartOptimizer<UnivariateFunction>(underlying, 5, g);
|
||||
|
||||
try {
|
||||
optimizer.optimize(300, f, GoalType.MINIMIZE, -0.3, -0.2);
|
Loading…
Reference in New Issue