Renamed "SimpleVectorialValueChecker" to "SimpleVectorValueChecker".


git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1243370 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gilles Sadowski 2012-02-12 23:43:48 +00:00
parent 1b8959c711
commit 0f2ef2d954
8 changed files with 34 additions and 34 deletions

View File

@ -31,12 +31,12 @@ import org.apache.commons.math.util.FastMath;
* @version $Id$ * @version $Id$
* @since 3.0 * @since 3.0
*/ */
public class SimpleVectorialValueChecker public class SimpleVectorValueChecker
extends AbstractConvergenceChecker<PointVectorValuePair> { extends AbstractConvergenceChecker<PointVectorValuePair> {
/** /**
* Build an instance with default thresholds. * Build an instance with default thresholds.
*/ */
public SimpleVectorialValueChecker() {} public SimpleVectorValueChecker() {}
/** /**
* Build an instance with specified thresholds. * Build an instance with specified thresholds.
@ -48,7 +48,7 @@ public class SimpleVectorialValueChecker
* @param relativeThreshold relative tolerance threshold * @param relativeThreshold relative tolerance threshold
* @param absoluteThreshold absolute tolerance threshold * @param absoluteThreshold absolute tolerance threshold
*/ */
public SimpleVectorialValueChecker(final double relativeThreshold, public SimpleVectorValueChecker(final double relativeThreshold,
final double absoluteThreshold) { final double absoluteThreshold) {
super(relativeThreshold, absoluteThreshold); super(relativeThreshold, absoluteThreshold);
} }

View File

@ -24,7 +24,7 @@ package org.apache.commons.math.optimization;
* user should provide a class implementing this interface to allow the optimization * user should provide a class implementing this interface to allow the optimization
* algorithm to stop its search according to the problem at hand.</p> * algorithm to stop its search according to the problem at hand.</p>
* <p>For convenience, two implementations that fit simple needs are already provided: * <p>For convenience, two implementations that fit simple needs are already provided:
* {@link SimpleVectorialValueChecker} and {@link SimplePointChecker<PointVectorValuePair>}. The first * {@link SimpleVectorValueChecker} and {@link SimplePointChecker<PointVectorValuePair>}. The first
* one considers convergence is reached when the objective function value does not * one considers convergence is reached when the objective function value does not
* change much anymore, it does not use the point set at all. The second one * change much anymore, it does not use the point set at all. The second one
* considers convergence is reached when the input point set does not change * considers convergence is reached when the input point set does not change

View File

@ -26,7 +26,7 @@ import org.apache.commons.math.analysis.MultivariateVectorFunction;
import org.apache.commons.math.optimization.BaseMultivariateVectorOptimizer; import org.apache.commons.math.optimization.BaseMultivariateVectorOptimizer;
import org.apache.commons.math.optimization.ConvergenceChecker; import org.apache.commons.math.optimization.ConvergenceChecker;
import org.apache.commons.math.optimization.PointVectorValuePair; import org.apache.commons.math.optimization.PointVectorValuePair;
import org.apache.commons.math.optimization.SimpleVectorialValueChecker; import org.apache.commons.math.optimization.SimpleVectorValueChecker;
/** /**
* Base class for implementing optimizers for multivariate scalar functions. * Base class for implementing optimizers for multivariate scalar functions.
@ -55,11 +55,11 @@ public abstract class BaseAbstractMultivariateVectorOptimizer<FUNC extends Multi
/** /**
* Simple constructor with default settings. * Simple constructor with default settings.
* The convergence check is set to a {@link SimpleVectorialValueChecker} and * The convergence check is set to a {@link SimpleVectorValueChecker} and
* the allowed number of evaluations is set to {@link Integer#MAX_VALUE}. * the allowed number of evaluations is set to {@link Integer#MAX_VALUE}.
*/ */
protected BaseAbstractMultivariateVectorOptimizer() { protected BaseAbstractMultivariateVectorOptimizer() {
this(new SimpleVectorialValueChecker()); this(new SimpleVectorValueChecker());
} }
/** /**
* @param checker Convergence checker. * @param checker Convergence checker.

View File

@ -83,7 +83,7 @@ public abstract class AbstractLeastSquaresOptimizer
/** /**
* Simple constructor with default settings. * Simple constructor with default settings.
* The convergence check is set to a {@link * The convergence check is set to a {@link
* org.apache.commons.math.optimization.SimpleVectorialValueChecker}. * org.apache.commons.math.optimization.SimpleVectorValueChecker}.
*/ */
protected AbstractLeastSquaresOptimizer() {} protected AbstractLeastSquaresOptimizer() {}
/** /**

View File

@ -27,7 +27,7 @@ import org.apache.commons.math.linear.QRDecomposition;
import org.apache.commons.math.linear.RealMatrix; import org.apache.commons.math.linear.RealMatrix;
import org.apache.commons.math.linear.SingularMatrixException; import org.apache.commons.math.linear.SingularMatrixException;
import org.apache.commons.math.optimization.ConvergenceChecker; import org.apache.commons.math.optimization.ConvergenceChecker;
import org.apache.commons.math.optimization.SimpleVectorialValueChecker; import org.apache.commons.math.optimization.SimpleVectorValueChecker;
import org.apache.commons.math.optimization.PointVectorValuePair; import org.apache.commons.math.optimization.PointVectorValuePair;
/** /**
@ -51,7 +51,7 @@ public class GaussNewtonOptimizer extends AbstractLeastSquaresOptimizer {
/** /**
* Simple constructor with default settings. * Simple constructor with default settings.
* The normal equations will be solved using LU decomposition and the * The normal equations will be solved using LU decomposition and the
* convergence check is set to a {@link SimpleVectorialValueChecker} * convergence check is set to a {@link SimpleVectorValueChecker}
* with default tolerances. * with default tolerances.
*/ */
public GaussNewtonOptimizer() { public GaussNewtonOptimizer() {
@ -70,7 +70,7 @@ public class GaussNewtonOptimizer extends AbstractLeastSquaresOptimizer {
/** /**
* Simple constructor with default settings. * Simple constructor with default settings.
* The convergence check is set to a {@link SimpleVectorialValueChecker} * The convergence check is set to a {@link SimpleVectorValueChecker}
* with default tolerances. * with default tolerances.
* *
* @param useLU If {@code true}, the normal equations will be solved * @param useLU If {@code true}, the normal equations will be solved
@ -78,7 +78,7 @@ public class GaussNewtonOptimizer extends AbstractLeastSquaresOptimizer {
* decomposition. * decomposition.
*/ */
public GaussNewtonOptimizer(final boolean useLU) { public GaussNewtonOptimizer(final boolean useLU) {
this(useLU, new SimpleVectorialValueChecker()); this(useLU, new SimpleVectorValueChecker());
} }
/** /**

View File

@ -101,7 +101,7 @@ public class DifferentiableMultivariateVectorMultiStartOptimizerTest {
new LinearProblem(new double[][] { { 2 } }, new double[] { 3 }); new LinearProblem(new double[][] { { 2 } }, new double[] { 3 });
DifferentiableMultivariateVectorOptimizer underlyingOptimizer = DifferentiableMultivariateVectorOptimizer underlyingOptimizer =
new GaussNewtonOptimizer(true, new GaussNewtonOptimizer(true,
new SimpleVectorialValueChecker(1.0e-6, 1.0e-6)); new SimpleVectorValueChecker(1.0e-6, 1.0e-6));
JDKRandomGenerator g = new JDKRandomGenerator(); JDKRandomGenerator g = new JDKRandomGenerator();
g.setSeed(16069223052l); g.setSeed(16069223052l);
RandomVectorGenerator generator = RandomVectorGenerator generator =
@ -136,7 +136,7 @@ public class DifferentiableMultivariateVectorMultiStartOptimizerTest {
public void testNoOptimum() { public void testNoOptimum() {
DifferentiableMultivariateVectorOptimizer underlyingOptimizer = DifferentiableMultivariateVectorOptimizer underlyingOptimizer =
new GaussNewtonOptimizer(true, new GaussNewtonOptimizer(true,
new SimpleVectorialValueChecker(1.0e-6, 1.0e-6)); new SimpleVectorValueChecker(1.0e-6, 1.0e-6));
JDKRandomGenerator g = new JDKRandomGenerator(); JDKRandomGenerator g = new JDKRandomGenerator();
g.setSeed(12373523445l); g.setSeed(12373523445l);
RandomVectorGenerator generator = RandomVectorGenerator generator =

View File

@ -29,7 +29,7 @@ import org.apache.commons.math.analysis.DifferentiableMultivariateVectorFunction
import org.apache.commons.math.analysis.MultivariateMatrixFunction; import org.apache.commons.math.analysis.MultivariateMatrixFunction;
import org.apache.commons.math.linear.BlockRealMatrix; import org.apache.commons.math.linear.BlockRealMatrix;
import org.apache.commons.math.linear.RealMatrix; import org.apache.commons.math.linear.RealMatrix;
import org.apache.commons.math.optimization.SimpleVectorialValueChecker; import org.apache.commons.math.optimization.SimpleVectorValueChecker;
import org.apache.commons.math.optimization.PointVectorValuePair; import org.apache.commons.math.optimization.PointVectorValuePair;
import org.apache.commons.math.util.FastMath; import org.apache.commons.math.util.FastMath;
import org.junit.Assert; import org.junit.Assert;
@ -105,7 +105,7 @@ public class GaussNewtonOptimizerTest {
new LinearProblem(new double[][] { { 2 } }, new double[] { 3 }); new LinearProblem(new double[][] { { 2 } }, new double[] { 3 });
GaussNewtonOptimizer optimizer GaussNewtonOptimizer optimizer
= new GaussNewtonOptimizer(new SimpleVectorialValueChecker(1.0e-6, 1.0e-6)); = new GaussNewtonOptimizer(new SimpleVectorValueChecker(1.0e-6, 1.0e-6));
PointVectorValuePair optimum = PointVectorValuePair optimum =
optimizer.optimize(100, problem, problem.target, new double[] { 1 }, new double[] { 0 }); optimizer.optimize(100, problem, problem.target, new double[] { 1 }, new double[] { 0 });
@ -122,7 +122,7 @@ public class GaussNewtonOptimizerTest {
new double[] { 4.0, 6.0, 1.0 }); new double[] { 4.0, 6.0, 1.0 });
GaussNewtonOptimizer optimizer GaussNewtonOptimizer optimizer
= new GaussNewtonOptimizer(new SimpleVectorialValueChecker(1.0e-6, 1.0e-6)); = new GaussNewtonOptimizer(new SimpleVectorValueChecker(1.0e-6, 1.0e-6));
PointVectorValuePair optimum = PointVectorValuePair optimum =
optimizer.optimize(100, problem, problem.target, new double[] { 1, 1, 1 }, new double[] { 0, 0 }); optimizer.optimize(100, problem, problem.target, new double[] { 1, 1, 1 }, new double[] { 0, 0 });
@ -147,7 +147,7 @@ public class GaussNewtonOptimizerTest {
}, new double[] { 0.0, 1.1, 2.2, 3.3, 4.4, 5.5 }); }, new double[] { 0.0, 1.1, 2.2, 3.3, 4.4, 5.5 });
GaussNewtonOptimizer optimizer GaussNewtonOptimizer optimizer
= new GaussNewtonOptimizer(new SimpleVectorialValueChecker(1.0e-6, 1.0e-6)); = new GaussNewtonOptimizer(new SimpleVectorValueChecker(1.0e-6, 1.0e-6));
PointVectorValuePair optimum = PointVectorValuePair optimum =
optimizer.optimize(100, problem, problem.target, new double[] { 1, 1, 1, 1, 1, 1 }, optimizer.optimize(100, problem, problem.target, new double[] { 1, 1, 1, 1, 1, 1 },
@ -168,7 +168,7 @@ public class GaussNewtonOptimizerTest {
}, new double[] { 1, 1, 1}); }, new double[] { 1, 1, 1});
GaussNewtonOptimizer optimizer GaussNewtonOptimizer optimizer
= new GaussNewtonOptimizer(new SimpleVectorialValueChecker(1.0e-6, 1.0e-6)); = new GaussNewtonOptimizer(new SimpleVectorValueChecker(1.0e-6, 1.0e-6));
PointVectorValuePair optimum = PointVectorValuePair optimum =
optimizer.optimize(100, problem, problem.target, new double[] { 1, 1, 1 }, new double[] { 0, 0, 0 }); optimizer.optimize(100, problem, problem.target, new double[] { 1, 1, 1 }, new double[] { 0, 0, 0 });
@ -192,7 +192,7 @@ public class GaussNewtonOptimizerTest {
}, new double[] { 2, -9, 2, 2, 1 + epsilon * epsilon, 2}); }, new double[] { 2, -9, 2, 2, 1 + epsilon * epsilon, 2});
GaussNewtonOptimizer optimizer GaussNewtonOptimizer optimizer
= new GaussNewtonOptimizer(new SimpleVectorialValueChecker(1.0e-6, 1.0e-6)); = new GaussNewtonOptimizer(new SimpleVectorValueChecker(1.0e-6, 1.0e-6));
PointVectorValuePair optimum = PointVectorValuePair optimum =
optimizer.optimize(100, problem, problem.target, new double[] { 1, 1, 1, 1, 1, 1 }, optimizer.optimize(100, problem, problem.target, new double[] { 1, 1, 1, 1, 1, 1 },
@ -217,7 +217,7 @@ public class GaussNewtonOptimizerTest {
}, new double[] { 1, 1, 1 }); }, new double[] { 1, 1, 1 });
GaussNewtonOptimizer optimizer GaussNewtonOptimizer optimizer
= new GaussNewtonOptimizer(new SimpleVectorialValueChecker(1.0e-6, 1.0e-6)); = new GaussNewtonOptimizer(new SimpleVectorValueChecker(1.0e-6, 1.0e-6));
optimizer.optimize(100, problem, problem.target, new double[] { 1, 1, 1 }, new double[] { 0, 0, 0 }); optimizer.optimize(100, problem, problem.target, new double[] { 1, 1, 1 }, new double[] { 0, 0, 0 });
} }
@ -232,7 +232,7 @@ public class GaussNewtonOptimizerTest {
}, new double[] { 32, 23, 33, 31 }); }, new double[] { 32, 23, 33, 31 });
GaussNewtonOptimizer optimizer GaussNewtonOptimizer optimizer
= new GaussNewtonOptimizer(new SimpleVectorialValueChecker(1.0e-6, 1.0e-6)); = new GaussNewtonOptimizer(new SimpleVectorValueChecker(1.0e-6, 1.0e-6));
PointVectorValuePair optimum1 = PointVectorValuePair optimum1 =
optimizer.optimize(100, problem1, problem1.target, new double[] { 1, 1, 1, 1 }, optimizer.optimize(100, problem1, problem1.target, new double[] { 1, 1, 1, 1 },
@ -270,7 +270,7 @@ public class GaussNewtonOptimizerTest {
}, new double[] { 7.0, 3.0, 5.0 }); }, new double[] { 7.0, 3.0, 5.0 });
GaussNewtonOptimizer optimizer GaussNewtonOptimizer optimizer
= new GaussNewtonOptimizer(new SimpleVectorialValueChecker(1.0e-6, 1.0e-6)); = new GaussNewtonOptimizer(new SimpleVectorValueChecker(1.0e-6, 1.0e-6));
optimizer.optimize(100, problem, problem.target, new double[] { 1, 1, 1 }, optimizer.optimize(100, problem, problem.target, new double[] { 1, 1, 1 },
new double[] { 7, 6, 5, 4 }); new double[] { 7, 6, 5, 4 });
@ -287,7 +287,7 @@ public class GaussNewtonOptimizerTest {
}, new double[] { 3.0, 12.0, -1.0, 7.0, 1.0 }); }, new double[] { 3.0, 12.0, -1.0, 7.0, 1.0 });
GaussNewtonOptimizer optimizer GaussNewtonOptimizer optimizer
= new GaussNewtonOptimizer(new SimpleVectorialValueChecker(1.0e-6, 1.0e-6)); = new GaussNewtonOptimizer(new SimpleVectorValueChecker(1.0e-6, 1.0e-6));
optimizer.optimize(100, problem, problem.target, new double[] { 1, 1, 1, 1, 1 }, optimizer.optimize(100, problem, problem.target, new double[] { 1, 1, 1, 1, 1 },
new double[] { 2, 2, 2, 2, 2, 2 }); new double[] { 2, 2, 2, 2, 2, 2 });
@ -302,7 +302,7 @@ public class GaussNewtonOptimizerTest {
}, new double[] { 3.0, 1.0, 5.0 }); }, new double[] { 3.0, 1.0, 5.0 });
GaussNewtonOptimizer optimizer GaussNewtonOptimizer optimizer
= new GaussNewtonOptimizer(new SimpleVectorialValueChecker(1.0e-6, 1.0e-6)); = new GaussNewtonOptimizer(new SimpleVectorValueChecker(1.0e-6, 1.0e-6));
PointVectorValuePair optimum = PointVectorValuePair optimum =
optimizer.optimize(100, problem, problem.target, new double[] { 1, 1, 1 }, optimizer.optimize(100, problem, problem.target, new double[] { 1, 1, 1 },
@ -321,7 +321,7 @@ public class GaussNewtonOptimizerTest {
}, new double[] { 3.0, 1.0, 4.0 }); }, new double[] { 3.0, 1.0, 4.0 });
GaussNewtonOptimizer optimizer GaussNewtonOptimizer optimizer
= new GaussNewtonOptimizer(new SimpleVectorialValueChecker(1.0e-6, 1.0e-6)); = new GaussNewtonOptimizer(new SimpleVectorValueChecker(1.0e-6, 1.0e-6));
optimizer.optimize(100, problem, problem.target, new double[] { 1, 1, 1 }, new double[] { 1, 1 }); optimizer.optimize(100, problem, problem.target, new double[] { 1, 1, 1 }, new double[] { 1, 1 });
Assert.assertTrue(optimizer.getRMS() > 0.1); Assert.assertTrue(optimizer.getRMS() > 0.1);
@ -334,7 +334,7 @@ public class GaussNewtonOptimizerTest {
new LinearProblem(new double[][] { { 1, 0 }, { 0, 1 } }, new double[] { -1, 1 }); new LinearProblem(new double[][] { { 1, 0 }, { 0, 1 } }, new double[] { -1, 1 });
GaussNewtonOptimizer optimizer GaussNewtonOptimizer optimizer
= new GaussNewtonOptimizer(new SimpleVectorialValueChecker(1.0e-6, 1.0e-6)); = new GaussNewtonOptimizer(new SimpleVectorValueChecker(1.0e-6, 1.0e-6));
PointVectorValuePair optimum = PointVectorValuePair optimum =
optimizer.optimize(100, problem, problem.target, new double[] { 1, 1 }, new double[] { 0, 0 }); optimizer.optimize(100, problem, problem.target, new double[] { 1, 1 }, new double[] { 0, 0 });
@ -353,7 +353,7 @@ public class GaussNewtonOptimizerTest {
new LinearProblem(new double[][] { { 1, 0 }, { 0, 1 } }, new double[] { -1, 1 }); new LinearProblem(new double[][] { { 1, 0 }, { 0, 1 } }, new double[] { -1, 1 });
GaussNewtonOptimizer optimizer GaussNewtonOptimizer optimizer
= new GaussNewtonOptimizer(new SimpleVectorialValueChecker(1.0e-6, 1.0e-6)); = new GaussNewtonOptimizer(new SimpleVectorValueChecker(1.0e-6, 1.0e-6));
PointVectorValuePair optimum = PointVectorValuePair optimum =
optimizer.optimize(100, problem, problem.target, new double[] { 1, 1 }, new double[] { 0, 0 }); optimizer.optimize(100, problem, problem.target, new double[] { 1, 1 }, new double[] { 0, 0 });
@ -376,7 +376,7 @@ public class GaussNewtonOptimizerTest {
circle.addPoint( 45.0, 97.0); circle.addPoint( 45.0, 97.0);
GaussNewtonOptimizer optimizer GaussNewtonOptimizer optimizer
= new GaussNewtonOptimizer(new SimpleVectorialValueChecker(1.0e-30, 1.0e-30)); = new GaussNewtonOptimizer(new SimpleVectorValueChecker(1.0e-30, 1.0e-30));
optimizer.optimize(100, circle, new double[] { 0, 0, 0, 0, 0 }, optimizer.optimize(100, circle, new double[] { 0, 0, 0, 0, 0 },
new double[] { 1, 1, 1, 1, 1 }, new double[] { 1, 1, 1, 1, 1 },
@ -393,7 +393,7 @@ public class GaussNewtonOptimizerTest {
circle.addPoint( 45.0, 97.0); circle.addPoint( 45.0, 97.0);
GaussNewtonOptimizer optimizer GaussNewtonOptimizer optimizer
= new GaussNewtonOptimizer(new SimpleVectorialValueChecker(1.0e-13, 1.0e-13)); = new GaussNewtonOptimizer(new SimpleVectorValueChecker(1.0e-13, 1.0e-13));
PointVectorValuePair optimum = PointVectorValuePair optimum =
optimizer.optimize(100, circle, new double[] { 0, 0, 0, 0, 0 }, optimizer.optimize(100, circle, new double[] { 0, 0, 0, 0, 0 },
@ -419,7 +419,7 @@ public class GaussNewtonOptimizerTest {
} }
GaussNewtonOptimizer optimizer GaussNewtonOptimizer optimizer
= new GaussNewtonOptimizer(new SimpleVectorialValueChecker(1.0e-6, 1.0e-6)); = new GaussNewtonOptimizer(new SimpleVectorValueChecker(1.0e-6, 1.0e-6));
optimizer.optimize(100, circle, target, weights, new double[] { -12, -12 }); optimizer.optimize(100, circle, target, weights, new double[] { -12, -12 });
} }
@ -437,7 +437,7 @@ public class GaussNewtonOptimizerTest {
} }
GaussNewtonOptimizer optimizer GaussNewtonOptimizer optimizer
= new GaussNewtonOptimizer(new SimpleVectorialValueChecker(1.0e-6, 1.0e-6)); = new GaussNewtonOptimizer(new SimpleVectorValueChecker(1.0e-6, 1.0e-6));
PointVectorValuePair optimum = PointVectorValuePair optimum =
optimizer.optimize(100, circle, target, weights, new double[] { 0, 0 }); optimizer.optimize(100, circle, target, weights, new double[] { 0, 0 });

View File

@ -33,7 +33,7 @@ import org.apache.commons.math.analysis.MultivariateMatrixFunction;
import org.apache.commons.math.linear.BlockRealMatrix; import org.apache.commons.math.linear.BlockRealMatrix;
import org.apache.commons.math.linear.RealMatrix; import org.apache.commons.math.linear.RealMatrix;
import org.apache.commons.math.linear.SingularMatrixException; import org.apache.commons.math.linear.SingularMatrixException;
import org.apache.commons.math.optimization.SimpleVectorialValueChecker; import org.apache.commons.math.optimization.SimpleVectorValueChecker;
import org.apache.commons.math.optimization.PointVectorValuePair; import org.apache.commons.math.optimization.PointVectorValuePair;
import org.apache.commons.math.util.Precision; import org.apache.commons.math.util.Precision;
import org.apache.commons.math.util.FastMath; import org.apache.commons.math.util.FastMath;
@ -480,7 +480,7 @@ public class LevenbergMarquardtOptimizerTest {
circle.addPoint(points[i][0], points[i][1]); circle.addPoint(points[i][0], points[i][1]);
} }
LevenbergMarquardtOptimizer optimizer LevenbergMarquardtOptimizer optimizer
= new LevenbergMarquardtOptimizer(new SimpleVectorialValueChecker(1.0e-8, 1.0e-8)); = new LevenbergMarquardtOptimizer(new SimpleVectorValueChecker(1.0e-8, 1.0e-8));
PointVectorValuePair optimum = PointVectorValuePair optimum =
optimizer.optimize(100, circle, target, weights, new double[] { -12, -12 }); optimizer.optimize(100, circle, target, weights, new double[] { -12, -12 });
Point2D.Double center = new Point2D.Double(optimum.getPointRef()[0], optimum.getPointRef()[1]); Point2D.Double center = new Point2D.Double(optimum.getPointRef()[0], optimum.getPointRef()[1]);