improved test coverage

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@795996 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Luc Maisonobe 2009-07-20 20:29:07 +00:00
parent 9d5d0da39b
commit 7b6cd406a2
2 changed files with 4 additions and 2 deletions

View File

@ -32,6 +32,7 @@ import org.apache.commons.math.analysis.MultivariateRealFunction;
import org.apache.commons.math.optimization.GoalType;
import org.apache.commons.math.optimization.OptimizationException;
import org.apache.commons.math.optimization.RealPointValuePair;
import org.apache.commons.math.optimization.SimpleRealPointChecker;
import org.apache.commons.math.optimization.SimpleScalarValueChecker;
import org.junit.Test;
@ -193,7 +194,7 @@ public class NelderMeadTest {
try {
Powell powell = new Powell();
NelderMead optimizer = new NelderMead();
optimizer.setConvergenceChecker(new SimpleScalarValueChecker(-1.0, 1.0e-3));
optimizer.setConvergenceChecker(new SimpleRealPointChecker(-1.0, 1.0e-3));
optimizer.setMaxEvaluations(20);
optimizer.optimize(powell, GoalType.MINIMIZE, new double[] { 3.0, -1.0, 0.0, 1.0 });
} catch (FunctionEvaluationException fee) {

View File

@ -32,6 +32,7 @@ import org.apache.commons.math.analysis.MultivariateMatrixFunction;
import org.apache.commons.math.linear.BlockRealMatrix;
import org.apache.commons.math.linear.RealMatrix;
import org.apache.commons.math.optimization.OptimizationException;
import org.apache.commons.math.optimization.SimpleVectorialPointChecker;
import org.apache.commons.math.optimization.SimpleVectorialValueChecker;
import org.apache.commons.math.optimization.VectorialPointValuePair;
@ -385,7 +386,7 @@ extends TestCase {
circle.addPoint( 45.0, 97.0);
GaussNewtonOptimizer optimizer = new GaussNewtonOptimizer(true);
optimizer.setMaxIterations(100);
optimizer.setConvergenceChecker(new SimpleVectorialValueChecker(1.0e-15, 1.0e-15));
optimizer.setConvergenceChecker(new SimpleVectorialPointChecker(1.0e-30, 1.0e-30));
try {
optimizer.optimize(circle, new double[] { 0, 0, 0, 0, 0 },
new double[] { 1, 1, 1, 1, 1 },