commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <>
Subject [jira] Commented: (MATH-439) Refactoring of solvers (package "analysis.solvers")
Date Thu, 18 Nov 2010 00:51:15 GMT


Gilles commented on MATH-439:

And another regression (maybe).

Tests run: 12, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.271 sec <<< FAILURE!
 Time elapsed: 0.012 sec  <<< FAILURE!
java.lang.AssertionError: expected:<69.960161753> but was:<5.9097119121754055E9>
        at org.junit.Assert.failNotEquals(
        at org.junit.Assert.assertEquals(
        at org.junit.Assert.assertEquals(
        at org.apache.commons.math.optimization.general.NonLinearConjugateGradientOptimizerTest.testCircleFitting(

The problem is at those lines:
NonLinearConjugateGradientOptimizer optimizer =
    new NonLinearConjugateGradientOptimizer(ConjugateGradientFormula.POLAK_RIBIERE);
optimizer.setConvergenceChecker(new SimpleScalarValueChecker(1.0e-30, 1.0e-30)); // <---
UnivariateRealSolver solver = new BrentSolver(1e-15, 1e-13);
RealPointValuePair optimum =
    optimizer.optimize(circle, GoalType.MINIMIZE, new double[] { 98.680, 47.345 });

Now, when, in the above, the line marked "<--- here" is commented out, the test passes.
However, if the line is left in but another solver is used (I tried {{BisectionSolver}} and
{{SecantSolver}}), the test also passes!
Does someone have an idea of what could be going on?

> Refactoring of solvers (package "analysis.solvers")
> ---------------------------------------------------
>                 Key: MATH-439
>                 URL:
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Gilles
>            Priority: Minor
>             Fix For: 3.0
>         Attachments:
> The classes in package "analysis.solvers" could be refactored similarly to what was done
for package {{optimization}}.
> * Replace {{MaxIterationsExceededException}} with {{TooManyEvaluationsException}}:
> Apart from the class {{MaxIterationsExceededException}} being deprecated, this approach
makes it difficult to compare different algorithms: While the concept of iteration is algorithm-dependent,
the user is probably mostly interested in the number of function evaluations. 
> * Implement the method {{solve}} in the base class ({{UnivariateRealSolverImpl}}) and
define an abstract method {{doSolve}} to be implemented in derived classes. This method would
then use a new {{computeObjectiveFunction}} method that will take care of the counting of
the function evaluations.
> * Remove "protected" fields (the root is unnecessary since it is returned by {{solve}}).
Arguingly the function value is also not very useful (as we know what it should be), except
for debugging purposes (in which case, it might not be a problem to call the function's {{value}}
method once more).
> * Remove the tolerance setter (accuracy) and make the corresponding fields "final".

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message