commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles <gil...@harfang.homelinux.org>
Subject Re: [math] Problem using the LevenbergMarquardtOptimizer
Date Sat, 02 Feb 2013 11:24:17 GMT
Hello.

> Dear all,
> I'm using the commons math library for solving least-squares problems
> using the LevenbergMarquardtOptimizer.
> I have a problem when I specify bounds for the estimation (by means
> of a SimpleBounds object). I don't understand why, but the estimate
> seems to not care about the bounds.
> I attach to the mail a simple code which gives the problem. This code
> is inspired to the one published on the web-site for explaining how
> the LevenbergMarquardtOptimizer works...
> The code at the end perform two estimates:
> 1) the first one without bounds is correct;
> 2) the second one, instead, should take care of the bounds, but I
> obtain the same values as in the first case... :-(

Actually, the "LevenbergMarquardtOptimizer" does not support bounds,
even though the API accepts that you pass them.
In fact, all "options" can be passed to all optimizers but not all
optimizers will use all of the options, if you see what I mean. :-)

I agree that this is confusing. [The issue was already raised but
perhaps you could file a report on the project's bug-tracking system
so that we can gather all opinions on how to best deal with it.
I chose the current behaviour because it allows a much simpler API.
One way would be to just document which options are ignored by a
given optimizer implementation (and that would leave room to add
support later).]

Currently, only the "CMAESOptimizer" implementation supports bounds.
However, Commons Math provides function wrappers which you can use to
approximate support for simple bounds:
   
http://commons.apache.org/math/apidocs/org/apache/commons/math3/optim/nonlinear/scalar/MultivariateFunctionMappingAdapter.html
   
http://commons.apache.org/math/apidocs/org/apache/commons/math3/optim/nonlinear/scalar/MultivariateFunctionPenaltyAdapter.html
[But note the caveat indicated there (which might require that you use
a "custom" convergence checker).]

HTH,
Gilles


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


Mime
View raw message