On 02/02/2013 12:24 PM, Gilles wrote: > 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).]
Well, while preparing the slides for FOSDEM I used the new optimization API myself, and I have to say, I do not like it: * it is confusing (what is actually going on, aka which optimizer supports which options) * non-intuitive (which options are available) I do not have a better idea right away, but it is a clear example that such changes need community support! Thomas --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org