commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Babak <>
Subject Commons Math - Problem with deprecated OptimizationException using NelderMead.optimize
Date Mon, 08 Aug 2011 15:44:15 GMT

I am new to this forum and this is actually the first time that I use
Apache Commons Math.
I would like use NelderMead class (in package) for
minimizing the parameters of the function that I wrote (which
implements MultivariateRealFunction).

As you know, a call to optimize method in NelderMead should be caught
for three different exceptions, namely FunctionEvaluationException,
IllegalArgumentException and OptimizationException.

However the last one (OptimizationException) has been apparently
deprecated in version 2.2 (to be removed in 3.0). I am using the last
version of Appache.Commons.Math which is apparently 2.2. (although I
see a Javadoc CommonsMath 3.0 snapshot on the website which is
confusing, as there is no sourcecode/jar for version 3.0) and since I
am using Eclipse, I can clearly see that OptimizationException is
visibly deprecated. However (as expected) the compiler does not
complain about it and the program compiles and only at run time the
following exception is thrown:

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError:

It seems that OptimizationException class cannot be found! Usually,
when a class is deprecated, it is still possible to use it (although
not recommended). Beside, I have no choice but to use it (call to
NelderMead.optimise requires to catch this exception). I greatly
appreciate if you can please provide me with your feedbacks.
Alternatively, I assume having the version 3.0 (if available) can
solve my problem as well.

Thank you,

My code is simple and pretty straightforward as in the following:

        NelderMead apacheNelderMead = new NelderMead();

        MyMultivariateRealFunction minFunct = new MyMultivariateRealFunction();

         double[] start = new double[48];
        Arrays.fill(start, 0.1);

        try {
	 minValue = apacheNelderMead.optimize(minFunct, GoalType.MINIMIZE,  start);

	catch ( FunctionEvaluationException e) {
	catch (IllegalArgumentException e) {
	catch (OptimizationException e) {

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message