commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <gil...@harfang.homelinux.org>
Subject Re: BOBYQA Question
Date Sun, 02 Oct 2011 02:50:48 GMT
Hi Greg.[1]

On Sat, Oct 01, 2011 at 08:28:52PM -0500, Greg Sterijevski wrote:
> Per Phil's suggestion, they are now in
> test/../../optimizers/NISTBatteryTest.java See JIRA: MATH-678 for further
> info.

There currently isn't much info over there...

Also, the new "NISTBatteryTest" test class is quite unwieldy. The usual way
would be that one unit test class tests for its corresponding class in the
"main" source code. E.g.
  BOBYQAOptimizerTest
contains tests for
  BOBYQAOptimizer

So, instead of clumping all tests for all optimizers in a single "BatteryTest"
class (and discriminate by long method names that contain the optimizer
class name), they should rather go in their own optimizer-dedicated classes,
e.g.:
  BOBYQAOptimizerNISTTest
  PowellOptimizerNISTTest
  etc.
Hence someone can concentrate on fixing one optimizer at a time, focusing on
one test class at a time.

You can use inheritance in order to store all the common functionality:

public class NISTAbstractTest {
    // Common functions and general test routines and checks.

    private double[] run(MultivariateRealOptimizer optim,
                         DifferentiableMultivariateRealFunction func,
                         double[] start) {
        return optim.optimize(1000000, func, GoalType.MINIMIZE, start).getPointRef();
    }
}

BOBYQAOptimizerNISTTest extends NISTAbstractTest {
    @Test
    public void lanczos() {
        double[] result = run(new BOBYQAOptimizer(10),
                              lanczosObjectFunc,
                              new double[] { 1.2, 0.3, 5.6, 5.5, 6.5, 7.6 });
        TestUtils.assertEquals(correctParamLanczos, result, 1e-8);
    }
}

That would also make it easier to connect specific JIRA tickets to specific
issues/optimizers, as suggested by Phil.

> 
> Incidentally, the tests were attached to the email thread in regard to
> NonLinearConjugateGradientSolver.

I didn't get any message with such an attachement. Are you sure that it
wasn't stripped off?
Anyways, _this_ thread, and my question, is about coverage of the BOBYQA
code. Testing for this shortcoming of our BOBYQA test suite is not the same
issue as an optimizer failing the NIST test suite. Hence the request to
create a specific (and possibly temporary) "BOBYQAOptimizerCoverageTest".


Best regards,
Gilles

[1] A: Because it messes up the order in which people normally read text.
    Q: Why is top-posting such a bad thing?
    A: Top-posting.
    Q: What is the most annoying thing in e-mail?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message